• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 18:41
CET 00:41
KST 08:41
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)11Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns6[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1822Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises3
StarCraft 2
General
Spontaneous hotkey change zerg Chinese SC2 server to reopen; live all-star event in Hangzhou Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns SC2 All-Star Invitational: Jan 17-18 Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises
Tourneys
$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) WardiTV Winter Cup WardiTV Mondays SC2 AI Tournament 2026 OSC Season 13 World Championship
Strategy
Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 508 Violent Night Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes
Brood War
General
I would like to say something about StarCraft Potential ASL qualifier breakthroughs? BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion StarCraft & BroodWar Campaign Speedrun Quest
Tourneys
[Megathread] Daily Proleagues [BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Simple Questions, Simple Answers Current Meta [G] How to get started on ladder as a new Z player
Other Games
General Games
Awesome Games Done Quick 2026! Mechabellum Beyond All Reason Stormgate/Frost Giant Megathread General RTS Discussion Thread
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Trading/Investing Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
My 2025 Magic: The Gathering…
DARKING
Physical Exercise (HIIT) Bef…
TrAiDoS
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3157 users

The Big Programming Thread - Page 108

Forum Index > General Forum
Post a Reply
Prev 1 106 107 108 109 110 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.
Retgery
Profile Joined August 2010
Canada1229 Posts
Last Edited: 2012-01-18 22:39:32
January 18 2012 22:38 GMT
#2141
Well this we are discussing Vb I might as well jump in and ask for help with my problem.
I'm using the bitBlt function to animate a game, but I'm having trouble getting started. Would I need to have a control array of imgboxes for each array. I figured I would use a timer to move make the movement fluid but I'm wondering if this will work with bitBlt? Any thoughts?
Keep in mind this is only a grade 11 computer science class so don;t make fun of me for using VB
Fall down 7 times, stand up 8.
Pawsom
Profile Blog Joined February 2009
United States928 Posts
January 18 2012 22:45 GMT
#2142
I'm doing some very basic ocket programming for my networks class. However, most of it is to be done in a Linux environment and I don't have one setup at home. I'm thinking I'll likely run a virtual computer, and work in there. Does anyone have any recomendations for software for this, or very basic linux distrubutions they would recomend for the project.
jtype
Profile Blog Joined April 2009
England2167 Posts
Last Edited: 2012-01-19 00:31:13
January 19 2012 00:29 GMT
#2143
I'm trying to learn the basics of programming, starting with some Javascript on Codeacademy, but I'm stuck on one of the exercises at the moment. They have a sort of forum where you can ask questions related to the lessons, but I can't seem to get my code to display properly there, it just keeps cutting my post off. I wonder if anyone might be able to help see what's wrong with it here.

Basically, I'm trying to get the console.log to display which of the numbers between 1-20 are divisible by 3 (calling out "Fizz"), 5 ("Buzz") and both 3 and 5 simultaneously ("FizzBuzz"). This is the link to the lesson itself. Here is the code that I've got so far. The console is just saying "Fizz". Can anyone help me to see what's wrong with it?

+ Show Spoiler +

for (i=1; i<=20; i++) {
}
if ( i%3 === 0 && i%5 === 0 ){
console.log("FizzBuzz");
}
else if ( i%3 === 0 ){
console.log("Fizz");
}
else if ( i%5 === 0 ){
console.log("Buzz");
}
else {
console.log(i);
}
haxorz
Profile Blog Joined June 2009
United States138 Posts
January 19 2012 00:38 GMT
#2144
On January 19 2012 09:29 jtype wrote:
I'm trying to learn the basics of programming, starting with some Javascript on Codeacademy, but I'm stuck on one of the exercises at the moment. They have a sort of forum where you can ask questions related to the lessons, but I can't seem to get my code to display properly there, it just keeps cutting my post off. I wonder if anyone might be able to help see what's wrong with it here.

Basically, I'm trying to get the console.log to display which of the numbers between 1-20 are divisible by 3 (calling out "Fizz"), 5 ("Buzz") and both 3 and 5 simultaneously ("FizzBuzz"). This is the link to the lesson itself. Here is the code that I've got so far. The console is just saying "Fizz". Can anyone help me to see what's wrong with it?

+ Show Spoiler +

for (i=1; i<=20; i++) {
}
if ( i%3 === 0 && i%5 === 0 ){
console.log("FizzBuzz");
}
else if ( i%3 === 0 ){
console.log("Fizz");
}
else if ( i%5 === 0 ){
console.log("Buzz");
}
else {
console.log(i);
}


Your "for" loop is empty - you probably intended all of the "if" statements to be inside of it. As written, the empty "for" loop
runs until "i" is 21. This is why only "Fizz" is being printed to the console.
And theres the GG.
jtype
Profile Blog Joined April 2009
England2167 Posts
January 19 2012 00:43 GMT
#2145
On January 19 2012 09:38 haxorz wrote:
Show nested quote +
On January 19 2012 09:29 jtype wrote:
I'm trying to learn the basics of programming, starting with some Javascript on Codeacademy, but I'm stuck on one of the exercises at the moment. They have a sort of forum where you can ask questions related to the lessons, but I can't seem to get my code to display properly there, it just keeps cutting my post off. I wonder if anyone might be able to help see what's wrong with it here.

Basically, I'm trying to get the console.log to display which of the numbers between 1-20 are divisible by 3 (calling out "Fizz"), 5 ("Buzz") and both 3 and 5 simultaneously ("FizzBuzz"). This is the link to the lesson itself. Here is the code that I've got so far. The console is just saying "Fizz". Can anyone help me to see what's wrong with it?

+ Show Spoiler +

for (i=1; i<=20; i++) {
}
if ( i%3 === 0 && i%5 === 0 ){
console.log("FizzBuzz");
}
else if ( i%3 === 0 ){
console.log("Fizz");
}
else if ( i%5 === 0 ){
console.log("Buzz");
}
else {
console.log(i);
}


Your "for" loop is empty - you probably intended all of the "if" statements to be inside of it. As written, the empty "for" loop
runs until "i" is 21. This is why only "Fizz" is being printed to the console.


Oh wow! Thanks a lot man. I was almost pulling my hair out over that. I knew it had to be something simple, since the statements all seemed to be in their right place. Thanks! :D
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
January 19 2012 00:47 GMT
#2146
On January 19 2012 07:45 Pawsom wrote:
I'm doing some very basic ocket programming for my networks class. However, most of it is to be done in a Linux environment and I don't have one setup at home. I'm thinking I'll likely run a virtual computer, and work in there. Does anyone have any recomendations for software for this, or very basic linux distrubutions they would recomend for the project.


Virtual Box or VMWare

Be aware that you might need to configure your virtual machine network correctly before being able to use sockets properly.
"When the geyser died, a probe came out" - SirJolt
v3locity
Profile Joined July 2011
United States3 Posts
January 19 2012 01:19 GMT
#2147
On January 19 2012 09:47 fabiano wrote:
Show nested quote +
On January 19 2012 07:45 Pawsom wrote:
I'm doing some very basic ocket programming for my networks class. However, most of it is to be done in a Linux environment and I don't have one setup at home. I'm thinking I'll likely run a virtual computer, and work in there. Does anyone have any recomendations for software for this, or very basic linux distrubutions they would recomend for the project.


Virtual Box or VMWare

Be aware that you might need to configure your virtual machine network correctly before being able to use sockets properly.


Yeah, and as for distros I've always liked Fedora/CentOS for developing.
tofucake
Profile Blog Joined October 2009
Hyrule19188 Posts
January 19 2012 01:34 GMT
#2148
On January 19 2012 03:08 Bigpet wrote:
Show nested quote +
On January 18 2012 12:30 Millitron wrote:
Speaking of VB, I had to use it last semester in my database management class.

It was not a good experience. The absolute worst part, was in Visual Basic for Access, it lets you use variables you haven't yet defined, unlike in pretty much any other language where the compiler would bitch at you. Instead of giving you an error, or crashing, it just ignores any statements with undefined variables.


VBA != VB. Syntax may be similar but VBA is interpreted and therefore the compiler doesn't "bitch" because there is no compiler. There are plenty of scripting languages out there that assign default values to undeclared variables.

edit: vba is actually compiled into an intermediate language . But still it just behaves like a scripting language, nothing out of the ordinary.

VB is compiled into byte code. All of it.
Liquipediaasante sana squash banana
Warpath
Profile Joined April 2010
Canada1242 Posts
Last Edited: 2012-01-19 20:12:45
January 19 2012 20:03 GMT
#2149
I was just assigned a project in my XNA programming class. I'm considering working on Multiplayer with Host/Client for a very simple 3D game.
I've looked around but info is limited.. Does anyone know of a good resource or tutorial for setting it up? I've found Lidgren but want to see if there are alternatives before locking in on it.

to be more specific: the requirements of the program is to get 1 or 2 ideas and make a very basic prototype. The 'idea' I'm making is the Multi-player that will function like any FPS.
I want to get the multiplayer working in any way that lets 2 computers communicate (probably via lan direct connection)
whether it does work in host/client or P2P doesn't really bother me.
I'm just looking for resources or tutorials at this point to get me started.
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
January 20 2012 02:08 GMT
#2150
I look at Javascript and I'm like "wat."

https://www.destroyallsoftware.com/talks/wat
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
D4Lorg
Profile Joined January 2010
10 Posts
January 20 2012 03:59 GMT
#2151
hey, today at work ive been thinking, what are each languages respective "bibles".
C is obviously the K&R and
C++ is arguably C++ programming language by stroustrup.
anyone know any others?
maybe "the rails 3 way" for rails and "programming perl" (o'reilly) for perl?
NoSlack
Profile Joined November 2010
United States112 Posts
January 20 2012 04:58 GMT
#2152
Programming PHP and Learning PHP, MySQL, and JavaScript.

These are for PHP of course. The first one is the bible, and the second one puts the trio together as a sort of bible.
tec27
Profile Blog Joined June 2004
United States3702 Posts
January 21 2012 02:26 GMT
#2153
On January 18 2012 14:03 NoSlack wrote:
Show nested quote +
On January 18 2012 10:27 tec27 wrote:
Can you use code tags or put it in a gist next time? Absolutely awful to read as is

Anyway, your code looks fine. For checking a valid email address, most people use regular expressions ( http://www.regular-expressions.info/email.html ).

As an improvement, you should try and separate your content as much as possible from your code. IE: instead of echoing your form, put it outside of the php tags as regular html. Instead of setting error to some html, set error to just the error string, or better yet, an array of error strings and put it in your html like so:

<?php
[ ... your validation code ... ]
?>
<? if(count($errors) > 0) { ?>

<ul class="error">
<? foreach($errors as $error) { ?>
<li><? echo $error; ?></li>
<? } ?>
</ul>

<? } ?>


Thanks for the advice I'll definitely be doing this. This should make the code much easier to read. I have a very OOP mindset, having started with VB, C# mostly, but I haven't grasped the concept of how to apply this to the web. Really, I'd like to have the entire thing be a class, stored in a separate file (that the user can't get to) and just have it spit out the HTML to this php file. I feel like this is overkill though for a PHP page, the OOP (class, object, property, method) mentality doesn't seem to apply as easily yet for me. Does it for you when it comes to PHP? Maybe once my project gets more complicated it will? Also thanks for the link that's a good one to have for sure!


An approach you might want to consider taking is going more MVCish (Model-View-Controller). Essentially you separate all your business logic and data access from the page that gets rendered. So you might have one class that takes in requests and builds a model (this is your controller), then you pass that model along to what amounts to a template file which uses that data to render the page for the user. The template file then stays nice and simple, usually just html, outputting variables, and maybe a few if/else statements, and the controller and model stay focused on their parts as well. Overall it ends up being a much cleaner way to program for the web (usually ). There are some frameworks out there for PHP to do it (not sure what they are, just know they exist ), but it wouldn't be too terribly hard to implement a simple system yourself and you could learn a lot by doing it.
Can you jam with the console cowboys in cyberspace?
iaretehnoob
Profile Joined June 2004
Sweden741 Posts
January 21 2012 09:57 GMT
#2154
On January 20 2012 05:03 Warpath wrote:
I was just assigned a project in my XNA programming class. I'm considering working on Multiplayer with Host/Client for a very simple 3D game.
I've looked around but info is limited.. Does anyone know of a good resource or tutorial for setting it up? I've found Lidgren but want to see if there are alternatives before locking in on it.

to be more specific: the requirements of the program is to get 1 or 2 ideas and make a very basic prototype. The 'idea' I'm making is the Multi-player that will function like any FPS.
I want to get the multiplayer working in any way that lets 2 computers communicate (probably via lan direct connection)
whether it does work in host/client or P2P doesn't really bother me.
I'm just looking for resources or tutorials at this point to get me started.


I've used Lidgren in the past and it should be fine for what you want to do, but I don't remember if I used any tutorial. It should come with some documentation for basic setup etc, right?

Also have a look at the networking built into XNA (http://msdn.microsoft.com/en-us/library/bb975256.aspx), might be the simplest way, if you have the required 2 computers for testing.
klo8
Profile Joined August 2010
Austria1960 Posts
January 21 2012 15:10 GMT
#2155
On January 09 2012 00:20 shannn wrote:
A quick question to the more experienced game programmers or any other experienced programmer.

My iOS game that I'm making right now with Cocos2D has a lot of code. There are a lot of improvements to be done and regarding one of these improvements I'm currently wondering how much does a statement cost in performance or how can I check the performance of my game other than looking at the FPS.

E.g. There is a schedule method called update (how convenient ^^) is called every frame. My current capped framerate is at 30 fps. How big does it affect the game performance if I had like a couple of for leaps and other statements in this schedule method? At first I had a lot of code called in this schedule method and now reduced by 2/3rd compared to before.
My FPS won't drop below 30 right now and when I set the fps cap at 60 it usually runs at 45-55ish fps and almost never at
60.

Does anyone know or know how I can check for these performances? I've searched on the cocos2d forums and other community sites but the threads are old and I don't understand them very well yet Hoping some experienced TL'er could explain it to me in a more beginner way

Use a profiler. It'll show you how much CPU time and memory a certain method uses. I don't know much about iOS development but if Xcode doesn't have a profiler built-in, you should be able to get one as a plug-in.
This post is clearly not a hurr, as you can see from the graph, the durr never intersects with the derp.
tec27
Profile Blog Joined June 2004
United States3702 Posts
January 22 2012 00:07 GMT
#2156
It was bugging me that we couldn't embed Gists here, so I first requested it in Website Feedback, then realized it'd be better to just accomplish that goal in a Greasemonkey script. So I wrote one:

+ Show Spoiler [Script Link or Embed if you have it :)] +

https://gist.github.com/1654534


Should work in both Opera and Chrome. Isn't working in Firefox and I have not a clue why, but I never use Firefox so I can't be arsed to debug it any more than I already have.
Can you jam with the console cowboys in cyberspace?
KaiserJohan
Profile Joined May 2010
Sweden1808 Posts
January 22 2012 00:31 GMT
#2157
On January 20 2012 11:08 MichaelEU wrote:
I look at Javascript and I'm like "wat."

https://www.destroyallsoftware.com/talks/wat


Hahahahahahaha... I've never had to use Javascript and from all the comments and rediculous examples I am quite happy with that.
And the last joke was SUPERB. To bad the guys in the audience were mostly annoying
England will fight to the last American
tofucake
Profile Blog Joined October 2009
Hyrule19188 Posts
January 22 2012 00:40 GMT
#2158
Yeah was a great video
Liquipediaasante sana squash banana
woozie
Profile Joined July 2010
Sweden53 Posts
January 22 2012 04:52 GMT
#2159
I'm currently going through "Head First C#" and I could use a little bit of help from more experienced C# programmers.

It's mainly about bugs or features I'm having trouble with.

In this program called "Reimbursment Calculator" I'm trying to create a program that can (1) calculate how much money should be reimbursed and (2) how many miles you've traveled. I'm having trouble with the second feature.

The program basically consists of two numbericUpDown values that gives the starting mileage and ending mileage. By pressing a button the amount of money that should be reimbursed. A second button should show a message box that displays the total mileage.

private void button1_Click(object sender, EventArgs e)
{
decimal startingMileage = numericUpDown1.Value;
decimal endingMileage = numericUpDown2.Value;
decimal reimburseRate = .39M;

// Make sure that the number in Starting Mileage is smaller than the Ending Mileage field
if (startingMileage > endingMileage)
{
MessageBox.Show("Starting Mileage must be smaller than Ending Mileage!", "Cannot Calculate Mileage");
label4.Text = "N/A";
}
else
{
decimal milesTraveled = endingMileage - startingMileage;
decimal amountOwned = milesTraveled * reimburseRate;

label4.Text = "$" + amountOwned;
}
}

private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(milesTraveled + " miles", "Miles Traveled");
}

The problem is that the IDE complains that "The name 'milesTraveled' does not exist in the current context". This problem occurs in the code of the second button: MessageBox.Show(milesTravaled + " miles", "Miles Traveled"); I don't understand why it says so. How can I fix it?
Herper
Profile Joined January 2011
501 Posts
January 22 2012 05:04 GMT
#2160
On January 20 2012 12:59 D4Lorg wrote:
hey, today at work ive been thinking, what are each languages respective "bibles".
C is obviously the K&R and
C++ is arguably C++ programming language by stroustrup.
anyone know any others?
maybe "the rails 3 way" for rails and "programming perl" (o'reilly) for perl?


Java:
The Java Programming Language by Arnold, Gosling, Holmes
Prev 1 106 107 108 109 110 1032 Next
Please log in or register to reply.
Live Events Refresh
BSL 21
20:00
Non-Korean Championship
ZZZero.O239
LiquipediaDiscussion
IPSL
20:00
Ro4 Set 2
DragOn vs Sziky
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
White-Ra 212
Nathanias 125
JuggernautJason107
UpATreeSC 96
StarCraft: Brood War
Artosis 560
ZZZero.O 239
Sexy 40
NaDa 18
Shine 16
Dota 2
syndereN487
capcasts140
LuMiX1
Counter-Strike
fl0m7826
summit1g4835
Heroes of the Storm
Liquid`Hasu442
Other Games
FrodaN7135
tarik_tv5585
Liquid`RaSZi2871
ToD255
KnowMe167
ArmadaUGS115
Maynarde97
ViBE0
Organizations
Other Games
gamesdonequick5644
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• HeavenSC 46
• Hupsaiya 26
• musti20045 18
• Sammyuel 10
• IndyKCrew
• AfreecaTV YouTube
• intothetv
• Kozan
• sooper7s
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• RayReign 23
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Doublelift5305
Other Games
• imaqtpie2194
Upcoming Events
Replay Cast
9h 19m
Wardi Open
14h 19m
Monday Night Weeklies
17h 19m
WardiTV Invitational
1d 12h
WardiTV Invitational
2 days
The PondCast
3 days
OSC
3 days
OSC
4 days
All Star Teams
5 days
INnoVation vs soO
sOs vs Scarlett
uThermal 2v2 Circuit
5 days
[ Show More ]
All Star Teams
6 days
MMA vs DongRaeGu
Rogue vs Oliveira
Sparkling Tuna Cup
6 days
OSC
6 days
Liquipedia Results

Completed

Proleague 2026-01-10
Big Gabe Cup #3
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL 21 Non-Korean Championship
Proleague 2026-01-11
OSC Championship Season 13
Underdog Cup #3
NA Kuram Kup
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

CSL 2025 WINTER (S19)
Escore Tournament S1: W4
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Rongyi Cup S3
Thunderfire SC2 All-star 2025
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.