• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:07
CEST 03:07
KST 10:07
  • 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
[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Weekly Cups (June 30 - July 6): Classic Doubles2[BSL20] Non-Korean Championship 4x BSL + 4x China9Flash Announces Hiatus From ASL66Weekly Cups (June 23-29): Reynor in world title form?14FEL Cracov 2025 (July 27) - $8000 live event22
StarCraft 2
General
The GOAT ranking of GOAT rankings The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? Weekly Cups (June 30 - July 6): Classic Doubles Program: SC2 / XSplit / OBS Scene Switcher
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL20 Preliminary Maps [ASL19] Finals Recap: Standing Tall SC uni coach streams logging into betting site Flash Announces Hiatus From ASL
Tourneys
[BSL20] Non-Korean Championship 4x BSL + 4x China [BSL20] Grand Finals - Sunday 20:00 CET CSL Xiamen International Invitational The Casual Games of the Week Thread
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Summer Games Done Quick 2025! Russo-Ukrainian War Thread Stop Killing Games - European Citizens Initiative Summer Games Done Quick 2024!
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 706 users

The Big Programming Thread - Page 17

Forum Index > General Forum
Post a Reply
Prev 1 15 16 17 18 19 1031 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.
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
July 21 2010 15:15 GMT
#321
On July 22 2010 00:08 catamorphist wrote:
The express edition is free, and has been free for a long time:

http://www.microsoft.com/express/Downloads/

The usual editions are not free and never have been free.


Do I have to re-download express then, when my trial ends? :X
catamorphist
Profile Joined May 2010
United States297 Posts
July 21 2010 15:20 GMT
#322
On July 22 2010 00:15 Adeny wrote:
Show nested quote +
On July 22 2010 00:08 catamorphist wrote:
The express edition is free, and has been free for a long time:

http://www.microsoft.com/express/Downloads/

The usual editions are not free and never have been free.


Do I have to re-download express then, when my trial ends? :X


Not sure, did you register it?

http://www.microsoft.com/express/support/regins/
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
Last Edited: 2010-07-21 15:27:32
July 21 2010 15:22 GMT
#323
On July 22 2010 00:20 catamorphist wrote:
Show nested quote +
On July 22 2010 00:15 Adeny wrote:
On July 22 2010 00:08 catamorphist wrote:
The express edition is free, and has been free for a long time:

http://www.microsoft.com/express/Downloads/

The usual editions are not free and never have been free.


Do I have to re-download express then, when my trial ends? :X


Not sure, did you register it?

http://www.microsoft.com/express/support/regins/


I would assume so, as the "Obtain a new key online" button sends me directly to their BUY BUY BUY page.

Edit: Actually just forget it, I'll worry about it when the trial expires, if I have to re-download, no biggie. Also 800 posts! And no bans, need to fix that ratio.
catamorphist
Profile Joined May 2010
United States297 Posts
July 21 2010 15:27 GMT
#324
That's bizarre, I know friends who are using Visual C# Express and I know that they have not had any problems. My guess is that if nothing else, redownloading it should be OK.
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
July 21 2010 15:30 GMT
#325
I'm guessing I downloaded the wrong version (Professional), and so the only option to register it is by buying it. I was pretty sure I chose express though. Oh wells.
MadVillain
Profile Joined June 2010
United States402 Posts
Last Edited: 2010-07-21 15:49:39
July 21 2010 15:47 GMT
#326
Hey all,

Could someone recommend a good OOP book, it doesn't have to be in Python (which is the language I'm currently learning) but if it was that would be great.

I've been studying Comp Sci on/off for a couple months now and I love it. I went through a little more than half of Structures and Interpretations of Computer Programs, which is Scheme based. As far as academic texts go I would have say that is the best I've ever read, its a classic.

I've also been practicing my coding/thinking skills with http://projecteuler.net/ and http://www.spoj.pl/
If anyone else has been using those sights post here I would love to talk about them as the problems are getting extremely difficult. It's the actual solution to the problems not the code that is hard, so if you aren't that experienced a coder like me still post.
For The Swarm!
catamorphist
Profile Joined May 2010
United States297 Posts
Last Edited: 2010-07-21 16:12:45
July 21 2010 16:08 GMT
#327
On July 22 2010 00:47 MadVillain wrote:
Hey all,

Could someone recommend a good OOP book, it doesn't have to be in Python (which is the language I'm currently learning) but if it was that would be great.

I've been studying Comp Sci on/off for a couple months now and I love it. I went through a little more than half of Structures and Interpretations of Computer Programs, which is Scheme based. As far as academic texts go I would have say that is the best I've ever read, its a classic.

I've also been practicing my coding/thinking skills with http://projecteuler.net/ and http://www.spoj.pl/
If anyone else has been using those sights post here I would love to talk about them as the problems are getting extremely difficult. It's the actual solution to the problems not the code that is hard, so if you aren't that experienced a coder like me still post.


SICP is a true classic. I came into it with a strong existing background in Scheme and still learned a ton of interesting things from the exercises and digressions.

If you really enjoyed SICP, I strongly suggest you read CTM, which is in the same style, but covers many more interesting ideas from all walks of programming, using several languages (Haskell, Prolog, Erlang, Java, and a language called Oz designed in the book) as scapegoats for different techniques. Unfortunately, it's not free, although you can probably manage to steal a copy. Although it's not focused on OOP, It does spend a fair amount of time discussing OOP, and the time is very well-spent.
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
Craton
Profile Blog Joined December 2009
United States17247 Posts
July 21 2010 18:58 GMT
#328
On July 22 2010 00:30 Adeny wrote:
I'm guessing I downloaded the wrong version (Professional), and so the only option to register it is by buying it. I was pretty sure I chose express though. Oh wells.


Sounds like the culprit. Shouldn't be too hard to just uninstall Professional and install Express, though.
twitch.tv/cratonz
alexpnd
Profile Blog Joined March 2009
Canada1857 Posts
July 22 2010 01:03 GMT
#329
I need help with a PHP/mysql problem. From what I have found it seems to be that POST has default transfer limits? It's effectively nullifying the output to nothing. If it's a small bit of text (in the textarea form field) it works just fine. I doubt its a mysql problem. I hope this is common and can be fixed promptly Also, If I were to fix this on an external host (eg. godaddy) would it be simple?
www.brainyweb.ca //web stuff!
kar1181
Profile Joined May 2010
United Kingdom515 Posts
Last Edited: 2010-07-22 14:15:39
July 22 2010 14:15 GMT
#330
Alexpnd: it's hard to know what the problem is based on such a small description.

But if you create a phpinfo.php file in your webroot and just put a <?php phpinfo(); call in it, you can see what your webserver's php.ini settings are.

The key one is 'post_max_size'. It defaults to 8M on my system, which is enough space to store 8388608 characters. I.e. a lot
alexpnd
Profile Blog Joined March 2009
Canada1857 Posts
Last Edited: 2010-07-22 14:59:16
July 22 2010 14:58 GMT
#331
On July 22 2010 23:15 kar1181 wrote:
Alexpnd: it's hard to know what the problem is based on such a small description.

But if you create a phpinfo.php file in your webroot and just put a <?php phpinfo(); call in it, you can see what your webserver's php.ini settings are.

The key one is 'post_max_size'. It defaults to 8M on my system, which is enough space to store 8388608 characters. I.e. a lot


Thanks I'll take a look.
www.brainyweb.ca //web stuff!
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2010-07-22 16:35:17
July 22 2010 16:34 GMT
#332
On July 21 2010 23:36 Adeny wrote:
Wait what, MSVS 2010 only has a 90 day trial? Then I'm going to have to purchase it for $800? Yeah I don't think so, why's it not free like 2008?

Edit: By the way, someone on another forum made me think about how to optimize a problem similar to Project Euler 1, Find the sum of all the multiples of 3 or 5 below 1000.

This is what I came up with, which gives the right answer (so spoiler alert, i guess), however there's a different problem. It states that it executes in 0 milliseconds, so is there any way to get more precision when measuring execution time? Not that it's something I'll need often, but still.

+ Show Spoiler +


static void Main(string[] args)
{
DateTime startTime = DateTime.Now;
uint[] numbers = { 3, 2, 1, 3, 1, 2, 3 };
uint counter = 3;
uint counter2 = 1;
uint sum = 0;
while (counter < 1000)
{
sum += counter;
counter += numbers[counter2++];
if (counter2 > 6)
counter2 = 0;
}
TimeSpan elapsed = DateTime.Now - startTime;
Console.Out.WriteLine();
Console.Out.WriteLine(sum);
Console.Out.WriteLine("IN: {0}", elapsed.TotalMilliseconds);
Console.In.ReadLine();
}


Just execute the whole thing 1000 times, then divide the time by 1000. The few additional instructions for the loop will be counted too, but they will only make up like 0.1% of the time.

You might also try replacing
counter += numbers[counter2++];
if (counter2 > 6)
counter2 = 0;

with
counter += numbers[counter2++ % 7];

Modulus is usually damn slow, especially with a prime, but it might be faster in this case. As a special bonus it looks cryptic.

With some small changes (in initialization etc.) you could even write something like
sum += counter += numbers[...]

Oneliners on TL can get you banned, in programming they are just cute (and confusing).
If you have a good reason to disagree with the above, please tell me. Thank you.
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
July 22 2010 17:50 GMT
#333
1000x'd it, still 0 MS. I ran it like a million times, and from what I could gather, % 7 was slower, but no results were consistent, oh wells.
catamorphist
Profile Joined May 2010
United States297 Posts
Last Edited: 2010-07-22 21:07:51
July 22 2010 18:21 GMT
#334
- Modulus is pretty fast. If the divisor is a power of two, it reduces to bitwise AND. Otherwise, at worst, it's going to be implemented as something like a % b = a - b * floor(a / b). But you're right that your method should be quite faster than modulus.

- With .NET, the best way to measure runtime is using the System.Diagnostics.Stopwatch class. Example:

var sw = Stopwatch.StartNew();
/* ... */
sw.Stop();

// precision depends on OS and hardware; on my box one tick is
// roughly 0.3 microseconds (corrected)
long ticks = sw.ElapsedTicks;
double ticksPerSecond = 1d / Stopwatch.Frequency;


Spinesheath is right on that you should still run a lot of iterations before measuring any small operation like this, because it's possible that running the code for the first time might not be as fast (JIT overhead, and who knows what else.)

- Finally, although I guarantee it will be measurably slower, the most pleasant way to write this in C# would probably be as a set operation, e.g.:

var nums = Enumerable.Range(1, 1000);
int sum = Enumerable.Union(nums.Where(n => n % 3 == 0),
nums.Where(n => n % 5 == 0)).Sum();
http://us.battle.net/sc2/en/profile/281144/1/catamorphist/
Cratonz
Profile Joined January 2010
United States1 Post
Last Edited: 2010-07-22 20:53:56
July 22 2010 20:52 GMT
#335
On July 23 2010 02:50 Adeny wrote:
1000x'd it, still 0 MS. I ran it like a million times, and from what I could gather, % 7 was slower, but no results were consistent, oh wells.


I'm not surprised, mine completes one answer in 00:00:00.0000427 (42.7 nanoseconds if I calculated right).

You'd need like 100,000 loops to do it that way.
MadVillain
Profile Joined June 2010
United States402 Posts
July 22 2010 20:58 GMT
#336
On July 23 2010 05:52 Cratonz wrote:
Show nested quote +
On July 23 2010 02:50 Adeny wrote:
1000x'd it, still 0 MS. I ran it like a million times, and from what I could gather, % 7 was slower, but no results were consistent, oh wells.


I'm not surprised, mine completes one answer in 00:00:00.0000427 (42.7 nanoseconds if I calculated right).

You'd need like 100,000 loops to do it that way.


That's not nanoseconds, your computer isn't that accurate. .0000427 = 42.7 microseconds, HUGE difference.
For The Swarm!
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
July 22 2010 21:37 GMT
#337
On July 23 2010 03:21 catamorphist wrote:
- Modulus is pretty fast. If the divisor is a power of two, it reduces to bitwise AND. Otherwise, at worst, it's going to be implemented as something like a % b = a - b * floor(a / b). But you're right that your method should be quite faster than modulus.

And there you are dividing with a prime (comparatively slow), multiplying (quite fast), and subtracting (fast). I was just hoping that the compiler had some clever opcodes for low prime modulus. Otherwise modulus is pretty much the slowest basic operator there is. I wasn't surprised that it was slower, but it was easy to test.
The if should take 1 comparision with a constant (fast), 1 short jump for the "else" (fast), and one assignment for the other case (fast). Something like that.

Of course if it's a power of two then modulus is fast. Same for division and multiplication by such a number.
If you have a good reason to disagree with the above, please tell me. Thank you.
tofucake
Profile Blog Joined October 2009
Hyrule19031 Posts
Last Edited: 2010-07-23 14:19:22
July 23 2010 14:19 GMT
#338
The issue is that his code is .Net, so it's not being run directly on the CPU, it's getting realtime compiled to MSIL, which is then interpreted by the VM, so there's significantly more overhead than there would be if you wrote it in C or something. On NIX machines you can just use time . Not to sure about Windows though.
Liquipediaasante sana squash banana
kilaen
Profile Joined July 2010
United States10 Posts
July 23 2010 14:34 GMT
#339
On July 22 2010 00:47 MadVillain wrote:
Hey all,

Could someone recommend a good OOP book, it doesn't have to be in Python (which is the language I'm currently learning) but if it was that would be great.

I've been studying Comp Sci on/off for a couple months now and I love it. I went through a little more than half of Structures and Interpretations of Computer Programs, which is Scheme based. As far as academic texts go I would have say that is the best I've ever read, its a classic.

I've also been practicing my coding/thinking skills with http://projecteuler.net/ and http://www.spoj.pl/
If anyone else has been using those sights post here I would love to talk about them as the problems are getting extremely difficult. It's the actual solution to the problems not the code that is hard, so if you aren't that experienced a coder like me still post.


I always recommend this book.
AssuredVacancy
Profile Blog Joined September 2008
United States1167 Posts
July 23 2010 14:47 GMT
#340
On July 22 2010 10:03 alexpnd wrote:
I need help with a PHP/mysql problem. From what I have found it seems to be that POST has default transfer limits? It's effectively nullifying the output to nothing. If it's a small bit of text (in the textarea form field) it works just fine. I doubt its a mysql problem. I hope this is common and can be fixed promptly Also, If I were to fix this on an external host (eg. godaddy) would it be simple?


Hey alex, I've encountered a problem like this before. What happens is that for a normal form the data transferred has a limit like 500 kb or something like that.
What you want to do is add enctype="multipart/form-data" to your form. This will allow you to upload large amounts of data.
Be careful though, the data transferred will in a different form than your normal post data, I don't know how you get the data in php, but I know in Java you can't just use the traditional way of getting the post parameters.
We spend our youth attaining wealth, and our wealth attaining youth.
Prev 1 15 16 17 18 19 1031 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
Korean StarCraft League #77
CranKy Ducklings119
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft404
Livibee 121
ProTech69
RuFF_SC2 54
Vindicta 14
StarCraft: Brood War
MaD[AoV]35
Bale 30
Icarus 4
Dota 2
monkeys_forever369
NeuroSwarm124
League of Legends
JimRising 609
Counter-Strike
summit1g10964
tarik_tv5375
taco 413
Super Smash Bros
Mew2King137
Other Games
shahzam904
Maynarde150
Day[9].tv122
ToD96
JuggernautJason95
Organizations
Other Games
gamesdonequick49546
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 22 non-featured ]
StarCraft 2
• HeavenSC 26
• davetesta25
• Berry_CruncH23
• Mapu3
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• intothetv
• IndyKCrew
StarCraft: Brood War
• Pr0nogo 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2652
League of Legends
• Jankos1484
• TFBlade562
• Stunt241
Other Games
• Scarra1671
• WagamamaTV189
• Day9tv122
Upcoming Events
Sparkling Tuna Cup
8h 53m
WardiTV European League
14h 53m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
22h 53m
The PondCast
1d 8h
WardiTV European League
1d 10h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 14h
Replay Cast
1d 22h
RSL Revival
2 days
ByuN vs SHIN
Clem vs Reynor
Replay Cast
2 days
RSL Revival
3 days
Classic vs Cure
[ Show More ]
FEL
3 days
RSL Revival
4 days
FEL
4 days
FEL
4 days
CSO Cup
4 days
BSL20 Non-Korean Champi…
4 days
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
Sparkling Tuna Cup
5 days
RSL Revival
5 days
FEL
5 days
BSL20 Non-Korean Champi…
5 days
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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...

Disclosure: This page contains affiliate marketing links that support TLnet.

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.