|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
I'm making a project in Java. It needs to connect to a mySQL db and do shit.
I can't get it to connect.
I have mySQL set up, and here's the code:
import java.sql.*; class Sqlconn{ public static void main(String[] args){ Connection myCon; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); myCon = DriverManager.getConnection( "jdbc:mysql://localhost/myproj", "admin","temp"); myCon.close(); } catch (Exception sqlEx){ System.err.println(sqlEx); } } }
I'm pretty sure the code should work, because I basically copy and pasted it from a tutorial. Do I have to do something with my db first? I can login and do stuff from the command line just fine. I'm getting
CommunicationsException: Communications link failure
when I run this.
|
On December 11 2010 06:34 crazeman wrote: I guess this is more like a general question on how to structure/design code.
I graduated from college and received my bachelor's degree in CS last fall but one thing that always bothers me is how shitty my code is. By the time my senior year hit, I was taking 5 CS classes a semester in order to graduate on time and was basically bombarded by constant homeworks/projects. This forced me to write very shitty non-versatile code because I was just rushed to meet the deadline as opposed to writing organized code (I would put everything in one class, use global variables everywhere, etc). Usually I could meet my deadline... but if there was a follow up assignment to modify my old code, I was fucked and might as well rewrite everything since it was a mess to modify it and even I have a hell of a time reading my own code. I got away with this because my professors are lazy as fuck and would usually just run the program and base the grade off of whether it did what it was supposed to.
does anyone have any tip on organizing code or have a good book that they recommend that will help me in this area? A friend of mine told me that I should of taken the Design Patterns course at college but I didn't do it because it wasn't a requirement and it was a class for grad students.
Try top down design pattern.
Say your code wants to go from A to B
Define C such that you can go from A to C to B
ect ect
until your roadmap is fine enough you can directly implement in the language.
This suggests a good way to break your code in to modules
|
On December 11 2010 21:07 BottleAbuser wrote:I'm making a project in Java. It needs to connect to a mySQL db and do shit. I can't get it to connect. I have mySQL set up, and here's the code: import java.sql.*; class Sqlconn{ public static void main(String[] args){ Connection myCon; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); myCon = DriverManager.getConnection( "jdbc:mysql://localhost/myproj", "admin","temp"); myCon.close(); } catch (Exception sqlEx){ System.err.println(sqlEx); } } } I'm pretty sure the code should work, because I basically copy and pasted it from a tutorial. Do I have to do something with my db first? I can login and do stuff from the command line just fine. I'm getting CommunicationsException: Communications link failure when I run this.
Might be a JDBC config problem? http://forums.mysql.com/read.php?39,199085,204628#msg-204628
|
On December 11 2010 21:07 BottleAbuser wrote:I'm making a project in Java. It needs to connect to a mySQL db and do shit. I can't get it to connect. I have mySQL set up, and here's the code: import java.sql.*; class Sqlconn{ public static void main(String[] args){ Connection myCon; try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); myCon = DriverManager.getConnection( "jdbc:mysql://localhost/myproj", "admin","temp"); myCon.close(); } catch (Exception sqlEx){ System.err.println(sqlEx); } } } I'm pretty sure the code should work, because I basically copy and pasted it from a tutorial. Do I have to do something with my db first? I can login and do stuff from the command line just fine. I'm getting CommunicationsException: Communications link failure when I run this.
You do have to do something with your database you are running on your machine. Everything is correct untill we get to ../myproj I guess you do not have a database in your mysql with the name mysql.
Im guessing you are using Mysql Workbench to configure your db. So I assume you have a user in the SQL Development, enter with this user, and you will see a dropdown box with label "default". In here you have different databases you can connect too. Lets say you have a database with name "test". The new correct url would be: jdbc:mysql://localhost/test Ofcourse with the user and password property behind the url. Basically the DB url is built like this: jdbc:mysql:[host][:port]/[database][?property1][=value]...
So to give a full example. You have following database, user and password User: root Password: Pass1 Database: test
The url would be: "jdbc:mysql://127.0.0.1:3306/test?user=root&password=Pass1"
This is when its hardcoded in, but you atleast get to see the entire url for yourself.
|
NVM, think I solved it.
EDIT: mod can delete this
|
OK; here's another question.
So basically I have been playing around with the win32 api for c++, getting to know the language abit and such. Playing around with Read/writeProcessMemory which is interesting -- I wrote a program with changed another programs values in memory.
Now the next step I think would be to do it on a live program like a game (say Diablo 2 for instance). The big questionmark however is how would one go about finding out the live memory addresses of that process? Anyone have any idea? I suspect some sort of live debugger is needed O_o
|
On December 20 2010 06:59 KaiserJohan wrote: OK; here's another question.
So basically I have been playing around with the win32 api for c++, getting to know the language abit and such. Playing around with Read/writeProcessMemory which is interesting -- I wrote a program with changed another programs values in memory.
Now the next step I think would be to do it on a live program like a game (say Diablo 2 for instance). The big questionmark however is how would one go about finding out the live memory addresses of that process? Anyone have any idea? I suspect some sort of live debugger is needed O_o
For what it sounds like you want to do, I would recommend for example: http://www.amazon.com/Exploiting-Online-Games-Massively-Distributed/dp/0132271915/ref=sr_1_1?ie=UTF8&s=books&qid=1292796673&sr=8-1 .
|
On December 20 2010 07:11 ParasitJonte wrote:Show nested quote +On December 20 2010 06:59 KaiserJohan wrote: OK; here's another question.
So basically I have been playing around with the win32 api for c++, getting to know the language abit and such. Playing around with Read/writeProcessMemory which is interesting -- I wrote a program with changed another programs values in memory.
Now the next step I think would be to do it on a live program like a game (say Diablo 2 for instance). The big questionmark however is how would one go about finding out the live memory addresses of that process? Anyone have any idea? I suspect some sort of live debugger is needed O_o For what it sounds like you want to do, I would recommend for example: http://www.amazon.com/Exploiting-Online-Games-Massively-Distributed/dp/0132271915/ref=sr_1_1?ie=UTF8&s=books&qid=1292796673&sr=8-1 .
I don't know, I'm mostly doing this for learning win32 api and fun, I would probably aim at old games like Diablo 2 and such that probably don't have much protection and of no consequence to others if I do something bad -- so mostly offline stuff :p
|
anyone have some experience programming for Android platform? I know they give the SDK but I didn't had time yet to start looking at it.
Is it simple? Can you program in "any" language or your stuck to java ?
|
On December 20 2010 06:59 KaiserJohan wrote: OK; here's another question.
So basically I have been playing around with the win32 api for c++, getting to know the language abit and such. Playing around with Read/writeProcessMemory which is interesting -- I wrote a program with changed another programs values in memory.
Now the next step I think would be to do it on a live program like a game (say Diablo 2 for instance). The big questionmark however is how would one go about finding out the live memory addresses of that process? Anyone have any idea? I suspect some sort of live debugger is needed O_o You're gonna wanna get OllyDbg (I'd recommend the older 1.x version, there's a 2.x version out, but its not as good at this point). You'll also want to get some kind of memory searcher, MemHack should probably be sufficient for your needs ( http://memoryhacking.com/ ). From there, your basic process is:
A) Figure out what you want to find B) Hypothesize how the game handles storing it C) Determine a repeatable sequence you can use to narrow down the applicable memory addresses to just a few in MemHack D) Utilize OllyDbg to find and analyze the code that uses that memory
From there there are a lot of possibilities, but you're going to want to develop a good understanding of assembly and hooking if you want to do anything real useful/fun. The good news is, if you just keep at it, that will all come in time. At least it did for me 
There are some decent sites out there that discuss a lot of related topics, although I'm not sure how much real 'beginniner' stuff you'll find. One of the better ones is: http://gamedeception.net
Most of those sites are gonna be filled with hacks and hack-makers, but the process is the same whether you're trying to make cheats or legitimate utilities.
Anyway, hope that helps. Feel free to PM me or ask in here if you have any more questions, I love reversing and talking about reversing
|
TossFloss
Canada606 Posts
|
I'm sorry if this post is out of place or inappropriate, but why is haskel not being discuessed here? I haven't read this whole thread, so if it is in here im sorry. But this language yields sooooo much power and will be the standard in about 10 years imo. People are catching onto it such as the facebook chat was written in haskel.
|
I think Scala as a language can work with the Android platform as well.
|
Hyrule18968 Posts
On December 20 2010 11:10 mptj wrote: I'm sorry if this post is out of place or inappropriate, but why is haskel not being discuessed here? I haven't read this whole thread, so if it is in here im sorry. But this language yields sooooo much power and will be the standard in about 10 years imo. People are catching onto it such as the facebook chat was written in haskel. Because nobody has, simply put. Feel free to impart some information on us or ask some questions about it. I'm sure there's some other fans out there.
|
On December 20 2010 11:10 mptj wrote: I'm sorry if this post is out of place or inappropriate, but why is haskel not being discuessed here? I haven't read this whole thread, so if it is in here im sorry. But this language yields sooooo much power and will be the standard in about 10 years imo. People are catching onto it such as the facebook chat was written in haskel.
According to Wikipedia, the FB chat was written in Erlang: http://en.wikipedia.org/wiki/Erlang_(programming_language)
I agree that Haskell's an interesting language, but I don't think it will be the standard anytime soon. I'm not prepared to argue whether it is worse or better than C/C++/Java for actual development, and honestly I have no idea, but I just don't see the industry itself making such a huge change from imperative to functional. The industry is imperative-based right now, so the universities/colleges teach imperative programming so their students are actually employed, and I don't see how this spiral could end.
But I'm still up for discussing Haskell.
And if you don't know haskell, look it up, because it has some very nice stuff: http://en.wikipedia.org/wiki/Haskell_(programming_language)#Code_examples
|
I got more questions regarding memory manipulation.
1) Can you use fixed, static memory addresses in your code? Say one of your variables always has a certain address at each run or a pointer has the same value each run. It does feel kinda logical though, I mean we are only dealing with logical addresses, not the 'randomly' allocated physical memory itself. Moreover, is there a reason this is actually prefered? Makes the job of hacking so much easier than if you'd have to probe everything again for the right address.
2) How does anti-hacking software actually detect 'illegal' read and writes to memory of a program? I mean it's done directly through windows API, does the VAC example nestle itself in read/write procedures or what? :S
Cheers
|
On December 23 2010 04:14 KaiserJohan wrote: I got more questions regarding memory manipulation.
1) Can you use fixed, static memory addresses in your code? Say one of your variables always has a certain address at each run or a pointer has the same value each run. It does feel kinda logical though, I mean we are only dealing with logical addresses, not the 'randomly' allocated physical memory itself. Moreover, is there a reason this is actually prefered? Makes the job of hacking so much easier than if you'd have to probe everything again for the right address.
2) How does anti-hacking software actually detect 'illegal' read and writes to memory of a program? I mean it's done directly through windows API, does the VAC example nestle itself in read/write procedures or what? :S
Cheers
1) If you're inside the process you're manipulating, you can do it with straight pointers, memcpy, etc. If you're not, you can do it through ReadProcessMemory/WriteProcessMemory. Generally, the more modern a program is, the less likely it is that you're going to be dealing with addresses that are static between runs. This is because OO design results in dynamically allocated objects. The only times you're going to find stuff that is static between runs is when its coded to always be allocated at the same memory location, or its a global variable. So generally, you have to use another method to find where its located in memory. There are a bunch of different ways to do that (pattern scans, etc.), but usually its easier to hook the function that modifies that data, and change how it modifies things.
2) There's a variety of different methods used. Some software will scan the copy of the program in memory versus the copy on disk and try to detect differences caused by hooking (although this is obviously time consuming, so often it will scan specific offsets for these changes). Some software hooks system functions like Read/WriteProcessMemory to detect writes into the process that stipulate hacking, etc. VAC I believe works through the former, as most useful stuff that can be done must be done from inside the process through hooks. There are, however, some interesting hacks out there that are done entirely outside the process (this, for example: http://www.gamedeception.net/threads/21173-Extern-CS-S-multihack )
|
How would you get identify/access the functions? Sounds like you need to do some assembler-digging to do that? (unstanding compiler-generated assembly is impossible >.<) Guess it's not possible to do outside assembly?
|
So folks, here's a special request 
I have a problem to solve which is a Traveling salesman problem. Now i've found stuff about the so called "Euclidean Traveling Salesman Problem", which basically tells us how to find a good approximation for the best solution in the special case that all places to visit lie in a plane with euclidean metrics. The thing is, my program runs on GPS coordinates, meaning i'm not on a plane, but on a sphere surface. However, since it theoretically is possible to map a sphere surface onto a plane and back using stereographic projection, the approach might be transferable.
Visually speaking, stereographic projection sort of wraps positive and negative infinity together. I am not sure if that would disturb whatever exactly requires the euclidean metrics in a plane in that algorithm. So here's my question to those great mathematicians of you: Am i right? Oo
|
So I am in a game development class at my high school. Sort of a retarded class really. We are learning Game Maker, and about 90% of the people screw up stupid stuff with its ridiculously easy drag and drop system. I like to be ahead on these type of things that interest me, so I've gone ahead and I'm learning GML(game maker language). I find it very satisfying, just the part of writing code and seeing it produce a result excites me. I'd certainly like to continue and pursue programming and game development as a hobby. I am starting to feel good doing somewhat basic programming in GML, and I'm just starting to learn Actionscript 2.0. What else should I learn?
One thing that interested me was doing indie games for the xbox live marketplace. I read a bit about it and it uses Microsoft XNA which uses C#. would C# be easy enough to learn or should I go somewhere else first? I dont want to simply limit myself to making games and be a good all around programmer but I want games to be my main focus.
|
|
|
|