• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:42
CET 08:42
KST 16:42
  • 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
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1784 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 States17274 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
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 119
-ZergGirl 63
StarCraft: Brood War
Tasteless 244
Sacsri 82
Shine 74
Bale 36
Dewaltoss 35
Pusan 32
ZergMaN 29
Dota 2
febbydoto237
NeuroSwarm137
canceldota22
League of Legends
JimRising 567
Reynor54
Super Smash Bros
Westballz14
Other Games
summit1g10830
WinterStarcraft589
crisheroes277
C9.Mang0243
Mew2King33
Organizations
Other Games
gamesdonequick660
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Berry_CruncH173
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo1261
Upcoming Events
The PondCast
2h 19m
OSC
8h 19m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
16h 19m
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.