do you also have a guide for VB6 and VB.NET? Would be really nice!
Thx
Forum Index > General Forum |
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. | ||
Kaluba
Germany21 Posts
do you also have a guide for VB6 and VB.NET? Would be really nice! Thx | ||
Adeny
Norway1233 Posts
C#, TCP, network streams. server code:
Client code:
It seems to just block on the return indefinately. Oh and it works if I reply twice, what? Jeez I'm probably missing something painfully obvious... Edit: I mean it blocks specifically on that return and awaits the servers answer. | ||
haduken
Australia8267 Posts
On September 26 2010 23:02 Adeny wrote: Let's ask some more questions! Weeee! Not going to edit because no one will answer if it doesn't get bumped. This time, how do I sockets? Relax, I'll go more in depth, here's my current set up: VM Linux with MySQL <- Server application (C#) <- Client application(C#). All well and good, in fact I can register and "log in" based on data from the database. However I'm stuck when it comes to handling multiple user connections. Now, I obviously want threads, but how do I "manage" the connections? I'm thinking I should keep an array of users that connect, then make a separate thread for each user of course, and then dispose of the threads that aren't in use because users disconnected. Makes sense right? But how do I go about doing that? I.E. Do I make one "master socket" that everyone connects to, then make a new thread every time someone connects to it, and somehow automagically transfer that client over to the new socket? All in all I am confuse. You should look into credential management in .NET and I thought concurrency is handled by the database most of the time. | ||
![]()
tofucake
Hyrule18968 Posts
On October 07 2010 11:09 Adeny wrote: This is killing me, here goes: C#, TCP, network streams. server code: + Show Spoiler +
Client code:
It seems to just block on the return indefinately. Oh and it works if I reply twice, what? Jeez I'm probably missing something painfully obvious... Edit: I mean it blocks specifically on that return and awaits the servers answer. You can't just assume that you've received data. You need to check before you try to read. | ||
Yiko
Germany104 Posts
On October 07 2010 11:09 Adeny wrote: This is killing me, here goes: C#, TCP, network streams. + Show Spoiler + server code:
Client code:
It seems to just block on the return indefinately. Oh and it works if I reply twice, what? Jeez I'm probably missing something painfully obvious... Edit: I mean it blocks specifically on that return and awaits the servers answer. Have you tried flushing the serverside streamwriter?
I'm no .NET expert but that would be my first guess. | ||
Adeny
Norway1233 Posts
On October 08 2010 01:52 tofucake wrote: + Show Spoiler + On October 07 2010 11:09 Adeny wrote: This is killing me, here goes: C#, TCP, network streams. server code: + Show Spoiler +
Client code:
It seems to just block on the return indefinately. Oh and it works if I reply twice, what? Jeez I'm probably missing something painfully obvious... Edit: I mean it blocks specifically on that return and awaits the servers answer. You can't just assume that you've received data. You need to check before you try to read. Yes but sr.ReadLine() blocks the program (or thread) until data can be read. So when I step through it it reaches that ReadLine() and is in blocking mode, but when data is sent, it keeps blocking. | ||
Adeny
Norway1233 Posts
On October 08 2010 02:05 Yiko wrote: + Show Spoiler + On October 07 2010 11:09 Adeny wrote: This is killing me, here goes: C#, TCP, network streams. + Show Spoiler + server code:
Client code:
It seems to just block on the return indefinately. Oh and it works if I reply twice, what? Jeez I'm probably missing something painfully obvious... Edit: I mean it blocks specifically on that return and awaits the servers answer. Have you tried flushing the serverside streamwriter?
I'm no .NET expert but that would be my first guess. I'm using AutoFlush, is there any difference from just flushing manually with every send? Tried flushing manually, doesn't work. I read up and there weren't a lot of difference, mainly performance ones. | ||
Adeny
Norway1233 Posts
On October 08 2010 00:58 haduken wrote: + Show Spoiler + On September 26 2010 23:02 Adeny wrote: Let's ask some more questions! Weeee! Not going to edit because no one will answer if it doesn't get bumped. This time, how do I sockets? Relax, I'll go more in depth, here's my current set up: VM Linux with MySQL <- Server application (C#) <- Client application(C#). All well and good, in fact I can register and "log in" based on data from the database. However I'm stuck when it comes to handling multiple user connections. Now, I obviously want threads, but how do I "manage" the connections? I'm thinking I should keep an array of users that connect, then make a separate thread for each user of course, and then dispose of the threads that aren't in use because users disconnected. Makes sense right? But how do I go about doing that? I.E. Do I make one "master socket" that everyone connects to, then make a new thread every time someone connects to it, and somehow automagically transfer that client over to the new socket? All in all I am confuse. You should look into credential management in .NET and I thought concurrency is handled by the database most of the time. I'll take a look at credential management, however wouldn't it be very bad to allow the client program direct access to a database? Seeing as you need to include the connection string somewhere, there's also packet forging. Either way here's what I ended up with: Server has a thread which checks for connections, if someone connects, a thread is created specifically for them which contains the interaction stuff. If this thread throws an exception I clean up and decrement the variable keeping track of how many connections I have. Not the prettiest of solutions as it relies on an exception... | ||
Adeny
Norway1233 Posts
On October 08 2010 02:12 Adeny wrote: Show nested quote + On October 08 2010 01:52 tofucake wrote: + Show Spoiler + On October 07 2010 11:09 Adeny wrote: This is killing me, here goes: C#, TCP, network streams. server code: + Show Spoiler +
Client code:
It seems to just block on the return indefinately. Oh and it works if I reply twice, what? Jeez I'm probably missing something painfully obvious... Edit: I mean it blocks specifically on that return and awaits the servers answer. You can't just assume that you've received data. You need to check before you try to read. Yes but sr.ReadLine() blocks the program (or thread) until data can be read. So when I step through it it reaches that ReadLine() and is in blocking mode, but when data is sent, it keeps blocking. If anyone wants to know I figured out what happened... Basically I had another thread on the client which I though it would have broken out of but I forgot the "break;", and so this reached a StreamReader.ReadLine() first and got the data from the server. I should've figured it out when it worked sending the same data twice... Threads and sockets man, so confusing. | ||
Cofo
United States1388 Posts
Basically, I'm looking for an internship for this summer. However, the courses I'm taking this semester are more hardware/logic oriented, so I feel like I'm not really gaining skills that will be useful for a programming job. I've been messing around in Java on my own, but I was just wondering if there are any other things I could be doing or specific topics I should study independently that would help me secure some kind of internship. Or just any internship advice in general would be great. ^^ Thanks! | ||
OPSavioR
Sweden1465 Posts
| ||
haduken
Australia8267 Posts
Haven't failed me yet. | ||
Triscuit
United States722 Posts
I guess I've come to a realization slowly over the past few semesters. I need help with programming. I don't think I am a *poor* programmer, but I really don't have any confidence in my ability to get larger projects done. I don't think I have the experience necessary to help me easily think about data structures or algorithms in a disciplined way, and I think if I continue down this path, I'll continue to be a sub-par programmer and this will hurt me immensely in the long run. I don't really have issues with languages as much as I have trouble with the abstractions. So, I the questions I ask of you fine programmers are: How do you practice these things? Do you have any references or textbooks that have been of particular value to you? What were things that you learned in the workplace that you wish you had known in school, or even when you were first finding a job? Thanks for your help. | ||
toadstool
Australia421 Posts
On October 27 2010 07:33 Triscuit wrote: Hi TL programmers. I'm a third year CS student right now at the University of Texas at Austin. I guess I've come to a realization slowly over the past few semesters. I need help with programming. I don't think I am a *poor* programmer, but I really don't have any confidence in my ability to get larger projects done. I don't think I have the experience necessary to help me easily think about data structures or algorithms in a disciplined way, and I think if I continue down this path, I'll continue to be a sub-par programmer and this will hurt me immensely in the long run. I don't really have issues with languages as much as I have trouble with the abstractions. So, I the questions I ask of you fine programmers are: How do you practice these things? Do you have any references or textbooks that have been of particular value to you? What were things that you learned in the workplace that you wish you had known in school, or even when you were first finding a job? Thanks for your help. The simple answer is: practice programming yourself. Make mistakes, learn why and how things work and you'll know more about how the language works and simple programming tricks and traps to avoid. Mistakes are the best way to learn. If you make a new XML parser, and you luckily get it 100% correct the first time, you won't learn anything. If you make it and spend 2 weeks figuring out the quirks and bugs, you'll know the system inside out. And you'll develop better code in the long run. I went through a rough patch during uni, but now I'm fairly confident in my code. Also another tip is: the simpler the code is, the better. Don't try to do things complicated, you'll run into problems in the long run. | ||
Triscuit
United States722 Posts
On October 27 2010 07:52 toadstool wrote: Show nested quote + On October 27 2010 07:33 Triscuit wrote: Hi TL programmers. I'm a third year CS student right now at the University of Texas at Austin. I guess I've come to a realization slowly over the past few semesters. I need help with programming. I don't think I am a *poor* programmer, but I really don't have any confidence in my ability to get larger projects done. I don't think I have the experience necessary to help me easily think about data structures or algorithms in a disciplined way, and I think if I continue down this path, I'll continue to be a sub-par programmer and this will hurt me immensely in the long run. I don't really have issues with languages as much as I have trouble with the abstractions. So, I the questions I ask of you fine programmers are: How do you practice these things? Do you have any references or textbooks that have been of particular value to you? What were things that you learned in the workplace that you wish you had known in school, or even when you were first finding a job? Thanks for your help. The simple answer is: practice programming yourself. Make mistakes, learn why and how things work and you'll know more about how the language works and simple programming tricks and traps to avoid. Mistakes are the best way to learn. If you make a new XML parser, and you luckily get it 100% correct the first time, you won't learn anything. If you make it and spend 2 weeks figuring out the quirks and bugs, you'll know the system inside out. And you'll develop better code in the long run. I went through a rough patch during uni, but now I'm fairly confident in my code. Also another tip is: the simpler the code is, the better. Don't try to do things complicated, you'll run into problems in the long run. Thanks for the reply. I have one question about this advice though. What should I practice on? | ||
toadstool
Australia421 Posts
this is great because you can go to job interviews and show them your project. Do all this in Java or .net Or if you want to challenge yourself, create a basketball game simulation. Make each player read stats from XML documents, so you'll learn XML parsing as well (a very useful skill to have). | ||
catamorphist
United States297 Posts
On October 27 2010 07:33 Triscuit wrote: Hi TL programmers. I'm a third year CS student right now at the University of Texas at Austin. I guess I've come to a realization slowly over the past few semesters. I need help with programming. I don't think I am a *poor* programmer, but I really don't have any confidence in my ability to get larger projects done. I don't think I have the experience necessary to help me easily think about data structures or algorithms in a disciplined way, and I think if I continue down this path, I'll continue to be a sub-par programmer and this will hurt me immensely in the long run. I don't really have issues with languages as much as I have trouble with the abstractions. So, I the questions I ask of you fine programmers are: How do you practice these things? Do you have any references or textbooks that have been of particular value to you? What were things that you learned in the workplace that you wish you had known in school, or even when you were first finding a job? Thanks for your help. You don't need experience to think about data structures and algorithms in a disciplined way, you just need discipline. Don't fool yourself about what you understand; just think about it and put pen on paper until you do. If you couldn't implement it without consulting a reference, you don't fully understand it. (Of course, I'm not saying that everyone can have this level of understanding about many things all the time, but you should understand things once even if they slip partially from your mind later.) In terms of practice, for data structures and algorithms specifically, TopCoder competitions. Generally, open-source. It's not clear to me exactly which abstractions you mean when you cite trouble with abstractions. There are a lot of them. | ||
Ygz
England370 Posts
On October 27 2010 07:33 Triscuit wrote: Do you have any references or textbooks that have been of particular value to you? http://www.amazon.co.uk/Programming-Principles-Practice-Developers-Library/dp/0321543726/ref=sr_1_1?ie=UTF8&s=books&qid=1288267580&sr=8-1 Read this. It doesn't matter if you don't already know C++, he teaches that as you progress. Bjarne uses C++ as his tool to demonstrate and teach how to construct real world code that is correct, simple and efficient. Based on your level of education you should have no problems working through this book, some problems are pretty tough but that's OK, Bjarne is not here to teach you toy code and meaningless concepts. There are 27 chapters broken into 4 parts: Part 1 - The basics. Part 2 - Input/Output Part 3 - Data and Algorithms Part 4 - Broadening the View. Go here for a detailed look at what each part contains. http://www2.research.att.com/~bs/programming_toc.pdf What you'll learn from this, is what you will need in the real world if you intend one day to write non trivial code. Also, a majority of the concepts and practices are to a degree, language agnostic. So you can transfer to another language no problem once you've completed the book. For me it's one of the best technical books I've read, right up there with Code complete and K&R C. | ||
pinke
United States56 Posts
| ||
Deleted_143
Australia256 Posts
| ||
| ||
Sparkling Tuna Cup
Weekly #81
ByuN vs KrystianerLIVE!
SKillous vs Ryung
[ Submit Event ] |
![]() StarCraft 2 StarCraft: Brood War Mong Dota 2![]() Pusan ![]() actioN ![]() firebathero ![]() BeSt ![]() Larva ![]() GuemChi ![]() Last ![]() Mini ![]() Leta ![]() [ Show more ] League of Legends Counter-Strike Super Smash Bros Heroes of the Storm Other Games Organizations StarCraft 2 StarCraft: Brood War StarCraft 2 StarCraft: Brood War
StarCraft 2 • Adnapsc2 StarCraft: Brood War![]() • LUISG ![]() • AfreecaTV YouTube • intothetv ![]() • Kozan • IndyKCrew ![]() • LaughNgamezSOOP • Laughngamez YouTube • Migwel ![]() • sooper7s Dota 2 League of Legends Other Games |
WardiTV Invitational
Spirit vs SHIN
Clem vs SKillous
herO vs TBD
TBD vs GuMiho
AI Arena 2025 Tournament
Replay Cast
Clem vs Zoun
Wardi Open
Monday Night Weeklies
PiGosaur Monday
Replay Cast
SOOP
SKillous vs Spirit
Tenacious Turtle Tussle
The PondCast
[ Show More ] Replay Cast
Korean StarCraft League
[BSL 2025] Weekly
Sparkling Tuna Cup
|
|