• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 11:37
CET 17:37
KST 01:37
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3 Tenacious Turtle Tussle
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ Which season is the best in ASL? [ASL20] Ask the mapmakers — Drop your questions BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET [BSL21] RO16 Group C - Saturday 21:00 CET Small VOD Thread 2.0
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread The Perfect Game Path of Exile Should offensive tower rushing be viable in RTS games?
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
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
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1743 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
Poland17493 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
Hyrule19167 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 23m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
LamboSC2 499
Fuzer 309
BRAT_OK 75
gerald23 66
MindelVK 23
StarCraft: Brood War
Calm 3785
Shuttle 1394
Mini 718
EffOrt 458
Rush 244
Larva 214
Light 173
Snow 99
Hyun 98
hero 88
[ Show more ]
JYJ33
Rock 28
ToSsGirL 27
Aegong 20
soO 20
Terrorterran 18
scan(afreeca) 17
Dota 2
Gorgc5326
qojqva4014
singsing2728
Dendi974
syndereN368
Counter-Strike
zeus384
oskar105
kRYSTAL_4
chrisJcsgo1
Other Games
DeMusliM923
hiko777
FrodaN566
Hui .385
Liquid`VortiX118
QueenE92
KnowMe65
nookyyy 44
Trikslyr38
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• poizon28 17
• Adnapsc2 9
• Reevou 7
• Kozan
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• HerbMon 8
• FirePhoenix3
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3148
• WagamamaTV508
League of Legends
• TFBlade1195
Upcoming Events
StarCraft2.fi
23m
Replay Cast
7h 23m
The PondCast
17h 23m
OSC
23h 23m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
1d 7h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
3 days
Sziky vs OyAji
Gypsy vs eOnzErG
[ Show More ]
OSC
3 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
WardiTV 2025
3 days
OSC
3 days
BSL 21
4 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
5 days
Replay Cast
5 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
6 days
StarCraft2.fi
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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 © 2025 TLnet. All Rights Reserved.