• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 12:19
CET 18:19
KST 02:19
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
ComeBackTV's documentary on Byun's Career !3Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win2Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15
StarCraft 2
General
ComeBackTV's documentary on Byun's Career ! Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win Did they add GM to 2v2? RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump
Tourneys
Master Swan Open (Global Bronze-Master 2) Winter Warp Gate Amateur Showdown #1: Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship StarCraft2.fi 15th Anniversary Cup
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress
Brood War
General
How Rain Became ProGamer in Just 3 Months FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [BSL21] RO8 Bracket & Prediction Contest BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO8 - Day 2 - Sunday 21:00 CET [ASL20] Grand Finals [BSL21] RO8 - Day 1 - Saturday 21:00 CET
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta Fighting Spirit mining rates
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread PC Games Sales Thread
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 Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread European Politico-economics QA Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1665 users

The Big Programming Thread - Page 657

Forum Index > General Forum
Post a Reply
Prev 1 655 656 657 658 659 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.
Ropid
Profile Joined March 2009
Germany3557 Posts
Last Edited: 2015-08-09 17:19:37
August 09 2015 16:49 GMT
#13121
On August 09 2015 22:56 Sufficiency wrote:
Suppose there is an existing program that runs on the command line and gives one line of output every second. I want to write a Python script which intercepts the output from the first program line by line, analyze/modify it, then output something slightly different. How should I approach this problem? I only need this to work on Linux.

You write a program that reads from standard input and writes to standard output. You then use your shell to pipe the output from the first program into the input of your program.

EDIT:

I was wondering what you were doing with xargs, and I think I now get it: you want to run your program for each line of output from the first program. Your program expects its input on the command line.

You can make bash take the first program's output and split it into lines and run your program with each of those lines as parameters like this:

while read foo; do yourPythonProgram $foo; done < <( firstprogram )
"My goal is to replace my soul with coffee and become immortal."
Sufficiency
Profile Blog Joined October 2010
Canada23833 Posts
August 09 2015 19:35 GMT
#13122
On August 10 2015 01:49 Ropid wrote:
Show nested quote +
On August 09 2015 22:56 Sufficiency wrote:
Suppose there is an existing program that runs on the command line and gives one line of output every second. I want to write a Python script which intercepts the output from the first program line by line, analyze/modify it, then output something slightly different. How should I approach this problem? I only need this to work on Linux.

You write a program that reads from standard input and writes to standard output. You then use your shell to pipe the output from the first program into the input of your program.

EDIT:

I was wondering what you were doing with xargs, and I think I now get it: you want to run your program for each line of output from the first program. Your program expects its input on the command line.

You can make bash take the first program's output and split it into lines and run your program with each of those lines as parameters like this:

while read foo; do yourPythonProgram $foo; done < <( firstprogram )


Yes that's my current plan. Not sure if it is the way to go.
https://twitter.com/SufficientStats
Ropid
Profile Joined March 2009
Germany3557 Posts
August 09 2015 20:10 GMT
#13123
On August 10 2015 04:35 Sufficiency wrote:
Show nested quote +
On August 10 2015 01:49 Ropid wrote:
On August 09 2015 22:56 Sufficiency wrote:
Suppose there is an existing program that runs on the command line and gives one line of output every second. I want to write a Python script which intercepts the output from the first program line by line, analyze/modify it, then output something slightly different. How should I approach this problem? I only need this to work on Linux.

You write a program that reads from standard input and writes to standard output. You then use your shell to pipe the output from the first program into the input of your program.

EDIT:

I was wondering what you were doing with xargs, and I think I now get it: you want to run your program for each line of output from the first program. Your program expects its input on the command line.

You can make bash take the first program's output and split it into lines and run your program with each of those lines as parameters like this:

while read foo; do yourPythonProgram $foo; done < <( firstprogram )


Yes that's my current plan. Not sure if it is the way to go.

Write it the traditional way where it reads from stdin and writes to stdout. Using it is then "firstprogram | yourprogram". That type of program, you can still use for single lines if you ever want and need to, so it has no downsides.

In practice, you write a program that reads from a file, line by line, prints to the terminal after each line is read, and it all continues until the end of the file is hit. There's nothing special you have to do compared to working with a normal file.
"My goal is to replace my soul with coffee and become immortal."
Manit0u
Profile Blog Joined August 2004
Poland17532 Posts
August 09 2015 21:27 GMT
#13124
Didn't I already provide an answer to that problem on the previous page?

You could simply approach this problem from a different direction. Use os.popen to launch your existing program inside of the python script. Your script then has access to all input, output and errors of the program and you can handle that however you like. The best thing is that you're not doubling-up on output since all the end user gets is the output of your script.

Instead of doing stuff like using linux pipes and xargs to execute the program and then your script you simply launch your script (which will launch the program for you and parse its output). Much less hassle, reduced complexity and everything is way more contained.

Here's the link again: https://docs.python.org/2/library/subprocess.html
Time is precious. Waste it wisely.
Sufficiency
Profile Blog Joined October 2010
Canada23833 Posts
August 10 2015 02:24 GMT
#13125
On August 10 2015 06:27 Manit0u wrote:
Didn't I already provide an answer to that problem on the previous page?

You could simply approach this problem from a different direction. Use os.popen to launch your existing program inside of the python script. Your script then has access to all input, output and errors of the program and you can handle that however you like. The best thing is that you're not doubling-up on output since all the end user gets is the output of your script.

Instead of doing stuff like using linux pipes and xargs to execute the program and then your script you simply launch your script (which will launch the program for you and parse its output). Much less hassle, reduced complexity and everything is way more contained.

Here's the link again: https://docs.python.org/2/library/subprocess.html


To be honest I was looking at that link from the previous page but I wasn't 100% sure what that would achieve. Thank you for elaborating on it.
https://twitter.com/SufficientStats
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
August 10 2015 06:04 GMT
#13126
@Manit0u thanks, I was doing something like the first example for my views (passing a $data array containing my data and then looping through and echoing the contents with HTML mixed in as necessary).
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
Manit0u
Profile Blog Joined August 2004
Poland17532 Posts
Last Edited: 2015-08-10 10:11:12
August 10 2015 09:03 GMT
#13127
On August 10 2015 11:24 Sufficiency wrote:
Show nested quote +
On August 10 2015 06:27 Manit0u wrote:
Didn't I already provide an answer to that problem on the previous page?

You could simply approach this problem from a different direction. Use os.popen to launch your existing program inside of the python script. Your script then has access to all input, output and errors of the program and you can handle that however you like. The best thing is that you're not doubling-up on output since all the end user gets is the output of your script.

Instead of doing stuff like using linux pipes and xargs to execute the program and then your script you simply launch your script (which will launch the program for you and parse its output). Much less hassle, reduced complexity and everything is way more contained.

Here's the link again: https://docs.python.org/2/library/subprocess.html


To be honest I was looking at that link from the previous page but I wasn't 100% sure what that would achieve. Thank you for elaborating on it.


No problem. Hope that's of any help to you.

On August 10 2015 15:04 Birdie wrote:
@Manit0u thanks, I was doing something like the first example for my views (passing a $data array containing my data and then looping through and echoing the contents with HTML mixed in as necessary).


Well, as long as you don't construct HTML in the controller it's all fine.
Time is precious. Waste it wisely.
Sufficiency
Profile Blog Joined October 2010
Canada23833 Posts
August 10 2015 19:47 GMT
#13128
It works really well!
https://twitter.com/SufficientStats
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2015-08-13 22:10:44
August 13 2015 22:03 GMT
#13129
I have almost one year work experience as a software engineer, and because I'm still young, I'm wondering if I should go for a masters degree at some point. By the time I save up enough for masters study in the UK (I already have BSc in the UK), I'll have had about 3 years work experience, so is it worth it then? My family values higher education, and if I go for masters, I'll do it only because of 1) higher salary/better CV and 2) prestige, but the 1st is more important for me. I don't like theoretical thesis though.

Edit: I'm using C#, C++, WCF and WPF if it matters. I also know Java.
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
Last Edited: 2015-08-14 00:34:29
August 14 2015 00:31 GMT
#13130
did you check job offers in your area?

In germany noone seeks to give a damn as long as its some form of post highschool degree, i have seen like 2 offers that were restricted to a Masters.
99% of the offers required a bachelors and didnt even differentiate between the more academic universities and the slightly less academic "Fachhochschulen", who are a bit more focused on practical things.
Zocat
Profile Joined April 2010
Germany2229 Posts
August 14 2015 07:44 GMT
#13131
I honestly depends on what you want to do. If you are happy with jobs like your current one you won't need it. A few jobs will require a higher degree, but we don't know where your interests lie. As LaNague wrote - look at various job offers.

Can you do your degree part-time? It's what I did - my 2 years master could take as long as 4 years (I needed 3, since I didn't do a normal 50:50 split).
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
August 14 2015 21:28 GMT
#13132
On August 14 2015 16:44 Zocat wrote:
I honestly depends on what you want to do. If you are happy with jobs like your current one you won't need it. A few jobs will require a higher degree, but we don't know where your interests lie. As LaNague wrote - look at various job offers.

Can you do your degree part-time? It's what I did - my 2 years master could take as long as 4 years (I needed 3, since I didn't do a normal 50:50 split).


Well, as long as I work with C#/C++ and OOP in general, I'm happy. Software engineering is definitely my preferred area, and I'd not trade it for more science. So the question is: does masters degree increase salary a lot or is it just a CV requirement for some jobs?
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
August 14 2015 21:53 GMT
#13133
in germany it doesnt increase salary, it opens a few positions with more academic activities where you really need the knowledge.


i can only speak about germany and our system.
Vorenius
Profile Blog Joined December 2010
Denmark1979 Posts
August 14 2015 22:01 GMT
#13134
On August 15 2015 06:28 darkness wrote:
Show nested quote +
On August 14 2015 16:44 Zocat wrote:
I honestly depends on what you want to do. If you are happy with jobs like your current one you won't need it. A few jobs will require a higher degree, but we don't know where your interests lie. As LaNague wrote - look at various job offers.

Can you do your degree part-time? It's what I did - my 2 years master could take as long as 4 years (I needed 3, since I didn't do a normal 50:50 split).


Well, as long as I work with C#/C++ and OOP in general, I'm happy. Software engineering is definitely my preferred area, and I'd not trade it for more science. So the question is: does masters degree increase salary a lot or is it just a CV requirement for some jobs?

I think it's a safe bet that two years of salary and the added senority will out-earn having a masters. Do it if you want to immerse yourself in some particular subject, or if you want to get into research. Don't do it for money.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
August 14 2015 22:35 GMT
#13135
omg, Uboot is a mess...

There are special cases to detect operating systems that aren't Linux. Uboot proceeds to try to boot each one per it's own preferences while forgetting to set the device tree in every case but Linux. So now, every operating system that isn't Linux tells Uboot that it IS Linux so that Uboot will pass it the device tree. Of course, this means every non-Linux operating system then has to work around all the other Linux booting cruft Uboot does.

It's a farce.
Any sufficiently advanced technology is indistinguishable from magic
Hot_Ice
Profile Joined January 2013
139 Posts
August 15 2015 00:35 GMT
#13136
--- Nuked ---
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
Last Edited: 2015-08-15 18:29:35
August 15 2015 18:20 GMT
#13137
Im writing a little opengl mini platformer from scracth.

But I can't decided if I will do it in plain C or fully oop in c++.

My main concern with doing it in C is how to handle the logic, and every solution I come up with is pretty much writing something that handles function pointers for me. That is something that feels very wierd for me to write that when I can just pick c++.

Advise is welcome.
The harder it becomes, the more you should focus on the basics.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2015-08-15 18:38:18
August 15 2015 18:34 GMT
#13138
On August 16 2015 03:20 sabas123 wrote:
Im writing a little opengl mini platformer from scracth.

But I can't decided if I will do it in plain C or fully oop in c++.

My main concern with doing it in C is how to handle the logic, and every solution I come up with is pretty much writing something that handles function pointers for me. That is something that feels very wierd for me to write that when I can just pick c++.

Advise is welcome.


Pick C++, it is much safer than C. C++11 is also quite nice and can help a lot. You already have access to smart pointers and std::function which is a better function pointer. std::thread is also nice.

Edit: Also templates although I'm still not good at that.
iaretehnoob
Profile Joined June 2004
Sweden741 Posts
August 15 2015 19:04 GMT
#13139
how about C++ but not fully OOP* ?

*for typical definitions of fully OOP
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
August 15 2015 19:05 GMT
#13140
On August 16 2015 03:34 darkness wrote:
Show nested quote +
On August 16 2015 03:20 sabas123 wrote:
Im writing a little opengl mini platformer from scracth.

But I can't decided if I will do it in plain C or fully oop in c++.

My main concern with doing it in C is how to handle the logic, and every solution I come up with is pretty much writing something that handles function pointers for me. That is something that feels very wierd for me to write that when I can just pick c++.

Advise is welcome.


Pick C++, it is much safer than C. C++11 is also quite nice and can help a lot. You already have access to smart pointers and std::function which is a better function pointer. std::thread is also nice.

Edit: Also templates although I'm still not good at that.

I haven't worked with templates but use generics (soft of like templates from what I understand) everyday, its super usefull.
The harder it becomes, the more you should focus on the basics.
Prev 1 655 656 657 658 659 1032 Next
Please log in or register to reply.
Live Events Refresh
OSC
17:00
OSC Elite Rising Star #17
YoungYakov vs Mixu
ForJumy vs TBD
Percival vs TBD
Shameless vs TBD
SteadfastSC0
Liquipedia
WardiTV 2025
12:00
Playoffs
Spirit vs ShoWTimELIVE!
WardiTV1534
ComeBackTV 719
TaKeTV 415
IndyStarCraft 239
Rex105
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 239
ProTech126
Rex 105
BRAT_OK 77
SteadfastSC 0
StarCraft: Brood War
Britney 24696
Calm 2146
Shuttle 906
Jaedong 781
actioN 541
EffOrt 418
Hyuk 275
Larva 194
Rush 134
ggaemo 133
[ Show more ]
Zeus 118
Hyun 106
Mong 84
Dewaltoss 71
Bonyth 61
Mind 53
Movie 38
sas.Sziky 36
Rock 30
Aegong 26
yabsab 21
Shine 9
Terrorterran 6
Noble 4
Dota 2
Gorgc5023
qojqva3453
singsing3138
Dendi953
syndereN395
Counter-Strike
pashabiceps789
Foxcn292
Other Games
FrodaN902
hiko591
Beastyqt404
ceh9360
Fuzer 330
RotterdaM162
ArmadaUGS128
XaKoH 88
QueenE84
C9.Mang062
Livibee57
Trikslyr54
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• StrangeGG 27
• poizon28 21
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• blackmanpl 9
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV554
League of Legends
• Nemesis2188
• TFBlade903
Upcoming Events
The PondCast
16h 42m
WardiTV 2025
19h 42m
Cure vs Creator
TBD vs Solar
WardiTV 2025
1d 17h
OSC
1d 20h
CranKy Ducklings
2 days
SC Evo League
2 days
Ladder Legends
3 days
BSL 21
3 days
Sparkling Tuna Cup
3 days
Ladder Legends
3 days
[ Show More ]
BSL 21
4 days
Replay Cast
4 days
Monday Night Weeklies
4 days
WardiTV Invitational
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Offline Finals
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
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

Upcoming

CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
ESL Pro League Season 23
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.