|
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. |
On September 26 2012 01:25 jergason wrote:Show nested quote +On September 25 2012 17:05 Morfildur wrote:
C is a great language... but you won't use it in the real world unless you program for microprocessors or on the linux kernel. C++ is the closest which is more often used and these days mostly used when developing 3D games/engines. You won't do either until far further into your programming career - if ever.
. . .
Note that i don't mean "Don't learn C". It's good to know C and how everything works behind the scenes, i really recommend learning it at some point, but it won't really land you any jobs.
This is untrue. Good C programmers earn top dollar. If you are doing software development, pretty much any field can make you lots of money. Pick what is interesting to you and you'll succeed. Don't pick and choose based on how much money you can make off of it.
Can vouch for that C/assembly/occasional machine code is way fun. Learning the complexity of the C language will unveil the mysteries of hardware. Also, <3 money.
Also, +1 for supporting python as a first language. Awesome scripting language that will generate a ton of ideas for programs right out the gate. Starting with languages like java or C, you have to know quite a bit about packages and design in order to do some of the simplest things like read file metadata to make a decision. Starting with a web language is great, but only if that is what you want to do, and its very much a one way street (harder to go down the stack than up).
|
On September 26 2012 08:20 RoyGBiv_13 wrote:Show nested quote +On September 26 2012 01:25 jergason wrote:On September 25 2012 17:05 Morfildur wrote:
C is a great language... but you won't use it in the real world unless you program for microprocessors or on the linux kernel. C++ is the closest which is more often used and these days mostly used when developing 3D games/engines. You won't do either until far further into your programming career - if ever.
. . .
Note that i don't mean "Don't learn C". It's good to know C and how everything works behind the scenes, i really recommend learning it at some point, but it won't really land you any jobs.
This is untrue. Good C programmers earn top dollar. If you are doing software development, pretty much any field can make you lots of money. Pick what is interesting to you and you'll succeed. Don't pick and choose based on how much money you can make off of it. Starting with a web language is great, but only if that is what you want to do, and its very much a one way street (harder to go down the stack than up). While I agree it's easier to move up than down, why would a newbie who learnt some JS first be that much worse off at learning, say, C++ than another newbie who hasn't learnt anything yet? Maybe he's going to have a few bad habits to get rid of but it's not that big of a deal.
To be fair, I agree that the newbie who started with web languages is probably never going to learn C++, but it's because he's not going to want to, not because he would be unable to. Is that what you meant?
|
On September 25 2012 17:05 Morfildur wrote: C is a great language... but you won't use it in the real world unless you program for microprocessors or on the linux kernel. C++ is the closest which is more often used and these days mostly used when developing 3D games/engines. You won't do either until far further into your programming career - if ever.
Not true in my experience. We have a number of people who do both (mostly C++ of the two) and many of them only have a few years of experience. Their projects don't have anything do anything with 3D.
On September 26 2012 06:45 cowsrule wrote: There's pros and cons, as people have been pointing out, to each language to start. The choice of which language you use first is not as important as actually starting to use any language. You can't begin to see if it was a good/bad choice until you've started using it. If you don't like that language or get frustrated, try out another one.
You should think a bit more about the goals that you have for learning to program - wanting to solve problems like a software engineer is quite broad. It sounds like you're interested in the web which is great. Pick a language/technology that lets you pursue your interests, as working towards an exciting goal will help you develop the fastest.
Choosing the right tool for the job is a large part of software engineering, find something you want to build and work backwards from there. I agree with this.
The only challenge you have based on your starting point is which bad habits you'll have to shake off as you progress from one language to the next and one level of experience to the next. That you'll develop bad habits and be forced to refine your ability (or be left behind) is intractable to software design.
You'll find this to be true even in just your first few months of full time development.
|
I am thinking about making a website. What do you guys suggest for Webhosting?
|
On September 27 2012 15:17 Desmater wrote: I am thinking about making a website. What do you guys suggest for Webhosting? You can get a free server (and other free services) at AWS. Cons: the free server is really slow and getting into AWS can be overwhelming at first.
GAE is also free. It's more abstract though; you just write code in e.g. Python, upload it to Google, and they will run it for you. You can't directly access the OS of your server and install software etc.
I'm mostly listing these because they're free (as long as you don't have too much data or too many visitors). If you can afford to pay a little I think it would be easier to stay clear of the cloud at first, and go for traditional hosting instead. I really don't know any names in the USA though so I'll let other people answer that.
|
Is there anything like codeschool's zombie on rails but for java? Something w/ basic practices but that have a little flavor and instruction in them would very helpful!
|
On September 27 2012 15:56 Matoo- wrote:You can get a free server (and other free services) at AWS. Cons: the free server is really slow and getting into AWS can be overwhelming at first. GAE is also free. It's more abstract though; you just write code in e.g. Python, upload it to Google, and they will run it for you. You can't directly access the OS of your server and install software etc. I'm mostly listing these because they're free (as long as you don't have too much data or too many visitors). If you can afford to pay a little I think it would be easier to stay clear of the cloud at first, and go for traditional hosting instead. I really don't know any names in the USA though so I'll let other people answer that.
I do not want a free service. I am willing to pay. Since I am hoping other people will visit my site. I guess I would prefer/need a US webhosting service.
|
On September 27 2012 15:17 Desmater wrote: I am thinking about making a website. What do you guys suggest for Webhosting?
Depends on what you want the website for. Personal or business. Intended audience. Expected traffic. Your web development experience.
|
On September 28 2012 06:00 Blisse wrote: Depends on what you want the website for. Personal or business. Intended audience. Expected traffic. Your web development experience.
Business with a decent size traffic maybe couple thousand people. Very little experience.
|
Well this is unfortunate. All my python books "Dive into Python", "Learn Python the Hard Way" and even the primary text used for the MIT open course introduction to comp sci, "Python programming: An Introduction to Computer Science" uses python 2. How long would it take to get used to python 3 after being immersed in python 2.0 for the next few months? Well I guess it doesn't really matter in the long run since what's learning an updated language compared to learning new ones (which i'll be doing).
Also I have a question about CMS. I need to create around 90 pages for a site so it would be a nightmare to have to manage it without some sort of CMS. What adds to the problem is I might have to update the header or footer, AND I want to try out some A/B testing to keep track of conversions.
I'm thinking of using WordPress. I've read that it takes very little php knowledge to convert an html/css design into a wordpress template. It's as easy as wrapping the parts you wish to be dynamic in php tags. But I'm just wondering how this works in general.... Will it add to the page load i.e. requests, size? Does it display on all browsers and browser versions uniformly?
And how does it work exactly on static pages? And how does it affect search engine optimization? If you already have an optimized site with backlinks pointing towards specific URLs, a dynamically created page made through a CMS will have a random URL on it so it would probably screw you over right? You need to build the CMS in from the start I imagine. And that web applications have their own CMS built for their specific site/web architecture.
ETA: http://www.seomoz.org/blog/url-rewrites-and-301-redirects-how-does-it-all-work It does not affect backlinks because a URL rewrite just points to the original URL anyway.
Plus I think it might make the page load even faster since I can cache the parts of the site that will be reused over and over again. I will probably end up with DRUPAL over wordpress, cause it'll give me the chance to learn some bits about php.
|
On September 28 2012 08:12 Desmater wrote:Show nested quote +On September 28 2012 06:00 Blisse wrote: Depends on what you want the website for. Personal or business. Intended audience. Expected traffic. Your web development experience. Business with a decent size traffic maybe couple thousand people. Very little experience.
You might want to check out http://webhostinggeeks.com/bestbusinesshosting.html Check out all the reviews and see what the people are looking for in a webhost for medium sized businesses. I use bluehost myself for two different sites (And a third one on the way), I've been with them for a year and a half and I can't complain.
|
On September 28 2012 14:55 lannisport wrote: Well this is unfortunate. All my python books "Dive into Python", "Learn Python the Hard Way" and even the primary text used for the MIT open course introduction to comp sci, "Python programming: An Introduction to Computer Science" uses python 2. How long would it take to get used to python 3 after being immersed in python 2.0 for the next few months? Well I guess it doesn't really matter in the long run since what's learning an updated language compared to learning new ones (which i'll be doing).
Not that long at all. However, Python 2 is still the gold standard because adoption of Python 3 has been relatively slow. You aren't missing out on anything, yet, if you're still using Python 2.
|
Hey guys, I have to store a text file in an array (large text file) and convert each letter to an integer. (a=0, b=1, etc). The non-letters in the original file will be skipped, so is it safe to use just a %s? Will that skip any integers in the file and random symbols?
main() { int i,j,k=0; FILE *f; int a[100000]; char *buffer; f=fopen("IntegerArray.txt","r"); while(fgets(buffer,10,f)!=EOF && i<10000) { int number=atoi(buffer); a[i]=number; i++; } for(i=0;i<10000;i++) { for(j=1;j<=10000;j++) { if(a[i]>a[j]) k++; } } printf("%d",k);
This doesn't work, but I have an idea? This should just store the array letters, but then I have to convert them to numbers..Which would be using ascii right? %26?
|
I'm confused as to why you're using atoi in the initial read loop, that's probably not what you want (you're trying to convert every 10 characters to an int, which obviously won't really work for things that aren't actually digits). Is the file formatted in some way that you didn't mention?
Anyway, for converting letters to numbers, you can simple do something like:int val = read_letter - (int)'a'
You'll probably want to do some range checking to see if its a letter (you can do that using the same casting method).
|
There are probably a lot of things wrong with the code, but the first thing I notice is that your buffer pointer is uninitialized and then you pass it as an output parameter. You have to make it point to somewhere before you use it. Either make buffer a char array or initialize it to point to some dynamic memory allocated with malloc or something.
|
On September 30 2012 02:03 ranshaked wrote:Hey guys, I have to store a text file in an array (large text file) and convert each letter to an integer. (a=0, b=1, etc). The non-letters in the original file will be skipped, so is it safe to use just a %s? Will that skip any integers in the file and random symbols? main() { int i,j,k=0; FILE *f; int a[100000]; char *buffer; f=fopen("IntegerArray.txt","r"); while(fgets(buffer,10,f)!=EOF && i<10000) { int number=atoi(buffer); a[i]=number; i++; } for(i=0;i<10000;i++) { for(j=1;j<=10000;j++) { if(a[i]>a[j]) k++; } } printf("%d",k); This doesn't work, but I have an idea? This should just store the array letters, but then I have to convert them to numbers..Which would be using ascii right? %26? Characters in C are integers, and in ASCII they range from the value of 0 to 255. So, if you look up an ascii chart you can see that capitol A to capitol Z is 65 though 90. Lower case is 97 through 122. So, use fgetc to get a character from the file until you reach the end. Use an if statement to see if your character is within those two ranges, and if it is then store that character however you want, perhaps in an int array.
Also as for reading the file itself, you can also open the file and use fseek to see how large the file is. Then call malloc and make a char buffer that size. Put the files entire contents into the buffer with a single call to fread, and then cycle through the contents with a for loop and size of char. This gets rid of the annoying static 100000 fixed size array.
Use fclose to close your file when you are done.
Usually you'll want main to look like:
int main( void )
or void main( void ) // if not on gnu
|
okay, my apologies I should have done A LOT more research.
Nonetheless, here's some updated stuff.
int main() {
FILE *fp;
char fname[128],c,storage[10000]; int index=0; int end; printf("Enter filename: \n"); gets(fname);
fp=fopen(fname, "r");
printf("\nThe text file before conversion begins here:\n");
c = getc(fp); while(c!=EOF) { putchar(c);
if(c > 96 && c<123)//Only accepts lower-case letters
storage[index]=c; index++; end=index;//Stores the total amount of letters in an index
c = getc(fp); } printf("\n\n\n This is the altered text with only lower-cased letters: \n\n"); for(index=0;index<end;index++)//prints each letter in the index printf("%c",storage[index]);
fclose(fp); printf("\n\n\n");
return 0; }
So far it's working fine, except that there are a ton of spaces. Is there a way to eliminate the spaces so it's all stuck together as a bunch of letters? I completely went another way with something I remembered in the past. I'm still using 10,000 fixed, but it seems to work. Thank you.
|
You have "spaces" (they're not really spaces, they're nulls) because you're always increasing the storage index even if you didn't store a character there. If you make that range check if statement surround the entire part where you store, increase index, and mark the end you should be fine. You also might want to spend some more time on formatting your code, everything is broken up in a really weird way 
Also, you shouldn't need to store off what the 'end' is separately. After exiting your read loop, the end is simply index-1
|
On September 30 2012 04:52 tec27 wrote:You have "spaces" (they're not really spaces, they're nulls) because you're always increasing the storage index even if you didn't store a character there. If you make that range check if statement surround the entire part where you store, increase index, and mark the end you should be fine. You also might want to spend some more time on formatting your code, everything is broken up in a really weird way  Also, you shouldn't need to store off what the 'end' is separately. After exiting your read loop, the end is simply index-1
oh man! That makes sense (the bracketing of the code after the if check...)damn. I've learned to hate and love this stuff. It's incredibly rewarding when it works, but hours of frustration hurt just as bad!
As for the formatting, it's a bunch of stuff I'm throwing together and testing out. I'm going to make it look nice right now. For some reason when I code it's always a complete mess, and then I go back and organize it :/ It's not a good way to write though.
|
On September 30 2012 05:01 ranshaked wrote:Show nested quote +On September 30 2012 04:52 tec27 wrote:You have "spaces" (they're not really spaces, they're nulls) because you're always increasing the storage index even if you didn't store a character there. If you make that range check if statement surround the entire part where you store, increase index, and mark the end you should be fine. You also might want to spend some more time on formatting your code, everything is broken up in a really weird way  Also, you shouldn't need to store off what the 'end' is separately. After exiting your read loop, the end is simply index-1 oh man! That makes sense (the bracketing of the code after the if check...)damn. I've learned to hate and love this stuff. It's incredibly rewarding when it works, but hours of frustration hurt just as bad! As for the formatting, it's a bunch of stuff I'm throwing together and testing out. I'm going to make it look nice right now. For some reason when I code it's always a complete mess, and then I go back and organize it :/ It's not a good way to write though.
It never gets easier, either. Once you get better with programming you learn to catch mistakes like that quickly.
And then... your boss tell you to brush up on your Win32 API. Oh yes. Nothing is easier than debugging microsoft's poorly documented API ( Media Foundation, anyone? ). It's loads of fun.
|
|
|
|