• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:47
CEST 15:47
KST 22:47
  • 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
Code S Season 1 - RO8 Preview3[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) Sea Duckling Open (Global, Bronze-Diamond) RSL Revival: Season 5 - Qualifiers and Main Event Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
Do we have a pimpest plays list? Why there arent any 256x256 pro maps? BGH Auto Balance -> http://bghmmr.eu/ (Spoiler) Asl ro8 D winner interview BW General Discussion
Tourneys
[ASL21] Ro8 Day 4 Escore Tournament StarCraft Season 2 Small VOD Thread 2.0 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread OutLive 25 (RTS Game) Dawn of War IV
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
European Politico-economics QA Mega-thread US Politics Mega-thread Canadian Politics Mega-thread The Letting Off Steam Thread Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1082 users

The Big Programming Thread - Page 990

Forum Index > General Forum
Post a Reply
Prev 1 988 989 990 991 992 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.
Lmui
Profile Joined November 2010
Canada6223 Posts
Last Edited: 2019-01-15 22:40:06
January 15 2019 22:25 GMT
#19781
On January 16 2019 07:11 travis wrote:
Given a 2d point, and a distance, I would like to output a point every 10 degrees on the circle that surrounds that point by the distance. It can start at 0 degrees, I don't really care. So, 35 points.

What is a good way to do that? Brain is pretty tired. I am using python but I am sure I could convert non python code to python if you want to write it in your favorite language (without relying on libraries).


SOH CAH TOA

I'm sure you can find a math library that does trignometry

circle(Point point, int dist) {
Point [] circle = new Point [36];
for (i=0;i<36; i++) {
circle.add(new Point ( point.x + dist*cos(i*10), point.y + dist*sin(i*10));
}
return circle;
}


Something like that?

edit:: oops forgot to add initial values, and changed it to be (x,y) instead of (y,x)
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2019-01-15 22:41:14
January 15 2019 22:31 GMT
#19782
is that backwards? but yeah, that's what I want I think
thank you

edit: ah you caught it
edit2: i better never let potential employers see this thread. I could have solved this on my own, I promise
Simberto
Profile Blog Joined July 2010
Germany11831 Posts
Last Edited: 2019-01-16 01:03:42
January 16 2019 01:03 GMT
#19783
Or just use polar coordinates, at which point all of the points you want on the circle are simply (R, 10° * k) for k out of 0, 35

(or 2*Pi*k / 36) if you use radians.
ZenithM
Profile Joined February 2011
France15952 Posts
Last Edited: 2019-01-16 11:18:08
January 16 2019 03:01 GMT
#19784
Edit: I just lashed out, that was unseemly, I'm sorry.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2019-01-18 14:39:37
January 16 2019 03:21 GMT
#19785
edit: well if you see that it was mean then there is no longer any problem
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 18 2019 00:51 GMT
#19786
@Travis - I like your enthusiasm. While any individual person has a low chance of solving one of those problems, if we stop trying we never will. Even if we do try we might never. This is known as the halting problem

Does anyone know of any built in way to call an HTTP endpoint from an AWS Step Functions flow? It seems like you can only call Lambdas. We are hoping to write 0 code while building a simple scheduler in AWS SF. Apache Airflow has the Simple HTTP Operator and we are hoping for similar here.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 19 2019 17:13 GMT
#19787
I asked my coworkers and apparently they announced something like a Simple Http Operator at ReInvent. We're going to use Lambdas for now.

Also, no programming language should have breaks, jumps, or continues. CMV.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Excludos
Profile Blog Joined April 2010
Norway8255 Posts
Last Edited: 2019-01-19 17:29:49
January 19 2019 17:28 GMT
#19788
On January 20 2019 02:13 WarSame wrote:
I asked my coworkers and apparently they announced something like a Simple Http Operator at ReInvent. We're going to use Lambdas for now.

Also, no programming language should have breaks, jumps, or continues. CMV.


I literally could not imagine even attempting to program a complicated piece of code without breaks and continues, even less so how infuriatingly bad that code would have to look. P.S: Even goto's are a legit tool to use in certain scenarios (My rule of thumb is they should never jump up, only down. And even then I haven't used one in over a year).

If you dislike jumps, I can't even imagine how you're going to react to using events, which are essential for front end programming.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
January 19 2019 22:03 GMT
#19789
I agree about breaks and continues.. I rely on them constantly, especially continue.

Using "if X, continue" can replace an "if A or B or C or D or E or F or G... etc"
tofucake
Profile Blog Joined October 2009
Hyrule19210 Posts
January 19 2019 23:17 GMT
#19790
Break and continue are amazing, especially in batching. People who say to never use them and to just design stuff "better" are wrong.
Liquipediaasante sana squash banana
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
January 20 2019 08:05 GMT
#19791
On January 20 2019 07:03 travis wrote:
I agree about breaks and continues.. I rely on them constantly, especially continue.

Using "if X, continue" can replace an "if A or B or C or D or E or F or G... etc"


Technically you can avoid that by filtering your collection first (for simple stuff). Depends on the use-case though, there sure are times when breaks and continues are invaluable.
Time is precious. Waste it wisely.
SC-Shield
Profile Joined December 2018
Bulgaria843 Posts
Last Edited: 2019-01-20 11:10:09
January 20 2019 10:47 GMT
#19792
When a guy like Bjarne Stroustrup (C++ inventor) is hesitant to give hard rules about not using something in C++ because he says that there are exceptions, I think not many people are around his level to be so sure to advise against using something in programming ever. You could be talking about a different programming language, but I think this idea still aplies.

For example, C++11 has smart pointers which deallocate memory based on scope.
E.g.

void SomeFunction()
{
std::unique_ptr<Class> object = std::make_unique<Class>(constructor parameters here);
} // memory is deallocated when function's scope ends


The usual advice is not to use "new" and "delete" anymore to reduce the chance of memory leaks. This isn't a hard rule because you still need "new" and "delete" even with smart pointers. For example, when you need a custom deleter function and one case for that is if you work with C implementation of something. Or, if you need to use a C++ library which expects an object but its implementation doesn't use smart pointers. In this case, you'd use "new" in constructor and "delete" in destructor of your class.

So, "new" and "delete" are still useful, you just need to use them less but giving a hard rule not to use them at all is meaningless when you don't have context. I think it's more important to understand *why* before learning a rule so you know when not to apply it.
mahrgell
Profile Blog Joined December 2009
Germany3943 Posts
January 20 2019 11:08 GMT
#19793
On January 20 2019 19:47 SC-Shield wrote:
When a guy like Bjarne Stroustrup (C++ inventor) is hesitant to give hard rules about not using something in C++ because he says that there are exceptions, I think not many people are around his level to be so sure to advise against using something in programming ever. You could be talking about a different programming language, but I think this idea still aplies.

For example, C++11 has smart pointers which deallocate memory based on scope.
E.g.

void SomeFunction()
{
std::unique_ptr<Class> object = std::make_unique<Class>(constructor parameters here);
} // memory is deallocated when function's scope ends


The usual advice is not to use "new" and "delete" anymore to reduce the chance of memory leaks. This isn't a hard rule because you still need "new" and "delete" even with smart pointers. For example, when you need a custom deleter function and one case for that is if you work with C implementation of something. So, "new" and "delete" are still useful, you just need to use them less but giving a hard rule not to use them at all is meaningless when you don't have context. I think it's more important to understand *why* before learning a rule so you know when not to apply it.


And then you have a company, which has very weird own self implemented "smart pointer" constructs, developed somewhere in the early 90s, and since the code is full of those and all foundation frameworks use those, you are also forced to use those all the time ^.^ You can't imagine how much I wish that I would be able to use those C++11 smart pointers...
SC-Shield
Profile Joined December 2018
Bulgaria843 Posts
January 20 2019 13:54 GMT
#19794
Do you guys know a good article to read about POSIX concurrency (threads and synchronisation) as well as signals? If not, I'll just stick to what I've found on Google so far.
JimmyJRaynor
Profile Blog Joined April 2010
Canada17498 Posts
Last Edited: 2019-01-20 19:24:10
January 20 2019 19:13 GMT
#19795
On January 15 2019 22:49 ZenithM wrote:
Even assuming AI is indeed the future, AI jobs are a bubble right now, but it will plateau or even dial down at some point. Having basics in machine learning will be very common for every scientist or programmer, but we don't need that many people working on data.

And like everything else, there is a spectrum of skill and expertise within AI/ML, after a while it won't be worth much to put that on your CV if all you did was take a class.
I would say at this very moment it indeed looks good on your CV though. Even small businesses are looking for a dedicated "data scientist" even if they don't realize they need one full-time guy to do that.

I'm a hired gun. I created and implemented a "customer handicapping system" for a direct marketing agency that employs ~30 people. i created the system. i did the coding. With the help of the full time IT people i/we figured out where to shoe-horn the decision/handicapping system into the existing transaction focused data processing systems.

its hard to find good coders
a) with knowledge of existing data processing systems
b) who know how to build software
c) the math knowledge/ability to pull this stuff off.

As a result, many businesses with less than 100 employees go with a "gunslinger" as opposed to a full time employee.
+ Show Spoiler +
[image loading]
Ray Kassar To David Crane : "you're no more important to Atari than the factory workers assembling the cartridges"
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
January 20 2019 21:01 GMT
#19796
On January 20 2019 08:17 tofucake wrote:
Break and continue are amazing, especially in batching. People who say to never use them and to just design stuff "better" are wrong.

How so? Where would you reasonably use them that using sub functions wouldn't work so well and be much clearer?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Mr. Wiggles
Profile Blog Joined August 2010
Canada5894 Posts
January 21 2019 16:15 GMT
#19797
On January 20 2019 22:54 SC-Shield wrote:
Do you guys know a good article to read about POSIX concurrency (threads and synchronisation) as well as signals? If not, I'll just stick to what I've found on Google so far.

Not an article, but the book "Advanced Programming in the UNIX Environment" by W. Richard Stevens has a very good treatment of many UNIX systems programming concepts. There's an entire chapter on each of the subjects of signals, threads, and thread control.

I believe there's source for the book available so you can theoretically make your own PDF if you don't want to buy it.

http://www.apuebook.com/apue3e.html
you gotta dance
SC-Shield
Profile Joined December 2018
Bulgaria843 Posts
Last Edited: 2019-01-21 21:47:21
January 21 2019 19:38 GMT
#19798
On January 22 2019 01:15 Mr. Wiggles wrote:
Show nested quote +
On January 20 2019 22:54 SC-Shield wrote:
Do you guys know a good article to read about POSIX concurrency (threads and synchronisation) as well as signals? If not, I'll just stick to what I've found on Google so far.

Not an article, but the book "Advanced Programming in the UNIX Environment" by W. Richard Stevens has a very good treatment of many UNIX systems programming concepts. There's an entire chapter on each of the subjects of signals, threads, and thread control.

I believe there's source for the book available so you can theoretically make your own PDF if you don't want to buy it.

http://www.apuebook.com/apue3e.html


Thanks. I think I won't have time to read it all before job interviews, but I'll see what I can learn. Also, I had 1 successful and 1 failed interview today. The unsuccessful interview lasted only 30 minutes because:
- the interviewer turned out be provocative (HR warned me before that he had weird sense of humour)
- the interviewer seemed more focused on C, and I insisted that I'm interested only in C++ to advance my professional career

Other than that, the interviewer was trying to provoke me by asking questions like, "can't you have instances of struct with function pointers instead of classes with methods?". I said: "Yes, you can but it's better use C++ because it's built for that.". Again, he was like: "But I can do object-oriented programming in Assembly" and overall his idea was to provoke me as much as possible to see how I think and to him programming languages are meaningless and it's important what to write.
Also, he said C++ is used less and less but I said that I don't agree because there's C++11/14/17 and C++20 soon, so the language is getting updated quite often. Now I realise that I didn't explain much when I said it in interview, but I wasn't motivated to continue interview anyway. My idea is the language stays fresh, so I think more people will use it but even without new features, C++ has its uses.

In general, he was glad I didn't work for him and I'm glad I don't have to work for him. As a colleague says, interview isn't about employer interviewing you but the chance for you to also interview him. I definitely made mistakes, but it's also not the place for me to work there.

Edit: I also got questions about my personal hobbies and what year is a leap year. Absolutely random things. :D

I think if you're not in a hurry to get the first available job, interviews are very nice to show you your weaknesses just like a game of StarCraft. I just couldn't learn much from the last interview, but I'm sure I could learn more from next interviews.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
January 22 2019 02:51 GMT
#19799
Nice attitude, I think it will help you avoid getting into some job where you end up hating life.
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
Last Edited: 2019-01-22 09:36:20
January 22 2019 09:21 GMT
#19800
On January 21 2019 06:01 WarSame wrote:
Show nested quote +
On January 20 2019 08:17 tofucake wrote:
Break and continue are amazing, especially in batching. People who say to never use them and to just design stuff "better" are wrong.

How so? Where would you reasonably use them that using sub functions wouldn't work so well and be much clearer?


It is easy to substitute simple looping with recursion. But then you can potentially run into a couple of problems:
- if your language doesn't support TCO you will run into performance issues
- if your language does support TCO you can't debug it properly since you lose the stack trace

Recursion will also be a real mess for cases like that:


outer loop
outer a

inner loop
inner a

if condition
continue outer (without going to outer b)

inner b

outer b


Edit: This too depends on a language of choice of course. Some make looping easier for you.
Time is precious. Waste it wisely.
Prev 1 988 989 990 991 992 1032 Next
Please log in or register to reply.
Live Events Refresh
WardiTV Invitational
11:00
Wardi Spring Cup
Ryung vs ShoWTimELIVE!
WardiTV940
IntoTheiNu 913
TKL 206
Rex119
Ryung 99
LiquipediaDiscussion
Escore
10:00
Week 6
escodisco2526
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 206
Rex 109
Ryung 99
Serral 0
StarCraft: Brood War
Britney 47010
Bisu 1815
Horang2 1073
firebathero 753
Mini 528
Light 397
Killer 350
EffOrt 349
Stork 310
Soma 286
[ Show more ]
ggaemo 279
actioN 250
Hyuk 196
BeSt 176
Soulkey 143
Zeus 140
Larva 136
ZerO 131
Pusan 112
Hyun 91
Rush 87
Dewaltoss 73
hero 61
Backho 48
[sc1f]eonzerg 47
ToSsGirL 39
soO 38
Sharp 38
HiyA 33
910 30
Barracks 29
Shine 26
Bale 26
scan(afreeca) 19
sorry 17
Terrorterran 17
Noble 14
Sacsri 14
GoRush 13
Rock 12
ajuk12(nOOB) 11
IntoTheRainbow 11
Icarus 7
Dota 2
Gorgc4901
qojqva1382
syndereN474
XcaliburYe122
League of Legends
Reynor68
Counter-Strike
allub323
Other Games
singsing2199
B2W.Neo1138
hiko1045
DeMusliM473
Lowko391
monkeys_forever126
Mew2King98
djWHEAT85
ArmadaUGS82
ZerO(Twitch)16
Organizations
Other Games
gamesdonequick1481
StarCraft: Brood War
lovetv 14
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• iHatsuTV 16
• Adnapsc2 16
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Nemesis3023
• TFBlade914
Upcoming Events
Big Brain Bouts
2h 13m
Fjant vs Bly
Serral vs Shameless
OSC
8h 13m
The PiG Daily
9h 13m
Maru vs Rogue
TBD vs Classic
herO vs Solar
ByuN vs Solar
Replay Cast
10h 13m
CranKy Ducklings
20h 13m
RSL Revival
20h 13m
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
21h 13m
Krystianer vs TriGGeR
Cure vs Rogue
SC Evo League
23h 13m
uThermal 2v2 Circuit
1d 1h
BSL
1d 5h
Artosis vs TerrOr
spx vs StRyKeR
[ Show More ]
Replay Cast
1d 10h
Sparkling Tuna Cup
1d 20h
RSL Revival
1d 20h
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
1d 21h
BSL
2 days
Dewalt vs DragOn
Aether vs Jimin
GSL
2 days
Afreeca Starleague
2 days
Soma vs Leta
Wardi Open
2 days
Monday Night Weeklies
3 days
OSC
3 days
CranKy Ducklings
3 days
Afreeca Starleague
3 days
Light vs Flash
Replay Cast
4 days
Replay Cast
5 days
The PondCast
5 days
Replay Cast
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Proleague 2026-05-05
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
Escore Tournament S2: W6
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 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

Upcoming

KK 2v2 League Season 1
BSL 22 Non-Korean Championship
YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
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
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.