• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Interesting. Haven't updated Xcode a couple of months at this point, seems gross!

Yeah. Kinda annoyed it got updated when I updated to 10.8.2. Bleh.

At least it got me off my ass and made me learn to use the vi editor and become proficient at it real fucking quick, so I guess it's all not a loss.
 

wolfmat

Confirmed Asshole
Yeah. Kinda annoyed it got updated when I updated to 10.8.2. Bleh.

At least it got me off my ass and made me learn to use the vi editor and become proficient at it real fucking quick, so I guess it's all not a loss.

vim kicks ass. It's a fact.

But Xcode is actually alright if you need something that generates stuff for you, like projects with appropriate build settings, certificate-based code, UI elements with event skeletons and shit. I actually like it very much in that regard.
 
Right anything that is divisible by two numbers is divisible by their product as far as I can recall. Been a while though, haha

So if something is divisble by 5 and 6 it is also divisble by 5 * 6.
This isn't always true. The two numbers have to be relatively prime for this to hold (elementary number theory yo).
 

Slavik81

Member
This isn't always true. The two numbers have to be relatively prime for this to hold (elementary number theory yo).
To be clear, you mean that the least common multiple can sometimes be less than the product of the two numbers. For example, for 4 and 6, the least common multiple is 12.

Of course, the product of the two number is always divisible by both of them... It's just not always the least common multiple.

I was a bit confused when I first read your post.
 
To be clear, you mean that the least common multiple can sometimes be less than the product of the two numbers. For example, for 4 and 6, the least common multiple is 12.

Of course, the product of the two number is always divisible by both of them... It's just not always the least common multiple.

I was a bit confused when I first read your post.

His assertion was that if a number is divisible by both 5 and 6, it is also divisible by 30.
This is a factually true statement, but this need not be true in general.

For instance, 6 is divisible by 6 and 3, but it most certainly isn't divisible by 18.

Basically:
a|n, b|n, (a,b)=1 => ab|n
but a|n and b|n is a necessary but not sufficient condition for ab|n.

This can be generalized to a mutually prime set of numbers dividing n as well.
 

hateradio

The Most Dangerous Yes Man
When asked for code samples, what do you guys usually submit?

I don't really have a github, or anything to create to put in one.
 

Lkr

Member
basically i have to write bitwise functions without using the built in operators. so i have to write the function myself. for left shift, i need to move over an 8 bit pattern to the amount of spaces of an integer. i have no idea what to do here, any idea?
 

tuffy

Member
basically i have to write bitwise functions without using the built in operators. so i have to write the function myself. for left shift, i need to move over an 8 bit pattern to the amount of spaces of an integer. i have no idea what to do here, any idea?
You can think of bit shifts as multiplication and division by powers of 2. For example:

3 << 1 == 3 * 2 ^ 1
 

VoxPop

Member
If I wanted to create a website, make it look nice and not use flash, where should I start? I am almost a complete noob when it comes to this stuff.
 
If I wanted to create a website, make it look nice and not use flash, where should I start? I am almost a complete noob when it comes to this stuff.

Flash? Isn't that for media players?

Start with the basics though. HTML and CSS. Then Javascript, theres a bunch of scripts out there that are ready to use to make a website look better. And don't use w3schools.

EDIT: Oh, flash.... Yeah, I don't think anyone really uses that for web design anymore.
 
If I wanted to create a website, make it look nice and not use flash, where should I start? I am almost a complete noob when it comes to this stuff.

It depends on if your goal is to create a site for a specific purpose or if you want to learn about web development. If you just want to create a site and forget about it, something like Concrete or WordPress is a good place to start. If you want to learn properly I can go hunt down some more involved resources to get you started.

Oh yeah, and if you are interested in learning web development properly, just never use flash, that's one other problem solved.
 

hateradio

The Most Dangerous Yes Man
Any Ruby users here? I've been interested in learning it and Rails for some time.

I recently looked at several sites for beginners, and even looked at the PDF that came with the install, The Book Of Ruby. After a bit of an intro, it seems great and easy to use -- I like Ruby's OO and Rails' MVC approaches. Ideally, I would continue to learn and use it, and create or port a website.

What are the prospects of Ruby in the next few years and how much is it used?
 

Lucario

Member
I'm in a rough spot, programming-GAF.


I used to think I was a boss at programming. The "information technology and computer studies" classes I took as a child in middle school naturally led me to meddle with some scripting languages. I eventually moved onto DarkBasic and VB6.

As no high school near me had anything close to a programming course, I decided to take one every semester at the local community college. Tested out of all of the "intro to programming" courses, did their only C++ course and ended up taking Java III at the end of my community college career with the best grades of my life. I thought I was god.

Got accepted to WPI, and I could not pass their intro to programming course. Like a petulant child, I blamed it on the language, assuming it was utterly ridiculous to force students into Ratchet after years of object-oriented programming.

The first C course went okay at first, but after just one week into 7-week course, I noticed something odd about the project.

It was my final from community college.

One week at WPI was apparently equivalent to 14 weeks of Community College.

I continued to be a moron and assume this was all due to the course being taught out of order; I barely passed the course, having to do 40+ hours of work on my final projects after the term had ended.

And worst of all, I learned absolutely nothing from it. The CS program at this school is fantastic, but the basic courses in every programming language are usually occupied by 70+ students. Getting individual attention during lab time simply doesn't happen.

I did manage to pass a basic algorithms course, but after failing Algorithms II and Systems Programming in C, I'm now on academic leave to "get my shit together." (Technically I left for unrelated depression, but now that I'm medicated I'm beginning to realize how fucked I am.)

Most free online tutorials aren't taught in similar methods to WPI (and the only C course I attempted since my recent departure ended up covering about half the material in my intro course), and so many languages and styles of programming are covered I can't even figure out where to start. If I were to re-take my C course, it is extremely likely that I would have to spend a fifth year at the school, which I could not afford.

Is there a recommendation a programmer in here could give me, or perhaps a WPI graduate? I'm freaking out. Starting up another online C tutorial now (probably the one linked to in the first post in the thread,) and I'm seriously hoping it'll cover enough material to get me through this course.
 
Yeah, the differences in workloads are glaring. I remember that the usual thesis topics at my brother's college were just machine problems we had to do in a week or so. They're basic stuff like inventory systems.
 

Lucario

Member
Yeah, the differences in workloads are glaring. I remember that the usual thesis topics at my brother's college were just machine problems we had to do in a week or so. They're basic stuff like inventory systems.

My friend at UMass Amherst is in his Senior year and he's still learning things covered in some of my freshman programming courses.

And I'm pretty sure companies recognize UMass more than my tiny college.
 
Working on pre-production (data management, site flow, etc) on a fairly complex piece of web software, and I have to decide on a web programming paradigm.
Essentially I need to decide whether or not to use a MVC type system for organizing my code.
I'll be using:
- Linux Apache Server
- PHP + MySQL for page generation
- HTML + CSS (duh) for layout and design
- JavaScript for most actual functionality.

I'd say that about 80% of the code will be PHP, so I want to use a system that will be easy to add functionality/features to.
 

wolfmat

Confirmed Asshole
Any Ruby users here? I've been interested in learning it and Rails for some time.
Yo

I recently looked at several sites for beginners, and even looked at the PDF that came with the install, The Book Of Ruby. After a bit of an intro, it seems great and easy to use -- I like Ruby's OO and Rails' MVC approaches. Ideally, I would continue to learn and use it, and create or port a website.

What are the prospects of Ruby in the next few years and how much is it used?

It's being used a lot because Rails exists. It has good prospects because Rails exists. Ruby is pretty much stable at this point. Everything you could hold against it doesn't play much of a role in practice, which is cool. Sorta like Lua in that regard. As opposed to Haskell. Lol.

The whole point of Rails in particular is that people do the same things on websites anyway (DB + MVC + test automation + skeleton-driven development + templates + SASS + jQuery et al, blah), so they said "alright, let's make this the way to build sites with Rails, and just assume all the time things are built that way unless the guy overwrites stuff". So you generate your basic thing, and go from there, adhering to the way things should be, leaving out the things that Rails does for you, and you end up with a productivity boost. The in-code consequence being that, for example, model-mapping to the database is transparent with all sorts of DBMSes, template languages are trivially interchangeable, there are a lot of modules out there to do magic things without you knowing how they operate, all that.

HOWEVER. Make sure you're good with Ruby concepts. Make sure you've built an exemplary shop thing with Rails so that you know what's up on all fronts. Before that, don't assume you can just dive into a project like that, because if you haven't touched all of those inherent assumptions, you'll scratch your head all the time saying, "how does that actually work?", which doesn't help at all in terms of getting from A to B as fast as possible.

I would recommend this site to get into things, along with the standard docs you seem to have already found: http://railscasts.com/
Pretty good stuff.

Edit: Can't actually recommend anything regarding learning Ruby itself, but.. O'Reilly surely has a book you could read. It's a programming language that's not hellish to learn; you need the basic concepts, and a lot of hands-on time, to be comfortable. You've already seen a couple of languages, so you'll be okay.
 

neocoder

Banned
What's WPI?

Google is your friend for acronyms. Worcester Polytechnic Institute


On a separate topic, has anyone tried building curl/gcc on a HPUX IA64 platform? Wow, it's never easy and poorly documented. I gave up and ended using pre-built curl binaries. I was able to build them on solaris & aix after a lot of struggle. Linux was much easier.
 

hateradio

The Most Dangerous Yes Man
Working on pre-production (data management, site flow, etc) on a fairly complex piece of web software, and I have to decide on a web programming paradigm.
Essentially I need to decide whether or not to use a MVC type system for organizing my code.
I'll be using:
- Linux Apache Server
- PHP + MySQL for page generation
- HTML + CSS (duh) for layout and design
- JavaScript for most actual functionality.

I'd say that about 80% of the code will be PHP, so I want to use a system that will be easy to add functionality/features to.
Go for MVC. It'll be a better product in the end. Do you have experience with it?

If you haven't used a framework, you should try CodeIgniter (since it seems to be the most easy to get into). I believe it uses ActiveRecord for the DB, but you can incorporate Doctrine ORM if you wish.

Yo

. . . Lots of stuff . . .
Ruby seems very straight forward from what I was reading. I absolutely adore that it's all OO.

I think Rails may take me a bit longer to fully understand, but that's to be expected.
 

Hari Seldon

Member
I need to educate myself on the concepts behind threading. More so in C or C++, but I need a general background of the concepts using the terms such as semaphore and whatnot. Can someone recommend a decent book on this topic? Amazon doesn't seem to be producing much. And it looks like threading in straight C is extremely low level.
 

Toby

Member
This is a little outside the realm of coding, but I figure this is a good place to ask. Is anyone here familiar with and good at solving recurrences?
I'm a little confused as to what the resulting recurrence would be for an algorithm, and could use some help. Thanks.
 

usea

Member
I need to educate myself on the concepts behind threading. More so in C or C++, but I need a general background of the concepts using the terms such as semaphore and whatnot. Can someone recommend a decent book on this topic? Amazon doesn't seem to be producing much. And it looks like threading in straight C is extremely low level.
I can't recommend a book, but honestly I think wikipedia is pretty good. I guess other things you need to learn about are other sorts of synchronization constructs like Monitor, Lock, Mutex, etc? Also terms like race condition, dead lock, etc? I learned most of this stuff on this awesome site http://www.albahari.com/threading/ but it's for .net. Still, doing all that stuff in .net really helped me understand concurrent and parallel programming in general. I don't have any specific recommendations for a C or C++ approach.

This is a little outside the realm of coding, but I figure this is a good place to ask. Is anyone here familiar with and good at solving recurrences?
I'm a little confused as to what the resulting recurrence would be for an algorithm, and could use some help. Thanks.
I am super bad at this. I can tell you the running time usually, but recurrence relations were so confusing to me in school. Looking at wikipedia they don't seem that bad, but I'm probably underestimating them.
 

Toby

Member
I am super bad at this. I can tell you the running time usually, but recurrence relations were so confusing to me in school. Looking at wikipedia they don't seem that bad, but I'm probably underestimating them.
Thanks for replying man. I was able to catch my instructor on an off day, though, and cleared things up.
 

Slavik81

Member
I need to educate myself on the concepts behind threading. More so in C or C++, but I need a general background of the concepts using the terms such as semaphore and whatnot. Can someone recommend a decent book on this topic? Amazon doesn't seem to be producing much. And it looks like threading in straight C is extremely low level.
This was the textbook we used on the subject when I was in school, though I had the 7th edition. I thought it was quite well written.

The older version is better solely due to having cuter dinosaurs on the cover.
 
Go for MVC. It'll be a better product in the end. Do you have experience with it?

If you haven't used a framework, you should try CodeIgniter (since it seems to be the most easy to get into). I believe it uses ActiveRecord for the DB, but you can incorporate Doctrine ORM if you wish.
I have very minimal experience with CakePHP (I didn't like it). Might give CodeIgniter a go. I wouldn't want to write an MVC site from scratch...
 

Tantalus

Neo Member
Might I throw in a suggestion to check out the Yii or Kohana frameworks? I had a fun time working with both of those. The main downside is that neither are particularly well documented, but both are excellent MVC frameworks that are fairly easy to use but have a lot of powerful features
 

leroidys

Member
Fuck I have to learn Java, C, assmebly, and MySQL this quarter.

Do you guys have any specific tips for learning new languages (quickly)?
 

Mondriaan

Member
Fuck I have to learn Java, C, assmebly, and MySQL this quarter.

Do you guys have any specific tips for learning new languages (quickly)?
Write lots of code.

Type out everything from memory after checking a reference and don't copy/paste or cut/paste anything.
 

Darias

Member
The first three are all accomplishing the same task, albeit differently. Focus on how things are working, and why they work that way. The similarities will help you learn the concepts - after that it's basically just diction.

A good comp arch class will teach java/c and assembly concurrently, so you can understand how one is the other.

Mine taught assembly through most of the semester, then we wrote an assembler in java. It was good stuff.
 

Kalnos

Banned
@leroidys

Quite a class variety you have. Guessing:

OOP class - Java (maybe SQL)
Embedded Systems / Microcontrollers - Assembly/C
Databases - SQL

The best way to learn any programming language is by sitting down and writing code. You can only learn so much from books and lectures.
 

hateradio

The Most Dangerous Yes Man
I have very minimal experience with CakePHP (I didn't like it). Might give CodeIgniter a go. I wouldn't want to write an MVC site from scratch...
I don't really like CakePHP; it seems like overkill. CI should be fine because it's actually light-weight (especially compared to Cake) and provides you with all the basics, plus things like Forms and Validation.
 

Seanbob11

Member
Hey guys. I just started Java the semester. I know I'm probably doing something silly but I can't figure out what's wrong. please help :(

Code:
static void oneLine(String name, String region,
               int area, long pop, long gdp)
{
       int lengthname = name.length();
       int lengthregion = region.length();
  if (name.length().equals(region.length()))
  {
    System.out.println(name+" "+region);
  }
}

There are arrays of Countries and the region that they're in. I'm trying to display the countries that match. Ignore the fact it needs a loop, help...please :(
 

Kalnos

Banned
Are you trying to display countries that are in the same region? It's a bit unclear what you want.

Write out what you want and the steps before you start coding. You aren't even using the lengthname and lengthregion integers that you're setting.
 

IceCold

Member
I'm not sure what your function is supposed to do but your if statement is wrong since length() returns an int and equals() can only be used to compare objects and not primitive type (== is used).
 

Seanbob11

Member
I'm sure what your function is supposed to do but your if statement is wrong since length() returns an int and equals() can only be used to compare objects and not primitive type (== is used).

Thanks. This is exactly what I needed.

Are you trying to display countries that are in the same region? It's a bit unclear what you want.

Write out what you want and the steps before you start coding. You aren't even using the lengthname and lengthregion integers that you're setting.

Yeah sorry that's the wrong code I posted. I didn't know equals() can't compare primitive types. I am a fool. Thanks guys!
 
Okay, so I'm looking to start learning programming which has been a daunting goal of mine that I've put off for a long time. I kinda want to apply for Mathematics and Computer Science at University but I have not a lot of prior experience with CompSci/programming in general (I'm big into math academically and generally succeed at it and that's all I need to apply for the course) - it's just something that really fascinates me and engages me and I'd love to study it. Has anyone got any suggestions as to what could start me off with what I need to know? What language to start with? Any help would be appreciated. I read the OP but I figure there might be some better advice from asking people directly.
 

Linkhero1

Member
I want to improve my programming skills because they suck. Can someone give me a few programming ideas that would help me improve my skills? Also what steps should I take to tackle a programming task?
 
Okay, so I'm looking to start learning programming which has been a daunting goal of mine that I've put off for a long time. I kinda want to apply for Mathematics and Computer Science at University but I have not a lot of prior experience with CompSci/programming in general (I'm big into math academically and generally succeed at it and that's all I need to apply for the course) - it's just something that really fascinates me and engages me and I'd love to study it. Has anyone got any suggestions as to what could start me off with what I need to know? What language to start with? Any help would be appreciated. I read the OP but I figure there might be some better advice from asking people directly.

First off, don't worry about having programming experience going into a degree in CS. It would be nice, but I didn't have any and I'm getting along fine 2 years later. Most all intro CS courses go over programming fundamentals before delving deep into the actual theoretical and mathematical stuff.

If you want to start now, I'd probably look at Python to get a feel for how things work. If you want to have fun, you could start out with C/C++, both are fairly unforgiving, but they tend to be more 'lower level' high level languages. They are both extremely flexible, but will allow you to shoot your foot off, or so they say.

I personally went into the major kind of knowing what I was getting into, but I had no programming experience whatsoever, and I've been fine with picking things up and understanding them.
 

Lathentar

Looking for Pants
I want to improve my programming skills because they suck. Can someone give me a few programming ideas that would help me improve my skills? Also what steps should I take to tackle a programming task?

Come up with a small project and do it. If you had problems ask here or read about how to solve certain things. Then you can take a module of that project (or the entire project) and rewrite it to be better. Better could be clearer, more performance or just easier to extend. You need to learn how to look at a problem, be able to come up with ideas on how to solve the problem, be able to figure out how to evaluate your solutions to pick an appropriate one. Those are extremely important skills to learn.

It's difficult to give you specific tasks without knowing your current skill level.
 

wolfmat

Confirmed Asshole
I want to improve my programming skills because they suck. Can someone give me a few programming ideas that would help me improve my skills?
Write one of these:
— Pac-Man
— Tetris
— … and so on …
— Dialogue simulation
— Pick a website with a REST API and use it to monitor changes of stuff, visualize
— 2D Minecraft clone with 3 materials and 2 items because that should suffice to get it
— Network chat system
— Webserver
Also what steps should I take to tackle a programming task?
Design, implement, refine. Keep iterations small because you're one person. Either start from the bottom or from the top, but don't do both at the same time. Be sure about what you want to achieve before typing stuff.
 

Osiris

I permanently banned my 6 year old daughter from using the PS4 for mistakenly sending grief reports as it's too hard to watch or talk to her
&#8212; Pick a website with a REST API and use it to monitor changes of stuff, visualize

Or go full on like I am, make your own Tomcat/Axis2 set-up and learn SOA, I thought I knew XML, I knew shit all! haha :p

&#8212; Network chat system

A low-ball target, but great for an intro to socket programming.

&#8212; Webserver
A brilliant suggestion for learning Threads/Threadpools, in fact I can't think of a better way to learn them than this!

Design, implement, refine. Keep iterations small because you're one person. Either start from the bottom or from the top, but don't do both at the same time. Be sure about what you want to achieve before typing stuff.

Great advice, I still suffer from "type first" mentality and it still bites me in the ass, I'll learn my lesson one day :p (One of the reasons I'm learning SOA, as implementation of an SOA-based system forces strong design on you)
 
Top Bottom