• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:11
CEST 06:11
KST 13:11
  • 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
momentary artworks from des…
tankgirl
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 623 users

The Big Programming Thread - Page 303

Forum Index > General Forum
Post a Reply
Prev 1 301 302 303 304 305 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.
Rotodyne
Profile Blog Joined July 2005
United States2263 Posts
Last Edited: 2013-07-09 12:35:48
May 18 2013 06:00 GMT
#6041
Oops its long
+ Show Spoiler +

REDACTED


Comments or thoughts welcome
I can only play starcraft when I am shit canned. IPXZERG is a god.
phar
Profile Joined August 2011
United States1080 Posts
May 18 2013 08:32 GMT
#6042
On May 18 2013 15:00 Rotodyne wrote:
I'm actually insecure about not using best practices and writing incorrect but working code will this feeling go away the more I learn?
Yes and no. You'll get better at it, you'll learn to write proper tests that can give you more confidence in the correctness of your code. But really, when you work with any serious chunk of software, something in there is going to be incorrect. Just hopefully not in some majorly catastrophic way.

On May 18 2013 15:00 Rotodyne wrote:
should I read books / find best practices resources

Yes. In particular if you're learning to code by yourself, you're probably picking up a loooootttt of bad habits. I would:

1) Read up on some fundamentals - algorithms, data structures, basic design principles, etc. Knuth's Art of Computer Programming would not be a bad start (at least the first few volumes).

2) Probably write more tests (and/or better tests).

3) Get other people to read your code and point out what grievous mistakes you're making.

You seem to already have the "get shit done" part more or less down (or at least well on your way). Keep at that.
Who after all is today speaking about the destruction of the Armenians?
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-05-18 18:12:34
May 18 2013 18:07 GMT
#6043
How much does someone in India make as a contractor compared to people in the west?

Wages seem much lower there if I just google it:
http://american-in-delhi.blogspot.com/2009/04/what-does-average-indian-earn.html
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Yoshi-
Profile Joined October 2008
Germany10227 Posts
May 18 2013 18:11 GMT
#6044
Comparing wages between different countries is absolute useless.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
May 18 2013 18:12 GMT
#6045
On May 19 2013 03:11 Yoshi- wrote:
Comparing wages between different countries is absolute useless.

Yeah that's what the article says. Hopefully when contractors go on business trips the company letting them go fields the costs.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Craton
Profile Blog Joined December 2009
United States17247 Posts
Last Edited: 2013-05-18 19:01:11
May 18 2013 18:59 GMT
#6046
There's a large gap even in the U.S. because of the cost of living. You can get paid less, but make more, if you live in a cheap area compared to living in or around a major city. Government employees (or at least certain types) automatically receive more for living in certain places.
twitch.tv/cratonz
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
May 19 2013 00:53 GMT
#6047
I'll most probably have a 'Mobile Computing' module next year (Objective-C & iPhone). However, I'm a Windows user. Is there a cheap way to avoid going to labs, e.g. buying some cheap version of Mac?
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
Last Edited: 2013-05-19 15:16:56
May 19 2013 01:01 GMT
#6048
On May 19 2013 09:53 darkness wrote:
I'll most probably have a 'Mobile Computing' module next year (Objective-C & iPhone). However, I'm a Windows user. Is there a cheap way to avoid going to labs, e.g. buying some cheap version of Mac?

Macbook mini and new computers that support hardware virtualization are your best bet. Some computers can dual boot mac and windows. Others do not. I do not suggest virtual emulation of mac. It's too slow.

I suggest you consider buying a new computer if your current one is old and does not have hardware virtualization. Otherwise you can hold off till the start of semester to do everything.

To clarify: virtual emulation is using something like vmware. It is slow.
Dual booting has no performance issues outside of Mac not doing any internal testing on your hardware.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
uZr
Profile Joined April 2011
20 Posts
May 19 2013 09:31 GMT
#6049
On May 19 2013 09:53 darkness wrote:
I'll most probably have a 'Mobile Computing' module next year (Objective-C & iPhone). However, I'm a Windows user. Is there a cheap way to avoid going to labs, e.g. buying some cheap version of Mac?

Cheapest version is still going to labs ^^

Otherwise you might want to check whether they enabled ssh/vnc or some other form of remote access on those labs computers, because if that's the case you could just log on them remotely and do your stuff while tunneling.
HyunA
Profile Joined July 2010
Romania362 Posts
Last Edited: 2013-05-19 11:44:38
May 19 2013 11:41 GMT
#6050
Hello guys.
I'm in a little bit of a problem. I've been doing the java courses from this site: http://programmingbydoing.com/ and i've hit a dead end on this lesson: http://programmingbydoing.com/a/a-little-quiz.html.

I have no idea how to keep track of the answers, thought i believe i did everything right overall. Tried everything, please help.

EDIT: Source file: http://www48.zippyshare.com/v/9683888/file.html
Yoshi-
Profile Joined October 2008
Germany10227 Posts
May 19 2013 11:46 GMT
#6051
You could just use a new variable and everytime you print "Correct" you increase it by one.
HyunA
Profile Joined July 2010
Romania362 Posts
May 19 2013 11:55 GMT
#6052
On May 19 2013 20:46 Yoshi- wrote:
You could just use a new variable and everytime you print "Correct" you increase it by one.

I have tried something like that, but i couldn't get it to work. An example would be much appreciated.
Yoshi-
Profile Joined October 2008
Germany10227 Posts
May 19 2013 11:58 GMT
#6053
At the start you just need to initiate a variable like this:

int correctAnswers = 0;


And everytime the answer is correct, when you use System.out.println("That's right!"); you just write:

correctAnswers++;


And at the end you just change:
System.out.println("Overall, you got x out of "+ numberofquizes +" ");
to this
System.out.println("Overall, you got " + correctAnswers + " out of "+ numberofquizes +" ");
HyunA
Profile Joined July 2010
Romania362 Posts
May 19 2013 12:04 GMT
#6054
On May 19 2013 20:58 Yoshi- wrote:
At the start you just need to initiate a variable like this:

int correctAnswers = 0;


And everytime the answer is correct, when you use System.out.println("That's right!"); you just write:

correctAnswers++;


And at the end you just change:
System.out.println("Overall, you got x out of "+ numberofquizes +" ");
to this
System.out.println("Overall, you got " + correctAnswers + " out of "+ numberofquizes +" ");

That was so easy, man. Thanks a lot.

I think the creator of those lessons wanted me to keep track of the answers using if, else and else if. Tho i can't see how that i possible since i tried every possible scenario that came to my mind. Weird.
3FFA
Profile Blog Joined February 2010
United States3931 Posts
Last Edited: 2013-05-19 13:58:06
May 19 2013 13:40 GMT
#6055
I've learned quite a bit about Objective C. and have learned how to make some basic iOS apps. Any good online courses I could take to expand my knowledge of what I can actually do with the iOS?

edit: For example, I have made a basic + - * / calculator, a small war-like card game, and a guessing game app in my High School's programming class. I am hoping to take a class to expand upon this knowledge in the Summer.
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
misirlou
Profile Joined June 2010
Portugal3237 Posts
Last Edited: 2013-05-19 16:16:03
May 19 2013 15:34 GMT
#6056
guys some help is appreciated, I need a extra set of eyes to spot some dumb error probably

I need to make a Sieve of Eratosthenes (compute primes). I can run the code with c++ using vector<char> or vector<boolean>.
However I am trying the following c approach for optimization (the point of the work is comparing single core perfomance (with 3 different implementations of the sieve, this is the second, I still need to make the last one, where I optimize cache hits ), multicore with OMP and multicomputer with MPI). I divide Max number needed by 16 because I can hold 8 bits on a char and I only need space for odd numbers (therefore char array size=n/8/2). Im also gonna change malloc to calloc and negate the if's and sets, it spares me the hassle of setting everything to 1.
+ Show Spoiler +
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>

void single2bit(long unsigned int n){
struct timeval start, end;

long dt, seconds, useconds;
unsigned int n2=n/2;
unsigned int mallocsize=(n+1)/16;
char* primos=(char*) calloc( mallocsize,1);

unsigned int i,j;
//printf("%u\n",mallocsize);
unsigned int k=sqrt(n);

gettimeofday(&start, NULL);

for ( i=3;i<k;i+=2)
{
if (!(primos[i/16]&(1<<(i/2)%8))) {

for (j=i*i;j<n;j+=2*i) primos[j/16]|= 1 << ((j/2)%8);

printf("%u\n",i);
}

}
gettimeofday(&end, NULL);

seconds = end.tv_sec - start.tv_sec;
useconds = end.tv_usec - start.tv_usec;

dt = ((seconds) * 1000 + useconds/1000.0) + 0.5;


for (i=3;i<n;i+=2) if (!(primos[i/16]&(1<<(i/2)%8))) printf("%u\n",i);




double flops= n*log(log(n))/dt/1000000;


printf("Single2bits\n\tMFlops: %f\n\tTime: %ld\n",flops,dt);
//free(primos);

}


int main (int argc, char *argv[])
{
long unsigned int n=4294967296;
if (argc>1) n=atoi(argv[1]);
single2bit(n);
}


I am getting segmentation fault for values bigger than 2^27, although I need to be able to compute it for 2^32.

edit: fixed the code
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
May 19 2013 15:56 GMT
#6057
^
test.c:5: warning: integer constant is too large for Б─≤longБ─≥ type
test.c:5: warning: large integer implicitly truncated to unsigned type


This my help you a bit regarding
long unsigned int n=4294967296;
.
misirlou
Profile Joined June 2010
Portugal3237 Posts
May 19 2013 16:13 GMT
#6058
On May 20 2013 00:56 darkness wrote:
^
test.c:5: warning: integer constant is too large for Б─≤longБ─≥ type
test.c:5: warning: large integer implicitly truncated to unsigned type


This my help you a bit regarding
long unsigned int n=4294967296;
.


I had those warning before i changed N to long, its fine for me (it doesnt trunc to 1, like it did before having long), that might be your compiler requiring long long instead of just long (i remember having smt like that while i was still in High school).

I found the problem anyway :p. with all the converting from one aproach to other (removing even numbers, then using bits instead of a whole byte) i forgot to update the acess to the array so instead of i/2 i need to go to i/16. Its odd the error didnt happen when the n was less than 50k, because I had malloc(n/16) at some point before i hardcoded the max number in there. edited the code on my post for future reference.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
May 20 2013 21:22 GMT
#6059
On May 18 2013 03:58 CecilSunkure wrote:
Show nested quote +
On May 18 2013 03:06 enigmaticcam wrote:
Ok, I got a question for you game programmers. It's not so much a game programming question, but a game design question.

I work in the wine industry, and I work for a large wine manufacturer. Us developers in the IT department build business solutions to business problems. None of us really have any actual game development experience. But we have this idea to build and release a mobile wine simulation game. And games of course are a whole different ballpark than business applications.

Any recommendations on how to develop a game, not so much from a programming perspective, but a management perspective? Are there any written guides out there that might get us started?

Book: Rules of Play Game Design Fundamentals. Game design is way out of your area of expertise, so to make anything vaguely decent is going to take a huge amount of studying.

Thanks for the recommendation. Just ordered it on Amazon today
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
May 20 2013 21:33 GMT
#6060
On May 21 2013 06:22 enigmaticcam wrote:
Show nested quote +
On May 18 2013 03:58 CecilSunkure wrote:
On May 18 2013 03:06 enigmaticcam wrote:
Ok, I got a question for you game programmers. It's not so much a game programming question, but a game design question.

I work in the wine industry, and I work for a large wine manufacturer. Us developers in the IT department build business solutions to business problems. None of us really have any actual game development experience. But we have this idea to build and release a mobile wine simulation game. And games of course are a whole different ballpark than business applications.

Any recommendations on how to develop a game, not so much from a programming perspective, but a management perspective? Are there any written guides out there that might get us started?

Book: Rules of Play Game Design Fundamentals. Game design is way out of your area of expertise, so to make anything vaguely decent is going to take a huge amount of studying.

Thanks for the recommendation. Just ordered it on Amazon today

Yeah no problem! Do tell us about how it goes
Prev 1 301 302 303 304 305 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 5h 49m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RuFF_SC2 182
ProTech64
StarCraft: Brood War
GuemChi 1098
Leta 417
MaD[AoV]41
Bale 15
Icarus 9
PianO 6
Dota 2
monkeys_forever822
League of Legends
JimRising 789
Counter-Strike
Stewie2K187
Super Smash Bros
Mew2King188
Other Games
summit1g10031
shahzam811
WinterStarcraft345
Maynarde146
SortOf102
NeuroSwarm60
Organizations
Other Games
gamesdonequick43598
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH314
• practicex 22
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo778
Other Games
• Scarra2790
• Shiphtur361
Upcoming Events
Sparkling Tuna Cup
5h 49m
WardiTV European League
11h 49m
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
19h 49m
The PondCast
1d 5h
WardiTV European League
1d 7h
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
1d 11h
Replay Cast
1d 19h
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...

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.