• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:29
CEST 20:29
KST 03:29
  • 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
Team Liquid Map Contest #22 - The Finalists14[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21
Community News
2026 GSL Season 1 Qualifiers11Maestros of the Game 2 announced32026 GSL Tour plans announced13Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid22
StarCraft 2
General
2026 GSL Tour plans announced MaNa leaves Team Liquid Team Liquid Map Contest #22 - The Finalists Weekly Cups (April 6-12): herO doubles, "Villains" prevail Oliveira Would Have Returned If EWC Continued
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament GSL CK: More events planned pending crowdfunding 2026 GSL Season 1 Qualifiers Master Swan Open (Global Bronze-Master 2) SEL Doubles (SC Evo Bimonthly)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 521 Memorable Boss Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
Data needed RepMastered™: replay sharing and analyzer site Gypsy to Korea ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro16 Group A [ASL21] Ro16 Group B
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Reappraising The Situation T…
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1535 users

The Big Programming Thread - Page 318

Forum Index > General Forum
Post a Reply
Prev 1 316 317 318 319 320 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.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-06-29 17:04:30
June 29 2013 17:03 GMT
#6341
On June 30 2013 01:04 3FFA wrote:
I'm curious, what steps(if any) do you guys take before you sit down and start actually programming? Do you write Pseudo-code? Do you write an outline of what you'll do? Do you draw a map of some kind? etc.

Long abstract discussions with PMs, co-workers.
Design docs.
Lots of drawing boxes & lines on whiteboards.
Think and map out system in head.
Read lots of existing code.
Think and map out new code in head.
Write tests, haha no I don't write tests first. Fuck that.

Write all code.

Write unit tests.
Go back and rewrite code that wasn't easy to unit test because I fucked up.

Write integration tests.
Go back and rewrite code that wasn't easy to write integration tests for because I fucked up.

Write monitoring code.
Write logging code.
Go back and maybe test the monitoring code.
Do more productionization bullshit blah blah blah...

The actual writing of code is the easy part
Who after all is today speaking about the destruction of the Armenians?
Craton
Profile Blog Joined December 2009
United States17281 Posts
Last Edited: 2013-06-29 18:24:14
June 29 2013 18:23 GMT
#6342
On June 30 2013 01:04 3FFA wrote:
I'm curious, what steps(if any) do you guys take before you sit down and start actually programming? Do you write Pseudo-code? Do you write an outline of what you'll do? Do you draw a map of some kind? etc.

Depends what I'm doing. The harder or less clear it is, the more I tend to map it out and/or run my thoughts by my manager. The main thing is usually keeping edge cases in mind and taking an approach that is maintainable and performs well. We have a lot of edge cases on my current project and lacking requirements from the client.

Simple things I rarely spend much, if any, time to plan.

You'll come to hate all test code you have to write.
twitch.tv/cratonz
kollin
Profile Blog Joined March 2011
United Kingdom8380 Posts
June 30 2013 17:37 GMT
#6343
I've been working my way through the MIT OCW computer science stuff, and have gotten stuck on a problem set here. While I managed to do the first two problems, the final one has gotten me completely stuck.
This is what I first came up with, but the output I get isn't even close to what it should be. I'm certain the problem is with my while loop, so I changed it to this, however that gives me no output and I'm on the verge of giving up as I have no idea what to do :/
Duval
Profile Blog Joined February 2011
Belgium144 Posts
June 30 2013 18:09 GMT
#6344
On July 01 2013 02:37 kollin wrote:
I've been working my way through the MIT OCW computer science stuff, and have gotten stuck on a problem set here. While I managed to do the first two problems, the final one has gotten me completely stuck.
This is what I first came up with, but the output I get isn't even close to what it should be. I'm certain the problem is with my while loop, so I changed it to this, however that gives me no output and I'm on the verge of giving up as I have no idea what to do :/


Have you checked out the wikipedia article? There's example pseudo code:

INPUT: Function f, endpoint values a, b, tolerance TOL, maximum iterations NMAX
CONDITIONS: a < b, either f(a) < 0 and f(b) > 0 or f(a) > 0 and f(b) < 0
OUTPUT: value which differs from a root of f(x)=0 by less than TOL

N ← 1
While N ≤ NMAX { limit iterations to prevent infinite loop
c ← (a + b)/2 new midpoint
If (f(c) = 0 or (b – a)/2 < TOL then { solution found
Output(c)
Stop
}
N ← N + 1 increment step counter
If sign(f(c)) = sign(f(a)) then a ← c else b ← c new interval
}
Output("Method failed.") max number of steps exceeded


The function would be the same as in your 2nd problem, the interval and tolerance are given as well (in the pdf). NMAX should be a high enough value, but you can go for an infinite loop as well (while true :p)
kollin
Profile Blog Joined March 2011
United Kingdom8380 Posts
June 30 2013 19:12 GMT
#6345
What would the tolerance be? Sorry if I'm being obtuse, but I can't work it out XD
Duval
Profile Blog Joined February 2011
Belgium144 Posts
Last Edited: 2013-06-30 21:38:05
June 30 2013 20:07 GMT
#6346
The bisection method is actually binary searching, I see now. The principle of binary searching is pretty simple, an example would be the 'guess my number' game:

There's an interval (for example 1-100), and you start guessing in the middle of this interval. You then get to know wether the answer is higher or lower than this center value (50 in the example), and start the process again until you've found the correct value.

So you got your lower- and upperbound, what you need to do is check if the middle of this range is the correct value to pay off correctly in exactly 12 months. If it's too low (so you dont reach the amount necesairy to pay off everything including monthly interest), you can replace your lower bound by this value. If it's too high, the other way around. You keep doing this until your value is within the tolerance range (it has to be correct to the cent, so 0.01)

If you want I can give an example in c or c++, python is on my list of languages to learn soon...
EDIT: Implementation in c++, I tried to comment enough for you to understand
Small note tho, this code assumes there's always a 12 month period to pay off, modifying it to see if it could be done in fewer months shouldn't be much of an issue though.
Frigo
Profile Joined August 2009
Hungary1023 Posts
June 30 2013 21:13 GMT
#6347
Tolerance can be the implementation limits of double.

See my implementation:
Bisection.java
BisectionTest.java
http://www.fimfiction.net/user/Treasure_Chest
Restrider
Profile Joined March 2011
Germany129 Posts
July 01 2013 07:31 GMT
#6348
Thanks for the replies.

Since Mathlab is free for me (University Licence, yay!) figured that I should really start with that. But I am keeping in mind to maybe do a Python Tutorial to have at least a little overview of what programming actually can do.
Birdie
Profile Blog Joined August 2007
New Zealand4438 Posts
Last Edited: 2013-07-01 07:51:55
July 01 2013 07:51 GMT
#6349
I'm trying to send keyboard input to a (preferably background) window, specifically Open Broadcaster Software. From what I can find out, I need to use PostMessage if I want it to remain a background window. However, I can't get that to work.

Relevant code:


HWND obs;
obs = FindWindow(NULL, "Open Broadcaster Software v0.522b");
if(!obs)
{
printf("Failed to get obs Window");
} else {
printf("success");
}

PostMessage(obs,WM_KEYDOWN,VK_F8,0);
PostMessage(obs,WM_KEYUP,VK_F8,0);


It prints success but the scene doesn't change in OBS (which is of course what I'm trying to do. The scene hotkey works fine if OBS is in the foreground and I manually change it.)

Does anyone here know what I'm doing wrong?
Red classic | A butterfly dreamed he was Zhuangzi | 4.5k, heading to 5k as support!
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
July 01 2013 13:25 GMT
#6350
Does anyone else really enjoy coding on rainy days compared to sunny ones?
I can only play starcraft when I am shit canned. IPXZERG is a god.
HyunA
Profile Joined July 2010
Romania362 Posts
July 01 2013 19:16 GMT
#6351
Can anybody please explain to me how does compareTo work in java for strings? I can't seem to wrap my head around it :/

Like:
System.out.print("Comparing \"axe\" with \"dog\" produces ");
int i = "axe".compareTo("dog");
System.out.println(i);

The output is -3. But what does it actually compare?
ferdkuh
Profile Joined January 2013
10 Posts
July 01 2013 19:21 GMT
#6352
Even though I generally dislike just posting a link as an answer, I doubt that I could explain it in a clearer way than the java apidocs:

http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#compareTo(java.lang.String)
HyunA
Profile Joined July 2010
Romania362 Posts
July 01 2013 19:26 GMT
#6353
On July 02 2013 04:21 ferdkuh wrote:
Even though I generally dislike just posting a link as an answer, I doubt that I could explain it in a clearer way than the java apidocs:

http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#compareTo(java.lang.String)

Alright, thanks.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-07-01 22:23:58
July 01 2013 21:56 GMT
#6354
Does it hurt your job chances if your university BSc degree is called 'Computer Information Systems' instead of 'Software Development' or 'Computer Science'? My Computer Science department offers these programmes:

Computer Information Systems: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G500
Software Development: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G610
Computer Science: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G400

I have noticed that what I have in 'Software Development' in year 3 (final year) is possible to have with 'Computer Information Systems' as well. I just need to check what the mandatory module is, but I think all modules are overlapped anyway.

I need to make a decision because I screwed one module, and I probably can't go to re-sit in August, so my only chance is to change my programme to CIS.

If this helps, I'm planning to do software programming once I graduate.

Edit: Is it ok to compensate for this if I get MSc in Software Engineering or is this not possible to freely choose MSC Software Engineering if you didn't take BSc Software Engineering? I'm just curious if there is hope, so anything you can help with is welcome. I usually prefer answers from already professional developers.
Warri
Profile Joined May 2010
Germany3208 Posts
July 01 2013 23:50 GMT
#6355
I'm trying to find a pixel with a certain color in java.


for (int i = MIN_XY.y; i < MAX_XY.y; i++) {
for (int j = MIN_XY.x; j < MAX_XY.x; j++) {
if (screen.getPixelColor(j, i).equals(RINGCOLOR)) {
xy[0] = j;
xy[1] = i;
return xy;
}
}
}

It works, but is incredibly slow. Is there a better way to do it?
ferdkuh
Profile Joined January 2013
10 Posts
July 02 2013 00:54 GMT
#6356
It is much faster if you take a screen capture of the area you're interested in and then search the pixel data of the image.


BufferedImage image = screen.createScreenCapture(new Rectangle(X_MIN, Y_MIN, X_MAX, Y_MAX))
Array[int] pixelColors = ((DataBufferInt) image.getRaster.getDataBuffer).getData


Then simpyl iteratore over pixelColors and compare to YOURCOLOR.getRGB
Release
Profile Blog Joined October 2010
United States4397 Posts
July 02 2013 01:43 GMT
#6357
On July 02 2013 06:56 darkness wrote:
Does it hurt your job chances if your university BSc degree is called 'Computer Information Systems' instead of 'Software Development' or 'Computer Science'? My Computer Science department offers these programmes:

Computer Information Systems: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G500
Software Development: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G610
Computer Science: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G400

I have noticed that what I have in 'Software Development' in year 3 (final year) is possible to have with 'Computer Information Systems' as well. I just need to check what the mandatory module is, but I think all modules are overlapped anyway.

I need to make a decision because I screwed one module, and I probably can't go to re-sit in August, so my only chance is to change my programme to CIS.

If this helps, I'm planning to do software programming once I graduate.

Edit: Is it ok to compensate for this if I get MSc in Software Engineering or is this not possible to freely choose MSC Software Engineering if you didn't take BSc Software Engineering? I'm just curious if there is hope, so anything you can help with is welcome. I usually prefer answers from already professional developers.

at the end of the day, your skills, not your degree, will get you a job.
☺
heroyi
Profile Blog Joined March 2009
United States1064 Posts
Last Edited: 2013-07-02 01:46:22
July 02 2013 01:46 GMT
#6358
On July 02 2013 10:43 Release wrote:
Show nested quote +
On July 02 2013 06:56 darkness wrote:
Does it hurt your job chances if your university BSc degree is called 'Computer Information Systems' instead of 'Software Development' or 'Computer Science'? My Computer Science department offers these programmes:

Computer Information Systems: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G500
Software Development: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G610
Computer Science: http://intranet.csc.liv.ac.uk/teaching/programmes/programme.php?pcode=G400

I have noticed that what I have in 'Software Development' in year 3 (final year) is possible to have with 'Computer Information Systems' as well. I just need to check what the mandatory module is, but I think all modules are overlapped anyway.

I need to make a decision because I screwed one module, and I probably can't go to re-sit in August, so my only chance is to change my programme to CIS.

If this helps, I'm planning to do software programming once I graduate.

Edit: Is it ok to compensate for this if I get MSc in Software Engineering or is this not possible to freely choose MSC Software Engineering if you didn't take BSc Software Engineering? I'm just curious if there is hope, so anything you can help with is welcome. I usually prefer answers from already professional developers.

at the end of the day, your skills, not your degree, will get you a job.

People need to take this to heart.

Network >> Portfolio >>>>>>>>>>>> degree
wat wat in my pants
Pawsom
Profile Blog Joined February 2009
United States928 Posts
Last Edited: 2013-07-02 02:10:50
July 02 2013 01:54 GMT
#6359
On July 01 2013 16:51 Birdie wrote:
I'm trying to send keyboard input to a (preferably background) window, specifically Open Broadcaster Software. From what I can find out, I need to use PostMessage if I want it to remain a background window. However, I can't get that to work.

Relevant code:


HWND obs;
obs = FindWindow(NULL, "Open Broadcaster Software v0.522b");
if(!obs)
{
printf("Failed to get obs Window");
} else {
printf("success");
}

PostMessage(obs,WM_KEYDOWN,VK_F8,0);
PostMessage(obs,WM_KEYUP,VK_F8,0);


It prints success but the scene doesn't change in OBS (which is of course what I'm trying to do. The scene hotkey works fine if OBS is in the foreground and I manually change it.)

Does anyone here know what I'm doing wrong?


There's really not a proper way to send a keyboard input to a window without activating it.
http://blogs.msdn.com/b/oldnewthing/archive/2005/05/30/423202.aspx
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
July 02 2013 02:29 GMT
#6360
Did anyone else ever experience a programmers block or know someone who experienced it?

Whenever i write a program, after it reaches a certain size my brain keeps saying "It's all wrong! It should be done better! It's bad, messy and slow!" when those parts are actually working and then it blanks whenever i actually try to finish another part or improve those parts. I program since 23 years and this only started to happen at my last job. The last 6 month i didn't program at all, hoping that taking a break would fix it, but it still happens and makes me really concerned about my future work. It's like i have to unlearn anything i learned in the last few years.


On July 01 2013 16:51 Birdie wrote:
I'm trying to send keyboard input to a (preferably background) window, specifically Open Broadcaster Software. From what I can find out, I need to use PostMessage if I want it to remain a background window. However, I can't get that to work.

Relevant code:


HWND obs;
obs = FindWindow(NULL, "Open Broadcaster Software v0.522b");
if(!obs)
{
printf("Failed to get obs Window");
} else {
printf("success");
}

PostMessage(obs,WM_KEYDOWN,VK_F8,0);
PostMessage(obs,WM_KEYUP,VK_F8,0);


It prints success but the scene doesn't change in OBS (which is of course what I'm trying to do. The scene hotkey works fine if OBS is in the foreground and I manually change it.)

Does anyone here know what I'm doing wrong?


I don't have much experience with that particular topic but it could be that the check for keyboard input and the message processing in OBS are async, so if the key down/key up are too close to each other, the process might miss it. You could try adding a short sleep, e.g. 200ms between the key down and key up to check if it changes anything.
Prev 1 316 317 318 319 320 1032 Next
Please log in or register to reply.
Live Events Refresh
IPSL
16:00
Ro24 Group D
JDConan vs TBD
Aegong vs rasowy
Liquipedia
PSISTORM Gaming Misc
15:55
FSL s10 code S playoffs
Freeedom40
Liquipedia
Ladder Legends
15:00
Valedictorian Cup #1 Qualifier
SteadfastSC224
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Liquid`TLO 452
SteadfastSC 224
elazer 117
BRAT_OK 64
JuggernautJason17
StarCraft: Brood War
Calm 3327
Mini 501
firebathero 146
Dewaltoss 109
actioN 79
Killer 36
yabsab 29
Rock 28
Movie 25
GoRush 12
[ Show more ]
Hm[arnc] 10
Dota 2
Gorgc6309
Counter-Strike
fl0m10133
olofmeister2777
byalli595
Super Smash Bros
Mew2King129
Heroes of the Storm
Khaldor704
Liquid`Hasu499
Other Games
Grubby4700
FrodaN1062
B2W.Neo728
KnowMe234
RotterdaM75
MindelVK14
Organizations
Dota 2
PGL Dota 2 - Secondary Stream3234
StarCraft 2
ComeBackTV 842
Other Games
gamesdonequick839
BasetradeTV809
StarCraft 2
angryscii 40
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 25 non-featured ]
StarCraft 2
• Shameless 30
• LUISG 23
• Adnapsc2 17
• Reevou 9
• maralekos5
• Response 4
• iHatsuTV 2
• OhrlRock 1
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• sooper7s
• Migwel
StarCraft: Brood War
• Airneanach78
• 80smullet 9
• FirePhoenix6
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• TFBlade1807
• Nemesis1562
Other Games
• imaqtpie893
• Shiphtur199
Upcoming Events
BSL
31m
StRyKeR vs rasowy
Artosis vs Aether
JDConan vs OyAji
Hawk vs izu
Replay Cast
5h 31m
Replay Cast
14h 31m
Wardi Open
15h 31m
Afreeca Starleague
15h 31m
Bisu vs Ample
Jaedong vs Flash
Monday Night Weeklies
21h 31m
RSL Revival
1d 7h
GSL
1d 13h
Afreeca Starleague
1d 15h
Barracks vs Leta
Royal vs Light
WardiTV Map Contest Tou…
1d 16h
[ Show More ]
RSL Revival
2 days
Replay Cast
3 days
The PondCast
3 days
KCM Race Survival
3 days
WardiTV Map Contest Tou…
3 days
CranKy Ducklings
4 days
Escore
4 days
RSL Revival
4 days
WardiTV Map Contest Tou…
5 days
Universe Titan Cup
5 days
Rogue vs Percival
Ladder Legends
5 days
uThermal 2v2 Circuit
5 days
BSL
6 days
Sparkling Tuna Cup
6 days
WardiTV Map Contest Tou…
6 days
Ladder Legends
6 days
Liquipedia Results

Completed

Escore Tournament S2: W3
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 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.