• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:54
CEST 11:54
KST 18:54
  • 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
[ASL22] Ro24 Preview: Siren's Call8[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3
Community News
Stellar Fest TWO the Moon (Dec 16-20)8Weekly Cups (August 24-30): Patches' balance mod takes over2New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6Weekly Cups (August 10-16): SHIN doubles5
StarCraft 2
General
Weekly Cups (August 10-16): SHIN doubles Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game SC4ALL II: SC2 Player Announcement 6/8 - Maru Weekly Cups (August 24-30): Patches' balance mod takes over How would you feel about frequent/monthly balance patches for SC2?
Tourneys
IntoTheTV X SOOP SC2 League : Weekly & Monthly SC2 INu's Battles#20 [BO.9] 2026 GSTL Announcement Stellar Fest TWO the Moon (Dec 16-20) PIG STY FESTIVAL 8.0! (13 - 23 August)
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 541 Binary Choice The PondCast: SC2 News & Results Mutation # 540 Dodge This Mutation # 539 Thunder Dome
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion Making an Online Broodwar Manager Game ASL22 General Discussion [Personal Project Share] Terran Defense v0.60
Tourneys
KCM Race Survival 2026 Season 3 [Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS [ASL22] Ro24 Group F
Strategy
Replay Review Process - What do you do? Game Theory for Starcraft Odyssey Mineral Stack Saturation Fighting Spirit mining rates
Other Games
General Games
[Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread Stratus: Battle for the sky now on steam Early acc Nintendo Switch Thread Stormgate/Frost Giant Megathread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Canadian Politics Mega-thread European Politico-economics QA Mega-thread
Fan Clubs
MarineLorD Fan Club The Creator Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4607 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 States17303 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
Next event in 6m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
EnDerr 39
StarCraft: Brood War
firebathero 2066
Shuttle 1187
Bisu 830
Hyuk 413
Pusan 146
ZerO 146
EffOrt 139
Stork 139
ToSsGirL 84
Shinee 65
[ Show more ]
910 33
sSak 27
Sacsri 24
NotJumperer 19
soO 12
Rush 12
Light 0
Counter-Strike
olofmeister926
shoxiejesuss846
byalli585
Other Games
ceh9745
singsing513
crisheroes299
XaKoH 269
Mew2King104
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 0
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH262
• StrangeGG 54
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• iopq 7
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1174
Other Games
• WagamamaTV223
Upcoming Events
The PondCast
6m
KCM Race Survival
6m
OSC
12h 36m
IntoTheTV X SOOP
1d 1h
CranKy Ducklings
2 days
Sparkling Tuna Cup
3 days
OSC
3 days
Shopify Rebellion Sundays
3 days
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Afreeca Starleague
4 days
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
4 days
[ Show More ]
Afreeca Starleague
5 days
Leta vs ggaemo
Jaedong vs Queen
GSL
5 days
PiGosaur Cup
5 days
Kung Fu Cup
6 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-09-02
PiG Sty Festival 8.0
Light Tournament 2026

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL 2026 AUTUMN (S22)
RSL Revival: Season 6
Calamity Invitational
Big Dog Cup 2026 Div 1
BLAST Open Fall 2026
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

Acropolis #5
Acropolis #5 - TRS
Escore Tournament S3: King of Kings
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
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.