• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:09
CEST 08:09
KST 15:09
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Serral wins HomeStory Cup 2914Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
IntoTheTV X SOOP SC2 League : Weekly & Monthly4Clem: "I don't have that much hope in Blizzard"2ZeroSpace Early Access is Now Live!20Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters2Balance hotfix patch 5.0.16b (July 16)89
StarCraft 2
General
How would you feel about frequent/monthly balance patches for SC2? Balance hotfix patch 5.0.16b (July 16) Reynor: GSL Loss Wasn't About Preparation Format Clem: "I don't have that much hope in Blizzard" Weekly Cups (July 13-19): Terran & Protoss rise; Zerg falters
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly INu's Battles#18 - Cure, herO, Rogue & ByuN RSL Revival: Season 6 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2) WardiTV Summer Cup 2026
Strategy
[G] Having the right mentality to improve
Custom Maps
[M] (2) Industrial Park New Map Maker - Looking for Advice - Love or Hate
External Content
Mutation # 535 Assembly of Vengeance The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together
Brood War
General
BW General Discussion How Famous was FlaSh before his Debut? Animated Gateway BGH Auto Balance -> http://bghmmr.eu/ HORROR STARCRAFT MOVIE
Tourneys
Small VOD Thread 2.0 Escore Tournament - Season 3 [Megathread] Daily Proleagues [IPSL] Spring 2026 Grand Finals - This Weekend!
Strategy
Simple Questions, Simple Answers PvT advise for noobs Fighting Spirit mining rates Creating a full chart of Zerg builds
Other Games
General Games
General RTS Discussion Thread Path of Exile ZeroSpace Early Access is Now Live! Nintendo Switch Thread Diablo IV
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread TL Mafia Power Rank NeO.D_StephenKing vs This Guy From 1 Million Dance Vanilla Mini Mafia
Community
General
US Politics Mega-thread Artificial Intelligence Thread Russo-Ukrainian War Thread How to buy a book - shipping from Korea to Europe The Games Industry And ATVI
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread Series you have seen recently... Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion MLB/Baseball 2023 McBoner: A hockey love story
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
Northern Ireland Global Starcraft The Automated Ban List
Blogs
How Games can Help with Majo…
TrAiDoS
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
An Exploration of th…
waywardstrategy
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4610 users

The Big Programming Thread - Page 518

Forum Index > General Forum
Post a Reply
Prev 1 516 517 518 519 520 1032 Next
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.
Millitron
Profile Blog Joined August 2010
United States2611 Posts
September 13 2014 19:52 GMT
#10341
On September 14 2014 04:39 FFGenerations wrote:
yo, thanks for the reply. it can sound different from the titles alone but i spoilered the actual syllabuses which, whilst sometimes say stuff like "learn about ethics of mobile phone application" also say a lot of words that i have never heard in my life lol.

i have written some initial thoughts on each optional unit here:

+ Show Spoiler +

APPLIED COMPUTER GRAPHICS AND VISION

this sounds pretty good. the 1.5hr exam assessment sounds daunting (putting your entire university grade on the line in 1 exam paper sounds pretty dumb to me).....?

DATA WAREHOUSING AND MINING

i done some phpmyadmin and sql in my college course. it sounds like itd be a good module to solidify this but also sounds a bit dull. i should look up the terms used here like Data clustering techniques to see what they actually mean....

this unit is recommended by the letterwriter who said the teacher is helpful and its easy since we've done a lot of it before.

DISTRIBUTED AND MOBILE SYSTEMS

this sounds good and bad. the bad side is ive never had any interest in mobile gaming and still have a £10 phone thats biggest feature is it can store 100 messages and 10 notes.

the other "bad" side is half the coursework is writing about mobile phone ethics and design which is also a dull as shit assignment but i would ace it.

the "good" side is 50% is coursework at developing your own application which sounds brilliant although i might have to buy a phone.

DISTRIBUTED SYSTEMS AND PARALLEL PROGRAMMING

this is core to the Computer Science degree which means its pretty gritty right?

i have absolutely zero fucking clue what any of the words here mean.

on the very very plus side, its all coursework including staged coursework which means you "do and document" which i love doing....

FUZZY LOGIC - THEORY AND APPLICATIONS

no idea what this is... will look it all up

it is also closed book exam which sounds like a big risk.

NEURAL NETWORKS AND GENETIC ALORGITHMS

again no idea what this is all about. sounds hard.

on one hand i seem to enjoy challenging structural problems, on the other hand i have literally 0 math.

exam here too which is a risk.

PROFESSIONAL AND ACADEMIC RESEARCH DEVELOPMENT

ezmode , letterwriter said "everyone got over 70%"

downside: boring and pointless?

WEB RESEARCH

this is core for BSC (HONS) web technologies
it sounds like it is 50% writing crap but 50% probably looking at web technologies which is not that interesting to me
the assessment style looks pretty easy ....



also posted this at my TL blog http://www.teamliquid.net/blogs/466957-software-engineering-university-choices


obviously im going to google these syllabuses a bit since i have no idea, for example, what a fuzzy logic is


ps: i got my vbs macro structure working with the arrays, i put it to a test and it ran for 60 minutes scrolling through the website links while i waited for it to need to go "up" an extra level to see if that functionality continued to work, when after 60 fucking minutes the website in question went down for maintenance

i dont have the IQ to figure out how to "preset" my code to put it into a testmode that doesnt take 60+ minutes.... it has to run down each link until it hits a particular standard stop word and then moves on from there.... i cant give it an "easier" stop word to look for since the stop word is only a certain place on the website.

perhaps i could add a counter variable and say when counter=3 then isStopword=1... yeah that might work....?????!!!

Parallel programming is a fancy way to say multi-threading usually. It could also mean cloud computing, in the sense that Folding@Home uses the term. i.e. using a bunch of complete systems to work simultaneously on one problem.

Distributed systems are computers that do not exist in one physical location. The CPU might be on one machine, the ROM might be somewhere else. The idea is that the resources you commonly take for granted aren't so easy to access.
Who called in the fleet?
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2014-09-13 20:26:42
September 13 2014 20:25 GMT
#10342
thanks for the reply

did you guys pick any of the units ive got as options?

ill look up what all these terms mean so i can give each unit a rating of interest out of 100 in order to narrow them down...

im so fucking tired from staring at code, i can play dota or HS for 10 hours straight and not be this worn out

IM SO FUCKING TIRED but its like i WANT to be awake so i can keep doing this , compared to when i play dota or HS all day i just feel sick of it lol
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
phar
Profile Joined August 2011
United States1080 Posts
September 13 2014 23:23 GMT
#10343
A distributed systems course is almost certainly talking more about folding@home style than multi-threading. Could be very interesting.

Honestly I would advocate picking the classes with the better professor.
Who after all is today speaking about the destruction of the Armenians?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2014-09-14 05:32:45
September 14 2014 05:23 GMT
#10344
None of the classes sound that great in my opinion. Descriptions aren't that helpful (esp. these ones). It's much better to talk to other students who have taken it and ask for their opinions.

I would only consider the first five,

DISTRIBUTED SYSTEMS AND PARALLEL PROGRAMMING
>
APPLIED COMPUTER GRAPHICS AND VISION == FUZZY LOGIC - THEORY AND APPLICATIONS == DISTRIBUTED AND MOBILE SYSTEMS
>
DATA WAREHOUSING AND MINING

in order of what I think sounds least lame and more useful/applicable to CS/SE.

Speak with the academic advisor for the program at the university you're going to. Infinitely better resources than the internet. If not, I would just choose the ones that sound the most interesting to you.
There is no one like you in the universe.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
September 14 2014 06:48 GMT
#10345
On September 14 2014 08:23 phar wrote:
A distributed systems course is almost certainly talking more about folding@home style than multi-threading. Could be very interesting.

Honestly I would advocate picking the classes with the better professor.

How do you know which professor is good?

I tend to pick easier ones now but used to pick by interest.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-09-14 22:26:21
September 14 2014 22:09 GMT
#10346
all my programs are silent prayers to gcc:
take onto you my ungodly syntax, and bring forth the indended semantic.
conspired against by a confederacy of dunces.
bardtown
Profile Joined June 2011
England2313 Posts
September 15 2014 00:20 GMT
#10347
Making my first 'useful' python program - a chat room, basically. Unfortunately when I try to connect to the server (which I'm running in one thread if the user chooses to host a server, with another client thread) it says that the connection is being actively refused. Looking on google, this does not seem to be a problem with the code but perhaps with my router or something similar. Anybody have ideas, or want to try to run the code (which is scruffy and incomplete but should run)? It's run from the command lane, give the extra argument -h to host a server.

+ Show Spoiler +
import sys, socket, threading, select
from time import sleep

killcode = 0

def main (argv):
def serverFlow(): #Server function/loop, to be run as a background thread if -h argument is given
global killcode
servsock = socket.socket( #Create a server socket
socket.AF_INET, socket.SOCK_STREAM)
servsock.bind((socket.gethostname(), 18505))
servsock.listen(5) #Listen for connections, and queue up to 5 connect requests
while True:
c, addr = servsock.accept() #This is blocking... Maybe make a thread out of it? Thread needs to count connections and only accept them while there are less than 8 connections
if killcode == 1:
break
serverThread = threading.Thread(target=serverFlow, args=()) #Define the server thread

def clientFlow(ip = 0): #Client function/loop
global killcode
un = ''
while len(un) > 12 or len(un) < 2: #Get a username of the right length
un = input('Enter desired username (2-12 characters): ')
if serverThread.isAlive() == True: #Check if server is being hosted locally, if so set i.p. to localhost
ip = '127.0.0.1'
print('Connecting to', ip + '...')
sleep(0.1) #Short pause to ensure server has time to start...
clientsock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
try:
clientsock.connect((ip, 18505))
except socket.error:
print('Cannot connect.')
sys.exit()
#connect... if successful go to loop, which sends and receives input. Thread for user input -> send, and another for listening?
while True:
x = input('>') #possible put this in a prompt() function which requests input, deletes the line when entered, then sends said input over the socket.
if x == '/kill':
killcode = 1
break
clientThread = threading.Thread(target=clientFlow, args=()) #Define the client thread. Required if -h argument is given for multithreading with server

exception1 = 'Usage: \'shrike -h\' to host, or \'shrike -c ip\' to connect to a host.'
#Error message for incorrect syntax

"""END OF MAIN DEFINITIONS. BEGIN MAIN EXECUTION"""

if len(sys.argv) < 2:
print(exception1)
sys.exit()

elif sys.argv[1] == '-h':
print('Welcome to Shrike. Creating server and listening for connections...')
serverThread.start() #Start server thread
clientThread.start() #Start client thread running simultaneously

elif sys.argv[1] == '-c' and len(sys.argv)==3: #If the connect argument is given, check the correct number of arguments have been given
ip = sys.argv[2]
try:
socket.inet_aton(ip) #Check if ip is a valid address
except socket.error:
print(exception1, '\n', ip, 'is not a valid IP address.')
sys.exit()
print('Welcome to Shrike.')
clientFlow(ip)

else:
print(exception1)
sys.exit()

"""END OF COMMAND LINE ARGUMENT PARSING"""

main(sys.argv)
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2014-09-15 11:04:36
September 15 2014 11:01 GMT
#10348
On September 15 2014 09:20 bardtown wrote:
Making my first 'useful' python program - a chat room, basically. Unfortunately when I try to connect to the server (which I'm running in one thread if the user chooses to host a server, with another client thread) it says that the connection is being actively refused. Looking on google, this does not seem to be a problem with the code but perhaps with my router or something similar. Anybody have ideas, or want to try to run the code (which is scruffy and incomplete but should run)? It's run from the command lane, give the extra argument -h to host a server.

+ Show Spoiler +
import sys, socket, threading, select
from time import sleep

killcode = 0

def main (argv):
def serverFlow(): #Server function/loop, to be run as a background thread if -h argument is given
global killcode
servsock = socket.socket( #Create a server socket
socket.AF_INET, socket.SOCK_STREAM)
servsock.bind((socket.gethostname(), 18505))
servsock.listen(5) #Listen for connections, and queue up to 5 connect requests
while True:
c, addr = servsock.accept() #This is blocking... Maybe make a thread out of it? Thread needs to count connections and only accept them while there are less than 8 connections
if killcode == 1:
break
serverThread = threading.Thread(target=serverFlow, args=()) #Define the server thread

def clientFlow(ip = 0): #Client function/loop
global killcode
un = ''
while len(un) > 12 or len(un) < 2: #Get a username of the right length
un = input('Enter desired username (2-12 characters): ')
if serverThread.isAlive() == True: #Check if server is being hosted locally, if so set i.p. to localhost
ip = '127.0.0.1'
print('Connecting to', ip + '...')
sleep(0.1) #Short pause to ensure server has time to start...
clientsock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
try:
clientsock.connect((ip, 18505))
except socket.error:
print('Cannot connect.')
sys.exit()
#connect... if successful go to loop, which sends and receives input. Thread for user input -> send, and another for listening?
while True:
x = input('>') #possible put this in a prompt() function which requests input, deletes the line when entered, then sends said input over the socket.
if x == '/kill':
killcode = 1
break
clientThread = threading.Thread(target=clientFlow, args=()) #Define the client thread. Required if -h argument is given for multithreading with server

exception1 = 'Usage: \'shrike -h\' to host, or \'shrike -c ip\' to connect to a host.'
#Error message for incorrect syntax

"""END OF MAIN DEFINITIONS. BEGIN MAIN EXECUTION"""

if len(sys.argv) < 2:
print(exception1)
sys.exit()

elif sys.argv[1] == '-h':
print('Welcome to Shrike. Creating server and listening for connections...')
serverThread.start() #Start server thread
clientThread.start() #Start client thread running simultaneously

elif sys.argv[1] == '-c' and len(sys.argv)==3: #If the connect argument is given, check the correct number of arguments have been given
ip = sys.argv[2]
try:
socket.inet_aton(ip) #Check if ip is a valid address
except socket.error:
print(exception1, '\n', ip, 'is not a valid IP address.')
sys.exit()
print('Welcome to Shrike.')
clientFlow(ip)

else:
print(exception1)
sys.exit()

"""END OF COMMAND LINE ARGUMENT PARSING"""

main(sys.argv)


So soon to be starting with the "there is nothing wrong with the code". You'll make a great dev.

There is nothing wrong with your router if you are trying to stay entirely local on your machine, which it looks like you are because you are trying to connect to 127.0.0.1.

The problem is that in the server thread you are binding to the client hostname, not 127.0.0.1 . So, you can choose to bind to 127.0.0.1, and your example would work.. but then you wouldn't be accepting anywhere other than on 127.0.01. So, bind to "0.0.0.0". Disclaimer: I'm not a networking expert, I don't know if there are dangers to do doing so in a real production environment. However, I know that it works.

Also, as unsolicited advice, you should look into argparse with python. It will make life easier as you keep writing more scripts.
Manit0u
Profile Blog Joined August 2004
Poland17799 Posts
Last Edited: 2014-09-15 11:33:57
September 15 2014 11:19 GMT
#10349
On September 15 2014 09:20 bardtown wrote:
Making my first 'useful' python program - a chat room, basically. Unfortunately when I try to connect to the server (which I'm running in one thread if the user chooses to host a server, with another client thread) it says that the connection is being actively refused. Looking on google, this does not seem to be a problem with the code but perhaps with my router or something similar. Anybody have ideas, or want to try to run the code (which is scruffy and incomplete but should run)? It's run from the command lane, give the extra argument -h to host a server.

+ Show Spoiler +
import sys, socket, threading, select
from time import sleep

killcode = 0

def main (argv):
def serverFlow(): #Server function/loop, to be run as a background thread if -h argument is given
global killcode
servsock = socket.socket( #Create a server socket
socket.AF_INET, socket.SOCK_STREAM)
servsock.bind((socket.gethostname(), 18505))
servsock.listen(5) #Listen for connections, and queue up to 5 connect requests
while True:
c, addr = servsock.accept() #This is blocking... Maybe make a thread out of it? Thread needs to count connections and only accept them while there are less than 8 connections
if killcode == 1:
break
serverThread = threading.Thread(target=serverFlow, args=()) #Define the server thread

def clientFlow(ip = 0): #Client function/loop
global killcode
un = ''
while len(un) > 12 or len(un) < 2: #Get a username of the right length
un = input('Enter desired username (2-12 characters): ')
if serverThread.isAlive() == True: #Check if server is being hosted locally, if so set i.p. to localhost
ip = '127.0.0.1'
print('Connecting to', ip + '...')
sleep(0.1) #Short pause to ensure server has time to start...
clientsock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
try:
clientsock.connect((ip, 18505))
except socket.error:
print('Cannot connect.')
sys.exit()
#connect... if successful go to loop, which sends and receives input. Thread for user input -> send, and another for listening?
while True:
x = input('>') #possible put this in a prompt() function which requests input, deletes the line when entered, then sends said input over the socket.
if x == '/kill':
killcode = 1
break
clientThread = threading.Thread(target=clientFlow, args=()) #Define the client thread. Required if -h argument is given for multithreading with server

exception1 = 'Usage: \'shrike -h\' to host, or \'shrike -c ip\' to connect to a host.'
#Error message for incorrect syntax

"""END OF MAIN DEFINITIONS. BEGIN MAIN EXECUTION"""

if len(sys.argv) < 2:
print(exception1)
sys.exit()

elif sys.argv[1] == '-h':
print('Welcome to Shrike. Creating server and listening for connections...')
serverThread.start() #Start server thread
clientThread.start() #Start client thread running simultaneously

elif sys.argv[1] == '-c' and len(sys.argv)==3: #If the connect argument is given, check the correct number of arguments have been given
ip = sys.argv[2]
try:
socket.inet_aton(ip) #Check if ip is a valid address
except socket.error:
print(exception1, '\n', ip, 'is not a valid IP address.')
sys.exit()
print('Welcome to Shrike.')
clientFlow(ip)

else:
print(exception1)
sys.exit()

"""END OF COMMAND LINE ARGUMENT PARSING"""

main(sys.argv)


Not related to your problem, but something you might consider nonetheless: You might want to allow users to specify arguments in different order than just the one hard-set by yourself. Most Linux users are pretty accustomed to mixing their command arguments as they please.


if '-c' in sys.argv
ip_idx = sys.argv.index('-c') + 1

try:
ip = sys.argv[ip_idx]
except socket.error:
print(exception1, '\n', 'wrong argument at position', ip_idx)
sys.exit()


It's way more flexible this way since you can add/remove arguments from your program without having to worry about them being bound to specific order. You also don't run the risk of errors on trying to access non-existent indexes in the array.
Time is precious. Waste it wisely.
berated-
Profile Blog Joined February 2007
United States1134 Posts
September 15 2014 11:33 GMT
#10350
On September 15 2014 20:19 Manit0u wrote:
Show nested quote +
On September 15 2014 09:20 bardtown wrote:
Making my first 'useful' python program - a chat room, basically. Unfortunately when I try to connect to the server (which I'm running in one thread if the user chooses to host a server, with another client thread) it says that the connection is being actively refused. Looking on google, this does not seem to be a problem with the code but perhaps with my router or something similar. Anybody have ideas, or want to try to run the code (which is scruffy and incomplete but should run)? It's run from the command lane, give the extra argument -h to host a server.

+ Show Spoiler +
import sys, socket, threading, select
from time import sleep

killcode = 0

def main (argv):
def serverFlow(): #Server function/loop, to be run as a background thread if -h argument is given
global killcode
servsock = socket.socket( #Create a server socket
socket.AF_INET, socket.SOCK_STREAM)
servsock.bind((socket.gethostname(), 18505))
servsock.listen(5) #Listen for connections, and queue up to 5 connect requests
while True:
c, addr = servsock.accept() #This is blocking... Maybe make a thread out of it? Thread needs to count connections and only accept them while there are less than 8 connections
if killcode == 1:
break
serverThread = threading.Thread(target=serverFlow, args=()) #Define the server thread

def clientFlow(ip = 0): #Client function/loop
global killcode
un = ''
while len(un) > 12 or len(un) < 2: #Get a username of the right length
un = input('Enter desired username (2-12 characters): ')
if serverThread.isAlive() == True: #Check if server is being hosted locally, if so set i.p. to localhost
ip = '127.0.0.1'
print('Connecting to', ip + '...')
sleep(0.1) #Short pause to ensure server has time to start...
clientsock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
try:
clientsock.connect((ip, 18505))
except socket.error:
print('Cannot connect.')
sys.exit()
#connect... if successful go to loop, which sends and receives input. Thread for user input -> send, and another for listening?
while True:
x = input('>') #possible put this in a prompt() function which requests input, deletes the line when entered, then sends said input over the socket.
if x == '/kill':
killcode = 1
break
clientThread = threading.Thread(target=clientFlow, args=()) #Define the client thread. Required if -h argument is given for multithreading with server

exception1 = 'Usage: \'shrike -h\' to host, or \'shrike -c ip\' to connect to a host.'
#Error message for incorrect syntax

"""END OF MAIN DEFINITIONS. BEGIN MAIN EXECUTION"""

if len(sys.argv) < 2:
print(exception1)
sys.exit()

elif sys.argv[1] == '-h':
print('Welcome to Shrike. Creating server and listening for connections...')
serverThread.start() #Start server thread
clientThread.start() #Start client thread running simultaneously

elif sys.argv[1] == '-c' and len(sys.argv)==3: #If the connect argument is given, check the correct number of arguments have been given
ip = sys.argv[2]
try:
socket.inet_aton(ip) #Check if ip is a valid address
except socket.error:
print(exception1, '\n', ip, 'is not a valid IP address.')
sys.exit()
print('Welcome to Shrike.')
clientFlow(ip)

else:
print(exception1)
sys.exit()

"""END OF COMMAND LINE ARGUMENT PARSING"""

main(sys.argv)


Not related to your problem, but something you might consider nonetheless: You might want to allow users to specify arguments in different order than just the one hard-set by yourself. Most Linux users are pretty accustomed to mixing their command arguments as they please.


if '-c' in sys.argv
ip_idx = sys.argv.index('-c') + 1

try:
ip = sys.argv[ip_idx]
except socket.error:
print(exception1, '\n', 'no valid IP address given.')
sys.exit()


It's way more flexible this way since you can add/remove arguments from your program without having to worry about them being bound to specific order. You also don't run the risk of errors on trying to access non-existent indexes in the array.


That's why I suggested argparse. Only thing better than being flexible is not writing it yourself!
Millitron
Profile Blog Joined August 2010
United States2611 Posts
September 15 2014 16:00 GMT
#10351
On September 14 2014 05:25 FFGenerations wrote:
thanks for the reply

did you guys pick any of the units ive got as options?

ill look up what all these terms mean so i can give each unit a rating of interest out of 100 in order to narrow them down...

im so fucking tired from staring at code, i can play dota or HS for 10 hours straight and not be this worn out

IM SO FUCKING TIRED but its like i WANT to be awake so i can keep doing this , compared to when i play dota or HS all day i just feel sick of it lol


Neural networks and fuzzy logic sound the most interesting to me. When you say you have 0 math, you should still be ok as long as your formal logic skills are up to par. CS doesn't really use calculus or things like that much, at least in my experience.
Who called in the fleet?
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2014-09-15 16:02:12
September 15 2014 16:01 GMT
#10352
On September 14 2014 15:48 obesechicken13 wrote:
Show nested quote +
On September 14 2014 08:23 phar wrote:
A distributed systems course is almost certainly talking more about folding@home style than multi-threading. Could be very interesting.

Honestly I would advocate picking the classes with the better professor.

How do you know which professor is good?

I tend to pick easier ones now but used to pick by interest.

Ask around. It is typically very obvious to past students whether or not the professor is actually good at teaching undergrads and is enthusiastic, or is just doing it because they are forced to, and really would prefer to get back to their phd students.

Occasionally you can find out info on some website, but just asking people should suffice.
Who after all is today speaking about the destruction of the Armenians?
bardtown
Profile Joined June 2011
England2313 Posts
September 15 2014 17:19 GMT
#10353
On September 15 2014 20:01 berated- wrote:
Show nested quote +
On September 15 2014 09:20 bardtown wrote:
Making my first 'useful' python program - a chat room, basically. Unfortunately when I try to connect to the server (which I'm running in one thread if the user chooses to host a server, with another client thread) it says that the connection is being actively refused. Looking on google, this does not seem to be a problem with the code but perhaps with my router or something similar. Anybody have ideas, or want to try to run the code (which is scruffy and incomplete but should run)? It's run from the command lane, give the extra argument -h to host a server.

+ Show Spoiler +
import sys, socket, threading, select
from time import sleep

killcode = 0

def main (argv):
def serverFlow(): #Server function/loop, to be run as a background thread if -h argument is given
global killcode
servsock = socket.socket( #Create a server socket
socket.AF_INET, socket.SOCK_STREAM)
servsock.bind((socket.gethostname(), 18505))
servsock.listen(5) #Listen for connections, and queue up to 5 connect requests
while True:
c, addr = servsock.accept() #This is blocking... Maybe make a thread out of it? Thread needs to count connections and only accept them while there are less than 8 connections
if killcode == 1:
break
serverThread = threading.Thread(target=serverFlow, args=()) #Define the server thread

def clientFlow(ip = 0): #Client function/loop
global killcode
un = ''
while len(un) > 12 or len(un) < 2: #Get a username of the right length
un = input('Enter desired username (2-12 characters): ')
if serverThread.isAlive() == True: #Check if server is being hosted locally, if so set i.p. to localhost
ip = '127.0.0.1'
print('Connecting to', ip + '...')
sleep(0.1) #Short pause to ensure server has time to start...
clientsock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
try:
clientsock.connect((ip, 18505))
except socket.error:
print('Cannot connect.')
sys.exit()
#connect... if successful go to loop, which sends and receives input. Thread for user input -> send, and another for listening?
while True:
x = input('>') #possible put this in a prompt() function which requests input, deletes the line when entered, then sends said input over the socket.
if x == '/kill':
killcode = 1
break
clientThread = threading.Thread(target=clientFlow, args=()) #Define the client thread. Required if -h argument is given for multithreading with server

exception1 = 'Usage: \'shrike -h\' to host, or \'shrike -c ip\' to connect to a host.'
#Error message for incorrect syntax

"""END OF MAIN DEFINITIONS. BEGIN MAIN EXECUTION"""

if len(sys.argv) < 2:
print(exception1)
sys.exit()

elif sys.argv[1] == '-h':
print('Welcome to Shrike. Creating server and listening for connections...')
serverThread.start() #Start server thread
clientThread.start() #Start client thread running simultaneously

elif sys.argv[1] == '-c' and len(sys.argv)==3: #If the connect argument is given, check the correct number of arguments have been given
ip = sys.argv[2]
try:
socket.inet_aton(ip) #Check if ip is a valid address
except socket.error:
print(exception1, '\n', ip, 'is not a valid IP address.')
sys.exit()
print('Welcome to Shrike.')
clientFlow(ip)

else:
print(exception1)
sys.exit()

"""END OF COMMAND LINE ARGUMENT PARSING"""

main(sys.argv)


So soon to be starting with the "there is nothing wrong with the code". You'll make a great dev.

There is nothing wrong with your router if you are trying to stay entirely local on your machine, which it looks like you are because you are trying to connect to 127.0.0.1.

The problem is that in the server thread you are binding to the client hostname, not 127.0.0.1 . So, you can choose to bind to 127.0.0.1, and your example would work.. but then you wouldn't be accepting anywhere other than on 127.0.01. So, bind to "0.0.0.0". Disclaimer: I'm not a networking expert, I don't know if there are dangers to do doing so in a real production environment. However, I know that it works.

Also, as unsolicited advice, you should look into argparse with python. It will make life easier as you keep writing more scripts.


I was too quick to take the word of some answers on stackoverflow, that's true. I have learnt my lesson. I'm guessing at this point that binding to the hostname is only functional on LAN? It didn't occur to me that it could be binding to the PC without binding to an IP address.

Thanks very much, anyway. It feels good to be able to continue with this project.

Thankyou Manit0u, for your advice. I think that is a more elegant way of handling the arguments and I've made a note of it. For this project I'll leave it as it is, so that I can review my patchwork problem solving in future.
Ben...
Profile Joined January 2011
Canada3485 Posts
September 15 2014 17:46 GMT
#10354
On September 16 2014 01:01 phar wrote:
Show nested quote +
On September 14 2014 15:48 obesechicken13 wrote:
On September 14 2014 08:23 phar wrote:
A distributed systems course is almost certainly talking more about folding@home style than multi-threading. Could be very interesting.

Honestly I would advocate picking the classes with the better professor.

How do you know which professor is good?

I tend to pick easier ones now but used to pick by interest.

Ask around. It is typically very obvious to past students whether or not the professor is actually good at teaching undergrads and is enthusiastic, or is just doing it because they are forced to, and really would prefer to get back to their phd students.

Occasionally you can find out info on some website, but just asking people should suffice.

Yup, this is exactly what to do. I chose my image processing/computer vision class specifically because I had the prof that teaches it already and he was amazing. It turns out I really like this type of stuff but I subject matter didn't really matter to me, I just wanted a final year class from a known quantity in terms of professor quality. I can survive basically any subject matter, but if a prof is bad, chances are I will do much worse in the class. Likewise, I have two profs next term that I chose because people said they were amazingly good profs and gave reasonable assignments. Sadly, bad profs are sometimes unavoidable though.
Unfortunately for me, I have two mandatory/semi-mandatory classes (as in, you need this class to do any of the classes I want to do next term. And in turn, if you want to graduate this year) and they both are taught by among the worst professors in the CS department. I swear they save all the awful professors for the last year, because it certainly seems that way. I only have one good prof this term. It's like "if you want this degree, you'll have to make it through this absolute nonsense".
"Cliiiiiiiiiiiiiiiiide" -Tastosis
doyougmailbro
Profile Joined September 2014
8 Posts
Last Edited: 2014-09-15 17:54:35
September 15 2014 17:53 GMT
#10355
I wouldn't brag about the 3-4 year of university education if I were you. Most excellent programmers were self-taught. You do sound lazy and incompetent and I find it funny how you throw your "university education" around like people would respect you more. The fact is that you don't do anything outside of class and you didn't learn any real application in computer science and just going from class to class without much thought. I would rather hire someone with real practical experience than anyone who hasn't done anything practical. Your university education doesn't indicate any level of competence but merely a ticket for me to look at your resume once to determine your capability and most likely as an employer I would test you on specific concepts to see if you actually know anything.

Ben...
Profile Joined January 2011
Canada3485 Posts
September 15 2014 20:55 GMT
#10356
On September 16 2014 02:53 doyougmailbro wrote:
I wouldn't brag about the 3-4 year of university education if I were you. Most excellent programmers were self-taught. You do sound lazy and incompetent and I find it funny how you throw your "university education" around like people would respect you more. The fact is that you don't do anything outside of class and you didn't learn any real application in computer science and just going from class to class without much thought. I would rather hire someone with real practical experience than anyone who hasn't done anything practical. Your university education doesn't indicate any level of competence but merely a ticket for me to look at your resume once to determine your capability and most likely as an employer I would test you on specific concepts to see if you actually know anything.


Why are you trying to start a fights (I saw you do the same thing in another thread too)? It's incredibly obvious. I wasn't throwing my education around in any way. I was discussing choosing university CS courses with other people who are talking about the same thing and in the same situation I am (if they are talking about computer vision courses and things like that, they are probably in the same year I am in, or maybe a year below. Computer Vision/Image Processing is often a senior year course). How dare we discuss CS and programming related stuff in a thread about CS and programming. Choosing courses and professors is an important thing because it can have a huge impact on one's education. If you don't respect university degrees, then that's your prerogative, but that doesn't mean that it is okay for you to be rude and disrespectful to others because of it. There was no need for you to rudely cut into this conversation when you have nothing of worth to contribute except talk down to everyone else involved.

No need to be a jerk. Trying to be all condescending and edgy like this just makes you come off as an unpleasant person trying too hard to make yourself feel/look superior to other people when it's obvious you probably aren't. Most people can see through that shtick fairly easily. You won't make many friends with this level of negativity and this type of attitude. Every single one of your posts so far has been confrontational and condescending like this, and it seems unlikely you will last any significant length of time on TL if your posting stays like this.

And that is all I will say with regards to this. I'll just ignore the personal attacks against my abilities (even though this person obviously knows absolutely nothing of them and is going purely upon poorly crafted assumptions which are almost all incorrect). There's no point addressing them. I'll just let angry people be angry.
"Cliiiiiiiiiiiiiiiiide" -Tastosis
FFGenerations
Profile Blog Joined April 2011
7088 Posts
September 15 2014 21:09 GMT
#10357
what i thought he was talking about me to which i thought "fair enough" LOL
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
ZenithM
Profile Joined February 2011
France15952 Posts
September 15 2014 21:54 GMT
#10358
On September 16 2014 02:53 doyougmailbro wrote:
I wouldn't brag about the 3-4 year of university education if I were you. Most excellent programmers were self-taught. You do sound lazy and incompetent and I find it funny how you throw your "university education" around like people would respect you more. The fact is that you don't do anything outside of class and you didn't learn any real application in computer science and just going from class to class without much thought. I would rather hire someone with real practical experience than anyone who hasn't done anything practical. Your university education doesn't indicate any level of competence but merely a ticket for me to look at your resume once to determine your capability and most likely as an employer I would test you on specific concepts to see if you actually know anything.


Someone sounds bitter.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2014-09-15 22:44:04
September 15 2014 22:43 GMT
#10359
Yo, i blogged an update after today. will post it here for you. cheers for your replies, really helped

quick update, spoke to course coord today and he suggested that 1) i avoid certain modules 2) i definitely take a module 3) i need to learn math before i start the 2nd half of one of the core modules 4) if i find out when module lectures are i can attend some to sample a module 5) although i have to submit my module choices tomorrow i can still change them up to 12 days later

he suggested professional dev module is compulsory , which really is fine by me after considering that i want an easy ride in order to focus on personal projects. (i didnt mention it before but we have a 40 credit core module of personal project. i probably should have mentioned it).

[-] data mining is pretty dry and i done a fair bit of database stuff in college and i dont exactly fall head over heels to do more

[-] computer graphics sounds great but it does sound like something you'd do alongside or following a less specific unit... eg combo mobile graphics with mobile dev unit. it is also half exam

[+] professioanl dev. was basically told to take this if i am direct entry student. probably because its the mega easy one. im fine with this. especially hearing some of your opinions that spending time on personal unique projects is more valuable than having done a class on something specific like fuzzy logic or even more database crap which you can learn on the job.

[-] web research. similar to data mining, i dont find web tech that interesting and i basically have 1 choice to make here

[-] fuzzy logic, genetic alg or parallel prog. quite specific subjects, which brings me to....

[+] distributed systems + mobile systems. yeah this is 2 separate units, first half you look at stuff like cloud tech, which is useful to know about. 2nd half you build a mobile application, which is great imo. no exam assessment.



SO WHAT WILL MY WEEKS CONSIST OF?

1) Advanced software engineering - models, design and management. assessment: 15 minute presentation on subject matter (40%) and 2 hour writing exam (60%).

2) Reliable and secure systems - various including network security, xacml, formal modelling. 100% staggered coursework.

3) Distributed systems, mobile systems. Cloud/etc technology coursework 50%. Mobile ap coursework 50%.

4) Professional development. 100% written coursework

5) Personal project & report (assessment highly weighted on report).

6) Math (i think i start with matrices, matrix multiplication, and then move onto this module content + Show Spoiler +
1 Sets (describing sets by properties, operations on sets, subsets, power sets, counting finite sets, the Cartesian product of sets), binary relations (equivalence). Functions (basic terminology, composition of functions, inverse functions, recursive functions, partial and total functions).
2 Basic proof techniques (the concept of proofs, mathematical induction, proof by contradiction). Logic (truth tables, introduction to propositional calculus, predicate logic, quantifiers, formal reasoning, logical equivalences, formalising sentences).
3 Introduction to functional programming. How functional programming differs from imperative programming.
4 Basic functional concepts and data types. Functions, guards, pattern matching. Recursive functions. Lists and list processing using recursion.
5 Foundations of functional programming: the lambda calculus. Reasoning about functional programs. Proving properties and correctness of programs using induction.
6 Higher order functions. Function composition, Currying and partial application. Lambda expressions. Processing lists with higher order functions. Lazy evaluation.
7 Input-Output for functional programs: providing user interfaces.
8 Introduction to graph theory (notation and representation of graphs, adjacency matrices). Basic properties of graphs (e.g. connectivity, edge and vertex cuts, Euler theorem) and connections with practical problems.
9 Various kinds of graphs (e.g. trees, bipartite graphs, complete graphs, directed graphs), their properties and applications.
10 Fundamental graph algorithms (e.g. For finding an Eulerian circuit, for solving the minimum spanning tree problem). Application of graph algorithms to practical problems. Using digraphs for solving networks problems (e.g. the maximum flow problem).


7) Gym

8) Join an RPG
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
September 15 2014 23:08 GMT
#10360
On September 15 2014 07:09 nunez wrote:
all my programs are silent prayers to gcc:
take onto you my ungodly syntax, and bring forth the indended semantic.


Compilers are one-file-in-one-file-out programs, how hard could they be? Linkers are the true deity.

+ Show Spoiler +

Our Linker in binary,
+x be thy permissions.
Your ELF, COFF, and PE come,
your allocation be done,
on our binary as it is in yours.
Give us libraries for our executable,
and forgive us our bugs,
as we have forgiven our compiler.
And lead us not into warnings,
but deliver us from errors.
Amen

Take unto Thee, this list of blessed libraries, modules, and symbol tables. Let it be to Your eternal satisfaction that all instances of symbols are singularly defined, and that no COMMONS exist. Amen.
Any sufficiently advanced technology is indistinguishable from magic
Prev 1 516 517 518 519 520 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 3h 51m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 148
StarCraft: Brood War
GuemChi 4092
BeSt 831
Leta 113
Bale 79
ZergMaN 48
Mind 42
Noble 20
Icarus 15
Dota 2
NeuroSwarm186
Counter-Strike
summit1g7283
Sick137
Other Games
WinterStarcraft537
C9.Mang0353
RuFF_SC268
Trikslyr17
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH327
• practicex 21
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2102
League of Legends
• Rush1741
Other Games
• Scarra1070
Upcoming Events
Escore
3h 51m
CrankTV Team League
4h 51m
WardiTV Summer Champion…
5h 51m
Big Brain Bouts
9h 51m
Soulspirit vs goblin
TriGGeR vs Bunny
OSC
15h 51m
Korean StarCraft League
20h 51m
Afreeca Starleague
21h 51m
RSL Revival
1d 2h
Serral vs SHIN
herO vs Solar
Online Event
1d 8h
Replay Cast
1d 17h
[ Show More ]
RSL Revival
2 days
Clem vs ByuN
Rogue vs Lambo
OSC
2 days
WardiTV Weekly
3 days
Sparkling Tuna Cup
4 days
INu's Battles
4 days
Cure vs herO
ByuN vs Rogue
PiGosaur Cup
4 days
The PondCast
5 days
Kung Fu Cup
5 days
Patches Events
5 days
Replay Cast
6 days
CrankTV Team League
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-07-22
HSC XXIX
Eternal Conflict S2 E3

Ongoing

CSL 2026 Summer (S21)
KCM Race Survival 2026 Season 3
Escore Tournament S3: W4
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026

Upcoming

ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
ASL Season 22: Qualifier #1
ASL Season 22: Qualifier #2
CSLAN 4
ASL Season 22
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.