• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:24
CET 08:24
KST 16:24
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
StarCraft Evolution League (SC Evo Biweekly) RSL Offline Finals Info - Dec 13 and 14! RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread ZeroSpace Megathread Nintendo Switch Thread The Perfect Game Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1755 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
Poland17496 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
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 138
-ZergGirl 62
StarCraft: Brood War
Stork 958
Tasteless 232
Sacsri 102
Shine 56
Bale 33
ZergMaN 23
Dewaltoss 2
Dota 2
febbydoto258
NeuroSwarm140
canceldota8
League of Legends
JimRising 605
Reynor8
Other Games
summit1g11098
WinterStarcraft563
C9.Mang0251
crisheroes202
RuFF_SC287
Mew2King43
Organizations
Other Games
gamesdonequick672
StarCraft: Brood War
UltimateBattle 7
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH178
• practicex 37
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1192
Upcoming Events
The PondCast
2h 36m
OSC
8h 36m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
16h 36m
Korean StarCraft League
1d 19h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.