• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 15:45
CEST 21:45
KST 04:45
  • 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 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22[ASL21] Ro16 Preview Pt1: Fresh Flow9
Community News
RSL Revival: Season 5 - Qualifiers and Main Event8Code S Season 1 (2026) - RO12 Results02026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Code S Season 1 (2026) - RO12 Results Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid
Tourneys
RSL Revival: Season 5 - Qualifiers and Main Event GSL Code S Season 1 (2026) SC2 INu's Battles#15 <BO.9 2Matches> WardiTV Spring Cup SEL Masters #6 - Solar vs Classic (SC: Evo)
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 # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Why there arent any 256x256 pro maps? BW General Discussion Pros React To: Leta vs Tulbo (ASL S21, Ro.8)
Tourneys
[ASL21] Ro8 Day 2 [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Daigo vs Menard Best of 10 Dawn of War IV Diablo 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
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
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
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2212 users

The Big Programming Thread - Page 449

Forum Index > General Forum
Post a Reply
Prev 1 447 448 449 450 451 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.
Vorenius
Profile Blog Joined December 2010
Denmark1979 Posts
February 25 2014 09:15 GMT
#8961
On February 25 2014 10:39 darkness wrote:
Show nested quote +
On February 25 2014 06:55 tofucake wrote:
I write sloppy and quick code to get a feature done and then I never refactor it because I've got far too many things to do.


Do you feel confident that your quick code is good or do you just rely on compiler's optimisation?

Also a follow-up question to everyone: which book do you recommend for learning how to write good code? I've come across these 2 "Code Complete" and "Clean Code: A Handbook of Agile Software Craftsmanship". My level is neither beginner nor veteran, so something in between should be preferable.

Two years into computer engineering "Clean Code" taught me so much that I felt had been missing from my classes. After two years of learning about patterns, data structures, algorithms, etc. it felt incredible good to finally learn about how to actually write clean maintainable code. It's by far the book that has helped me the most, but of course that doesn't mean it will do the same to you. In any case, I'd say it's easily worth the money.

By the way, in this context clean code isn't necessarily the same as efficient code. It's about conveying your intention and making it easily understandable to others (including future you), as well as making the code flexible to future updates.
Manit0u
Profile Blog Joined August 2004
Poland17741 Posts
February 25 2014 09:30 GMT
#8962
Code Complete is also awesome. It teaches you good design and talks a lot about stuff you have to consider before you even begin to write your code. Highly recommended.
Time is precious. Waste it wisely.
Days
Profile Joined February 2010
United States219 Posts
February 25 2014 14:56 GMT
#8963
Hey guys. I have a friend studying for his Masters in Economics, and he is trying to build a small simple program that shows the distance between two places like from Miami to Houston. My question is, what is the best way to build a small program that can expand to many cities (3,000 - 5,000). The thing is, we don't have any original data, so we don't want to put in anything manually.
What is the best way to go about this? I know I need a loop of some sort, I was thinking of using PHP and looping through one of the google distance formula sheets that they provide for free. Any suggestions would help, thank you!
We buy things we don't need, with money we don't have, to impress people we don't like.
Zealos
Profile Blog Joined November 2011
United Kingdom3576 Posts
February 25 2014 15:26 GMT
#8964
Hey awesome people. I'm applying for an apprenticeship at a company called Capgemini: http://www.uk.capgemini.com/careers/your-career-path/higher-apprenticeships

Does anyone have any experience with this company or apprenticeship? More importantly, I have little bits of knowledge with Javascript, Python and HTML, but it is very limited, completing some CodeAcademy courses and whatnot. Will this knowledge be enough for any interview or potential apprenticeship, considering that I will hopefully be learning on the job?
On the internet if you disagree with or dislike something you're angry and taking it too seriously. == Join TLMafia !
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-02-25 15:32:23
February 25 2014 15:30 GMT
#8965
On February 25 2014 23:56 Days wrote:
Hey guys. I have a friend studying for his Masters in Economics, and he is trying to build a small simple program that shows the distance between two places like from Miami to Houston. My question is, what is the best way to build a small program that can expand to many cities (3,000 - 5,000). The thing is, we don't have any original data, so we don't want to put in anything manually.
What is the best way to go about this? I know I need a loop of some sort, I was thinking of using PHP and looping through one of the google distance formula sheets that they provide for free. Any suggestions would help, thank you!


Assuming you have the locations, this is in Objective-C:

CLLocationDistance distance = [secondLocation distanceFromLocation:firstLocation];

Locations are of type CLLocation (you need longitude and latitude of your place).

Alternatively: http://stackoverflow.com/a/929781/1091781

Question to others: is an NSMutableDictionary (HashMap in Java) appropriate as a data structure in this case? Maybe even AVL Tree if retrieval is a key?
Days
Profile Joined February 2010
United States219 Posts
February 25 2014 16:12 GMT
#8966
On February 26 2014 00:30 darkness wrote:
Show nested quote +
On February 25 2014 23:56 Days wrote:
Hey guys. I have a friend studying for his Masters in Economics, and he is trying to build a small simple program that shows the distance between two places like from Miami to Houston. My question is, what is the best way to build a small program that can expand to many cities (3,000 - 5,000). The thing is, we don't have any original data, so we don't want to put in anything manually.
What is the best way to go about this? I know I need a loop of some sort, I was thinking of using PHP and looping through one of the google distance formula sheets that they provide for free. Any suggestions would help, thank you!


Assuming you have the locations, this is in Objective-C:

CLLocationDistance distance = [secondLocation distanceFromLocation:firstLocation];

Locations are of type CLLocation (you need longitude and latitude of your place).

Alternatively: http://stackoverflow.com/a/929781/1091781

Question to others: is an NSMutableDictionary (HashMap in Java) appropriate as a data structure in this case? Maybe even AVL Tree if retrieval is a key?


We don't have the locations either, but what I was thinking is downloading a simple .txt file with a list of city names that we can use to loop through, so I don't think the name of locations should be a problem. I heard there is a way to integrate the Google Maps API with PHP, I was wondering if that was a possibility? I've never used Objective-C, I'm only familiar with C# and Visual Basic, not sure how similar they are to objective-c
We buy things we don't need, with money we don't have, to impress people we don't like.
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
February 25 2014 17:21 GMT
#8967
On February 26 2014 01:12 Days wrote:
Show nested quote +
On February 26 2014 00:30 darkness wrote:
On February 25 2014 23:56 Days wrote:
Hey guys. I have a friend studying for his Masters in Economics, and he is trying to build a small simple program that shows the distance between two places like from Miami to Houston. My question is, what is the best way to build a small program that can expand to many cities (3,000 - 5,000). The thing is, we don't have any original data, so we don't want to put in anything manually.
What is the best way to go about this? I know I need a loop of some sort, I was thinking of using PHP and looping through one of the google distance formula sheets that they provide for free. Any suggestions would help, thank you!


Assuming you have the locations, this is in Objective-C:

CLLocationDistance distance = [secondLocation distanceFromLocation:firstLocation];

Locations are of type CLLocation (you need longitude and latitude of your place).

Alternatively: http://stackoverflow.com/a/929781/1091781

Question to others: is an NSMutableDictionary (HashMap in Java) appropriate as a data structure in this case? Maybe even AVL Tree if retrieval is a key?


We don't have the locations either, but what I was thinking is downloading a simple .txt file with a list of city names that we can use to loop through, so I don't think the name of locations should be a problem. I heard there is a way to integrate the Google Maps API with PHP, I was wondering if that was a possibility? I've never used Objective-C, I'm only familiar with C# and Visual Basic, not sure how similar they are to objective-c


I made a similar program for a client early last year when I was just getting into PHP, (made a whopping $80!). I used this PHP Class https://github.com/Quixotix/PHP-ZipCode-Class. It requires a database that has city/zipcode/lat/long data, which can be downloaded off the internet.

I don't have much experience with Google Maps API so I don't know if that is better.
I can only play starcraft when I am shit canned. IPXZERG is a god.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
February 26 2014 00:44 GMT
#8968
On February 26 2014 00:26 Zealos wrote:
Hey awesome people. I'm applying for an apprenticeship at a company called Capgemini: http://www.uk.capgemini.com/careers/your-career-path/higher-apprenticeships

Does anyone have any experience with this company or apprenticeship? More importantly, I have little bits of knowledge with Javascript, Python and HTML, but it is very limited, completing some CodeAcademy courses and whatnot. Will this knowledge be enough for any interview or potential apprenticeship, considering that I will hopefully be learning on the job?


one of their requirements is
"demonstrable passion and capability in software development (e.g. you might have designed a website or a game)"

have you done that? because i believe that is important.
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2014-02-26 02:15:04
February 26 2014 02:13 GMT
#8969
On February 26 2014 01:12 Days wrote:
I heard there is a way to integrate the Google Maps API with PHP, I was wondering if that was a possibility?


https://developers.google.com/maps/documentation/javascript/tutorial

Of note beware of usage caps: https://developers.google.com/maps/documentation/javascript/usage#usage_limits

Not sure it solves your problem of obtaining distances.
Who after all is today speaking about the destruction of the Armenians?
Mr. Wiggles
Profile Blog Joined August 2010
Canada5894 Posts
February 26 2014 03:16 GMT
#8970
If you're not completely set on Google, I'd say to take a look at the OpenStreetMap project.

http://www.openstreetmap.org

I haven't used it personally in a project, but I think I'd probably see how viable it was if I was doing anything with mapping. It seems pretty cool from what I've seen of it.
you gotta dance
dapierow
Profile Blog Joined April 2010
Serbia1316 Posts
February 27 2014 08:39 GMT
#8971
Hey guys, I need some help finding matching words in a specific column of a sql table.

I have 3 columns,

1. The UserID(int)
2. The Word(string)
3. tinyInt(1) 0 if word has no match, 1 if word has a match.

How can can I make my query count the amount of matches that the word column has for each different user.
Eat.Sleep.Starcraft 2
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
Last Edited: 2014-02-27 08:50:32
February 27 2014 08:49 GMT
#8972
On February 27 2014 17:39 dapierow wrote:
Hey guys, I need some help finding matching words in a specific column of a sql table.

I have 3 columns,

1. The UserID(int)
2. The Word(string)
3. tinyInt(1) 0 if word has no match, 1 if word has a match.

How can can I make my query count the amount of matches that the word column has for each different user.

How about this?

SELECT UserId, Word, SUM(tinyInt)
FROM tableName
GROUP BY UserId, Word

This is assuming the same word and userid can show up several times and each time with 1 in tinyInt is a match, otherwise I don't really understand what kind of matches you're looking to count.
Encdalf
Profile Joined February 2012
Germany66 Posts
Last Edited: 2014-02-27 09:52:42
February 27 2014 09:40 GMT
#8973
On February 26 2014 01:12 Days wrote:
Show nested quote +
On February 26 2014 00:30 darkness wrote:
On February 25 2014 23:56 Days wrote:
Hey guys. I have a friend studying for his Masters in Economics, and he is trying to build a small simple program that shows the distance between two places like from Miami to Houston. My question is, what is the best way to build a small program that can expand to many cities (3,000 - 5,000). The thing is, we don't have any original data, so we don't want to put in anything manually.
What is the best way to go about this? I know I need a loop of some sort, I was thinking of using PHP and looping through one of the google distance formula sheets that they provide for free. Any suggestions would help, thank you!


Assuming you have the locations, this is in Objective-C:

CLLocationDistance distance = [secondLocation distanceFromLocation:firstLocation];

Locations are of type CLLocation (you need longitude and latitude of your place).

Alternatively: http://stackoverflow.com/a/929781/1091781

Question to others: is an NSMutableDictionary (HashMap in Java) appropriate as a data structure in this case? Maybe even AVL Tree if retrieval is a key?


We don't have the locations either, but what I was thinking is downloading a simple .txt file with a list of city names that we can use to loop through, so I don't think the name of locations should be a problem. I heard there is a way to integrate the Google Maps API with PHP, I was wondering if that was a possibility? I've never used Objective-C, I'm only familiar with C# and Visual Basic, not sure how similar they are to objective-c



Put your city names in a database, and use a langage of your choice to do a geocodeing call on the google geocoding api (doc https://developers.google.com/maps/documentation/geocoding/). Store the retrieved latitude and longitude and repeat till you got all cities (be aware that there is a 2500 request limit / ip / 24h )

Once you got all the coordinates in a database the distance calculation is simple math and you don't need a maps service for that anymore.

Edit: Unless you want actual road distance. which again would requeire a map service
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
February 27 2014 16:34 GMT
#8974
On February 27 2014 17:39 dapierow wrote:
Hey guys, I need some help finding matching words in a specific column of a sql table.

I have 3 columns,

1. The UserID(int)
2. The Word(string)
3. tinyInt(1) 0 if word has no match, 1 if word has a match.

How can can I make my query count the amount of matches that the word column has for each different user.

In addition to Tobberoth's answer, you can also do this:

SELECT UserID, Count(tinyInt)
FROM Table
WHERE tinyInt = 1
GROUP BY UserID
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
February 27 2014 18:22 GMT
#8975
On February 28 2014 01:34 enigmaticcam wrote:
Show nested quote +
On February 27 2014 17:39 dapierow wrote:
Hey guys, I need some help finding matching words in a specific column of a sql table.

I have 3 columns,

1. The UserID(int)
2. The Word(string)
3. tinyInt(1) 0 if word has no match, 1 if word has a match.

How can can I make my query count the amount of matches that the word column has for each different user.

In addition to Tobberoth's answer, you can also do this:

SELECT UserID, Count(tinyInt)
FROM Table
WHERE tinyInt = 1
GROUP BY UserID

Yeah, this will give you a list of all matches for a user (without the words). Makes sense if the userId and Word combination is unique.
laste
Profile Joined November 2008
Bulgaria242 Posts
February 27 2014 22:46 GMT
#8976
Github is rolling out a code editor:

http://atom.io/
http://code.tutsplus.com/tutorials/check-out-atom-githubs-new-development-editor--net-37030

Seems quite interesting. Has anyone had a chance to use it? (If you have I'd much fancy an invite )

What do you make of it, think it'll dethrone Sublime?
Everybody will be in bronze soon, because Tasteless will have all our ladder points.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
February 27 2014 23:32 GMT
#8977
i'll stick to my vim... :>
conspired against by a confederacy of dunces.
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
February 28 2014 12:32 GMT
#8978
On February 28 2014 08:32 nunez wrote:
i'll stick to my vim... :>

First answer, best answer.
tofucake
Profile Blog Joined October 2009
Hyrule19210 Posts
February 28 2014 13:01 GMT
#8979
There's a vim plugin.
Liquipediaasante sana squash banana
Makavw
Profile Joined April 2010
Croatia165 Posts
Last Edited: 2014-02-28 14:54:25
February 28 2014 14:52 GMT
#8980
Hello I have a problem with a simple Calculator app and I cannot pinpoint the problem.
It works great with int numbers, but whenever i try decimals the results are all over the place.

The calculator works on prinicple that it reads numbers in textbox and converts them to double. And in the end it converts the total back into the string so it can be displaye in textbox.

private void btnPlus_Click(object sender, EventArgs e)
{

total1 = total1 + double.Parse(textBox1.Text);
textBox1.Clear();
}

private void btnResult_Click(object sender, EventArgs e)
{
total2 = total1 + double.Parse(textBox1.Text);
textBox1.Text = total2.ToString();
total1 = 0;
}

Also apart from results beeing wrong when using decmials it never shows any decimals in result no matter what. SO i recon i messed up in converting somewhere?
Prev 1 447 448 449 450 451 1032 Next
Please log in or register to reply.
Live Events Refresh
BSL
19:00
RO16 Group A
eOnzErG vs OyAjiLIVE!
Doodle vs cavapoo
ZZZero.O190
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 257
Ketroc 79
JuggernautJason78
BRAT_OK 60
StarCraft: Brood War
Britney 20904
Calm 3474
Mini 259
ZZZero.O 190
Hyuk 187
Nal_rA 136
ggaemo 123
Dewaltoss 97
Hyun 38
NaDa 10
Dota 2
Gorgc5804
monkeys_forever390
syndereN191
Counter-Strike
fl0m5105
Heroes of the Storm
Khaldor275
MindelVK17
Other Games
Grubby4693
FrodaN943
KnowMe215
ArmadaUGS196
420jenkins191
Hui .98
elazer55
Trikslyr54
QueenE49
Organizations
Other Games
gamesdonequick979
BasetradeTV294
Dota 2
PGL Dota 2 - Main Stream59
StarCraft 2
angryscii 21
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 19 non-featured ]
StarCraft 2
• printf 63
• StrangeGG 5
• LaughNgamezSOOP
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• sooper7s
• Migwel
StarCraft: Brood War
• 80smullet 18
• Michael_bg 14
• RayReign 3
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV584
League of Legends
• imaqtpie1510
• Shiphtur322
Other Games
• tFFMrPink 18
Upcoming Events
Replay Cast
4h 15m
RSL Revival
14h 15m
herO vs TriGGeR
NightMare vs Solar
uThermal 2v2 Circuit
18h 15m
BSL
23h 15m
IPSL
23h 15m
eOnzErG vs TBD
G5 vs Nesh
Patches Events
1d 4h
Replay Cast
1d 13h
Wardi Open
1d 14h
Afreeca Starleague
1d 14h
Jaedong vs Light
Monday Night Weeklies
1d 20h
[ Show More ]
Replay Cast
2 days
Sparkling Tuna Cup
2 days
Afreeca Starleague
2 days
Snow vs Flash
WardiTV Invitational
2 days
GSL
3 days
Classic vs Cure
Maru vs Rogue
GSL
4 days
SHIN vs Zoun
ByuN vs herO
OSC
4 days
Replay Cast
5 days
Escore
5 days
The PondCast
5 days
WardiTV Invitational
5 days
Replay Cast
6 days
CranKy Ducklings
6 days
RSL Revival
6 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
6 days
BSL
6 days
Liquipedia Results

Completed

Escore Tournament S2: W5
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
KK 2v2 League Season 1
Acropolis #4
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
PGL Cluj-Napoca 2026

Upcoming

BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 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.