|
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. |
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
|
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.
|
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); }
|
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.
|
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
|
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.
|
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.
|
Hyrule18975 Posts
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.
|
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.
|
|
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?
|
|
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.
|
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.
|
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.
|
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 :)] +
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.
|
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
|
Hyrule18975 Posts
Yeah was a great video
|
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?
|
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
|
|
|
|