• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:33
CET 01:33
KST 09:33
  • 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] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (October 19-25): Clem triples first in 5.0.175Evil Geniuses - shutting down20ISSL (IntoTheTV x SOOP SC2 League): Premier6Weekly Cups (October 12-18): 5.0.17 era begins1[$1250] International ShieldBattery League92
StarCraft 2
General
SC2 Power Rank: epic29 No more SC2 streamers on team liquid? Weekly Cups (October 19-25): Clem triples first in 5.0.17 How do you feel about the mass reverts in the 5.0.17 PTR? Evil Geniuses - shutting down
Tourneys
RSL goes to London! 2026 Offline Finals Nov 21-22 ISSL (IntoTheTV x SOOP SC2 League): Premier Stellar Fest TWO the Moon (Dec 16-20) RSL 2026 Offline Finals LCQ Sign-Ups Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
Simple Questions/Answers [G] How to playtest arcade maps [A] Nemrods 1/4 players
External Content
Mutation # 549 Endless Sparkles The PondCast: SC2 News & Results Mutation # 548 Shining Bright Mutation # 547 Temple Of Terror
Brood War
General
Bot on ladder SCHNAIL now supports Remastered Rollback Netcode in Brood War BW General Discussion [Megathread] Daily Funny Videos
Tourneys
[Megathread] Daily Proleagues [Women's StarCraft] MonstarZ vs BA 2026-10-30 Star Con San Diego 2026 Small VOD Thread 2.0
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Mobile Legends: Bang Bang Armies of Exigo - YesYes? General RTS Discussion Thread
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
European Politico-economics QA Mega-thread US Politics Mega-thread R I P Patrick Stewart Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine
Fan Clubs
Reynor Fan Club The Flash Fan Club Serral Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
TeamLiquid Health and Fitness Initiative For 2023 Football (Soccer) Thread MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 10452 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
Poland17865 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
Hyrule19265 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
Replay Cast
08:00
GSL CK 6
CranKy Ducklings37
Liquipedia
OSC
07:00
Masters Cup #151: Group D
davetesta29
Liquipedia
The PiG Daily
05:30
Best Games of SC
herO vs Rogue
GuMiho vs ShoWTimE
Clem vs herO
PiGStarcraft364
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft364
RuFF_SC2 58
SpeCial 52
EmSc Tv 18
StarCraft: Brood War
ProTech167
910 54
LancerX 17
Dota 2
syndereN940
monkeys_forever345
PGG 203
League of Legends
JimRising 699
Counter-Strike
taco 12
Super Smash Bros
hungrybox354
Other Games
summit1g9147
FrodaN1542
XaKoH 246
Maynarde122
JuggernautJason39
C9.Mang018
Organizations
StarCraft 2
WardiTV565
Other Games
gamesdonequick487
BasetradeTV34
StarCraft 2
EmSc Tv 18
EmSc2Tv 18
[ Show 16 non-featured ]
StarCraft 2
• Hupsaiya 127
• EnkiAlexander 36
• musti20045 30
• RyuSc2 24
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• Azhi_Dahaki16
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos4412
• Nemesis3795
• Scarra1320
Upcoming Events
Sparkling Tuna Cup
9h 27m
WardiTV Invitational
11h 27m
Epic.LAN
12h 27m
IPSL
15h 27m
eOnzErG vs McRibbed
LancerX vs StRyKeR
AI Arena Tournament
16h 27m
OSC
1d 13h
Yamato Cup
1d 14h
IPSL
1d 16h
Artosis vs RiceHat
Kyrie vs Sony
Map Test Tournament
1d 22h
WardiTV Weekly
2 days
[ Show More ]
Ultimate Battle
2 days
Rush vs BeSt
Replay Cast
2 days
Rogue vs Classic
Patches Events
3 days
PiGosaur Cup
4 days
Kung Fu Cup
4 days
The PondCast
5 days
KCM Race Survival
5 days
Liquipedia Results

Completed

Proleague 2026-10-30
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
PGL Masters Bucharest 2026
Stake Ranked Episode 5
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
BLAST Open Fall 2026
Esports World Cup 2026

Upcoming

1xBet Invitational
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 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.