• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:44
CEST 16:44
KST 23:44
  • 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
Official StarCraft website teases new content ahead of BlizzCon?76Stellar Fest TWO the Moon (Dec 16-20)9Weekly Cups (August 24-30): Patches' balance mod takes over3New 3v3 BGH Ladder (and more) on ShieldBattery!40Weekly Cups (August 17-23): Zerg dominate the week6
StarCraft 2
General
Nexon wins bid to develop StarCraft IP content, distribute Overwatch mobile game SC4ALL: II Winner Will Earn a Spot at HSC 30! Weekly Cups (August 24-30): Patches' balance mod takes over Balance hotfix patch 5.0.16b (July 16) September World Ranking: herO leads, Serral climbs
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) IntoTheTV X SOOP SC2 League : Weekly & Monthly SC2 INu's Battles#20 [BO.9] 2026 GSTL Announcement 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
ASL22 General Discussion Gypsy to Korea Official StarCraft website teases new content ahead of BlizzCon? [Personal Project Share] Terran Defense v0.60 BW General Discussion
Tourneys
KCM Race Survival 2026 Season 3 Brood War in Budapest ! WORTEX 2026 BW Finals [Megathread] Daily Proleagues BSL LAN Party - Kraków 29-30 August - OPEN SIGNUPS
Strategy
Odyssey Mineral Stack Saturation Replay Review Process - What do you do? Game Theory for Starcraft Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Diablo IV EVE Corporation [Maplestory Hardcore] Let's Play~!! General RTS Discussion Thread
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 Artificial Intelligence Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread UK Politics 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
Dreaming of BW patches (mod…
c3rberUs
Regacy Esports: The Bh…
regacyesports
Violent Games and Crime Rate…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Customize Sidebar...

Website Feedback

Closed Threads



Active: 7666 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
Poland17838 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
Hyrule19252 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
Next event in 19h 17m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SHIN 228
StarCraft: Brood War
Britney 57123
Calm 6390
Shuttle 4430
actioN 893
Horang2 631
Hyuk 606
Mini 321
firebathero 225
hero 160
Mong 136
[ Show more ]
Sexy 101
Hyun 101
Last 77
910 77
Barracks 55
Bonyth 53
Aegong 33
Yoon 29
sSak 28
Sharp 21
Free 18
HiyA 15
SilentControl 13
scan(afreeca) 11
LancerX 11
ajuk12(nOOB) 9
Rock 9
Terrorterran 1
Dota 2
Gorgc4334
qojqva2554
420jenkins249
LuMiX2
Counter-Strike
fl0m3444
byalli983
SPUNJ326
dupreeh174
Super Smash Bros
Mew2King120
Heroes of the Storm
Khaldor305
Liquid`Hasu204
Other Games
B2W.Neo960
singsing795
Beastyqt413
RotterdaM291
Mlord209
Liquid`VortiX117
KnowMe111
QueenE27
Organizations
Other Games
EGCTV614
StarCraft: Brood War
lovetv 10
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
• mYiSmile10
StarCraft: Brood War
• Michael_bg 9
• FT.aCt)Sony3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV583
League of Legends
• Jankos1699
Upcoming Events
Sparkling Tuna Cup
19h 17m
OSC
21h 17m
Shopify Rebellion Sundays
1d
Mixu vs TBD
Spirit vs TBD
Clem vs TBD
Patches Events
1d 1h
OSC
1d 9h
Afreeca Starleague
1d 19h
Soma vs Shuttle
BeSt vs Rush
WardiTV Weekly
1d 20h
Monday Night Weeklies
2 days
Afreeca Starleague
2 days
Leta vs ggaemo
Jaedong vs Queen
GSL
2 days
[ Show More ]
PiGosaur Cup
3 days
Kung Fu Cup
3 days
Replay Cast
4 days
The PondCast
4 days
KCM Race Survival
4 days
Escore
5 days
IntoTheTV X SOOP
5 days
CranKy Ducklings
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)
Acropolis #5
Acropolis #5 - TRS
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

Upcoming

Escore Tournament S3: King of Kings
Blizzard Classic Cup 2026
Acropolis #5 - GSA
Acropolis #5 - GSB
Acropolis #5 - GSC
SC4ALL II: Brood War
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.