• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 06:39
CEST 12:39
KST 19:39
  • 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
Team TLMC #5: Vote to Decide Ladder Maps!0[ASL20] Ro8 Preview Pt1: Mile High14Team TLMC #5 - Finalists & Open Tournaments2[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon10
Community News
Weekly Cups (Sept 15-21): herO Goes For Four1StarCraft II 5.0.15 PTR Patch Notes201BSL 2025 Warsaw LAN + Legends Showmatch3Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1
StarCraft 2
General
Question about resolution & DPI settings SC2 StarCraft II 5.0.15 PTR Patch Notes Weekly Cups (Sept 15-21): herO Goes For Four Why Storm Should NOT Be Nerfed – A Core Part of Pr Team TLMC #5: Vote to Decide Ladder Maps!
Tourneys
RSL: Revival, a new crowdfunded tournament series SC2's Safe House 2 - October 18 & 19 Stellar Fest KSL Week 80 StarCraft Evolution League (SC Evo Biweekly)
Strategy
Custom Maps
External Content
Mutation # 492 Get Out More Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense
Brood War
General
Old rep packs of BW legends BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion [ASL20] Ro8 Preview Pt1: Mile High ASL ro8 Upper Bracket HYPE VIDEO
Tourneys
[ASL20] Ro8 Day 1 BSL 2025 Warsaw LAN + Legends Showmatch SC4ALL $1,500 Open Bracket LAN [ASL20] Ro16 Group D
Strategy
Simple Questions, Simple Answers Muta micro map competition
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Borderlands 3 General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
Community
General
US Politics Mega-thread The Big Programming Thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
Why can't Americans stop ea…
Peanutsc
Too Many LANs? Tournament Ov…
TrAiDoS
I <=> 9
KrillinFromwales
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2018 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
Hyrule19091 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 States3701 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 States3701 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
Hyrule19091 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
Afreeca Starleague
10:00
Ro8 Match 1
Barracks vs Mini
Afreeca ASL 13843
sctven
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Creator 69
Rex 42
Harstem 34
StarCraft: Brood War
Calm 10567
Sea 5657
Bisu 5468
Rain 4808
Flash 4248
BeSt 1243
Hyuk 496
Pusan 367
zelot 262
ZerO 246
[ Show more ]
Zeus 200
Light 179
Backho 126
ggaemo 103
Dewaltoss 85
ToSsGirL 56
Sharp 51
Aegong 45
Mong 45
ivOry 25
Shine 24
soO 24
sorry 23
ajuk12(nOOB) 22
Sacsri 19
Terrorterran 11
Sexy 11
Noble 9
Bale 9
Hm[arnc] 6
Dota 2
Dendi385
boxi98273
XcaliburYe224
Counter-Strike
shoxiejesuss612
x6flipin481
zeus121
edward32
Heroes of the Storm
Khaldor153
Other Games
singsing1420
Pyrionflax371
crisheroes265
NeuroSwarm61
Organizations
StarCraft: Brood War
UltimateBattle 289
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• LUISG 48
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt567
• Jankos537
Other Games
• WagamamaTV91
Upcoming Events
Wardi Open
21m
Rex46
Monday Night Weeklies
5h 21m
Sparkling Tuna Cup
23h 21m
Afreeca Starleague
23h 21m
Snow vs EffOrt
Wardi Open
1d
PiGosaur Monday
1d 13h
LiuLi Cup
2 days
The PondCast
2 days
CranKy Ducklings
3 days
Maestros of the Game
5 days
Serral vs herO
Clem vs Reynor
[ Show More ]
[BSL 2025] Weekly
5 days
[BSL 2025] Weekly
5 days
BSL Team Wars
6 days
Liquipedia Results

Completed

2025 Chongqing Offline CUP
RSL Revival: Season 2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
Maestros of the Game
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

Upcoming

IPSL Winter 2025-26
SC4ALL: Brood War
BSL 21 Team A
BSL Season 21
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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.