• 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

Nitsuj23

Member
Why would anyone want to work in a company like that. Is beyond me.
I want to get two years of experience while getting a second Bachelors online then I'm out. Figured it'd look good to have two years of Java developing experience on my résumé before applying to better companies out west.
 

Magni

Member
Does anyone know how I would go about getting this sort of result in Oracle while passing only brand_id into the inserts, with just sequences/triggers?

Code:
BRAND_ID MODEL_ID
       1        1
       1        2
       2        1
       1        3
       2        2
       3        1
etc

Basically, a different auto-increasing model_id for every brand_id.

I wish I could dynamically create sequences every time I create a new brand, and then dynamically use it in a trigger called every time I create a new model, but I can't see how (something like Ruby's String#constantize doesn't exist in SQL unless I'm mistaken).

Any pointers?

edit: decided to forget about using sequences, very easy solution with just a trigger:

Code:
CREATE TRIGGER MODEL_TRIGGER
BEFORE INSERT ON MODEL
FOR EACH ROW
  BEGIN
    SELECT
      COUNT(*) + 1
    INTO
      :new.model_id
    FROM
      model
    WHERE
      brand_id = :new.brand_id;
  END;
/
 

Jokab

Member
Thanks. So did running Question.java show a Blackjack game? I'm just confused what it's even supposed to look like.

Edit: Yeah, I'm completely lost. This is so frustrating... I can't even get the thing running let alone to a point where I can make changes.

I have the ctci folder. I open Eclipse. I create a new Project in the ctci folder. Then what? Do I drag the Question.java in the src? Do I drag the entire contents of the folder to the Package Explorer? What's the point of creating the Project in the ctci folder when none of that stuff shows up in my Package Explorer?

I really just need to get this running to put my mind at ease. Please help... someone haha.

You have the ctci folder. Does that mean you did the clone using git? Do you know how git works or did you just download the files separately using your browser?

If you did the cloning properly you should have a folder (that is named anything, doesn't matter) and inside that the ctci folder. If you try to create a new eclipse project inside the "outer" folder eclipse will warn you that there already exists a project there. So you have to pick the ctci folder.

Once you do that, eclipse should load all the files into your project explorer. Then just right-click the Question.java file -> Run as -> Java application. It prints some stuff in your console but nothing more, there is no GUI or interaction from the little I saw.
 
Alright, another basic C++ question. I am getting
Code:
error: cannot convert 'bool' to 'node*' in assignment
and I can't figure out what this means at all. Is it trying to turn my class into a bool type because of how I arranged the code or something?

The offending code:
Code:
bool list::searchList( int newData )
{
        search = head;

        // Look through nodes for newData
        do
        {
                if( search->data == newData )
                {
                        return true;
                }

                search = search->next;
        } while( search =! tail );

        return false;
}
The header file for node:
Code:
using namespace std;

class node{

friend class list;

private:
        node *previous;
        node *next;
        int data;

public:
        node();
        ~node();
};
The header file for list:
Code:
using namespace std;

#include "node.h"

class list{

private:
        node *head;
        node *tail;
        node *current;
        node *search;

public:
        list();
        ~list();

        // Functions to control nodes
        ...stuff...
        bool searchList( int newData );
        ...more stuff...
};
 

usea

Member
Alright, another basic C++ question. I am getting
Code:
error: cannot convert 'bool' to 'node*' in assignment
and I can't figure out what this means at all. Is it trying to turn my class into a bool type because of how I arranged the code or something?

The offending code:
Code:
        } while( search =! tail );
This looks like the offending code to me. You probably meant != instead of =!
 

Magni

Member
This has been driving my colleague and I nuts for the past couple hours:

Code:
PROCEDURE verifyLogin(
  plogin USERS.LOGIN%TYPE,
  ppassword USERS.PASSWORD%TYPE
)
IS
  loginOk number;
BEGIN
  loginOk := 1; --userLogin(plogin, ppassword);
  IF loginOK = 1 THEN
    printMainMenu(plogin);
  ELSE
    printLoginScreen;
  END IF;
END verifyLogin;

Getting a type error, ORA-06502. What ?
 
Sorry to bother y'all with my silly iOS problems but does anyone know a good way to do 2d tables? Equivalent to android TableLayouts or something like that.
 

Milchmann

Member
Matlab folk in here? How do you organize larger projects with many functions? Do you use subfolders or packages or just dump everything in one folder?
 
Oh my goodness, if I see one more *double free or corruption* error I'm going to go mad. It comes from this class definition:

Code:
class node{
private:
   node *previous;
   node *next;
   int data;

public:
   node();
   ~node();
Code:
node::~node()
{
   if( previous )
   {
      delete previous;
   }
   if( next )
   {
      delete next;
   }
}
Help?
 

Slavik81

Member
Consider a 2 element list:

Node0
- Previous = NULL
- Next = Node1

Node1
- Previous = Node0
- Next = Node2

Node2
- Previous = Node1
- Next = NULL


So, to kick things off, we destroy Node0.
Node0 begins to destroy Next (Node1)
Node1 begins to destroy Previous (Node0) -- double free --
// ok, we've already crashed, but let's ignore that.
Node1 begins to destroy Next (Node2)
Node2 begins to destroy Previous (Node1) -- double free --
// I'm sensing a pattern...

Basically, you need to choose what order you're going to go through the chain deleting things. If each node is going to own the next node, you probably just want to delete Node0, and let each delete the next. There's no need to delete the previous.



I'm not so sure on the basic design of having each node manage the lifecycle the next node, though. It might be cleaner if the container that uses the nodes decides how they are allocated and deallocated. Of course, that's just speculation on my part.
 
I removed all the data in node::~node to let it destroy itself without any help but now I get SIGABRT. Here's the code it's included in to get a better idea of what's happening.
Code:
void list::addleft( int newData )
{
        node *newPtr = new node;

        // Set up newPtr and adjust current
        if( current )
        {       
                newPtr->next = current;
                newPtr->previous = current->previous;
                if( current->previous != NULL )
                {
                        current->previous->next = newPtr; 
                }
                current->previous = newPtr;
        }       

        // Supply new data
        newPtr->data = newData;

        delete newPtr;
}
Current is a node that is "where you are at" in the list. I tried it with the delete removed but now I run into the problem where every time I enter the function it initializes the pointer in the same memory location thereby writing over the pointer from last time in the function.

It's obviously my first time implementing a doubly linked list.
 

usea

Member
edit: oops, didn't see you had replied already.

What slavik said.

What is the purpose of the code? Are you certain the desired behavior is to delete the entire list if any one node is deleted? If so, just start at the first node and delete each one only once.

But I'd reconsider the desired behavior.

note: I am far from knowledgeable about c++ best practices.
 
I guess I need some more schooling in basic program design and pointers :/

Thank you Slavik and usea. This board continues to be so helpful.
 

Slavik81

Member
1. In addLeft you're deleting newPtr. That's bad, though... that's the node that you added to your list! It should live until either:
a. it's removed.
b. the entire list is destroyed.

Only functions that insert new nodes should be 'new'ing nodes. Only functions that remove nodes or the list destructor should be deleting nodes. That will ensure that every new'd has one (and only one) matching delete.

2. Just as a reminder, be sure to initialize your class members before you use them. That probably means setting current to NULL in list's constructor, and previous and next to NULL in node's constructor. You're likely already doing that, but if you have forgotten anything, it can be a real annoyance to track down.

Aside from that extra delete, it seems ok...
 
I have an exam this Thursday and I'm having some trouble understanding structures in C. I've been experimenting with them lately and I just don't think I understand them at a basic level (I'm a bit new at programming, so forgive me if this seems like a dumb question). He said we'd have to know how to manipulate them well, so I took an old problem he gave us with arrays and Im turning it into a structure one.

Code:
#include <stdio.h>

f1{
	typedef struct {
  int a;
  int b;
  int c;
} example;
}

example main(){

example one;

one.a = 5;
one.b = 10;
one.c = 15;

}

Ok, so here I wanted a simple structure that would have three elements, each an integer. I made a separate function and want to see if I can manipulate the structure in this new function, and then have this function (main) return the structure (apparently this is possible? Though its weird to me since it doesnt work for arrays-Ive tried). I understand that in this case, "example" is only like a type, similar to int or double and the actual structure is one. So I think Ive defined each element I want. As for returning it, I put the name of the structure in front of the function , which I think where I'm facing issues. Can anyone help? Do I have the right idea?
 

Window

Member
I'm not sure if this belongs here but I feel that I really need to become familiar with more programming languages but I'm not sure which. Just to give you a bit of a background, I'm doing EE with focus on electronics and communications so that includes programming for embedded systems and MATLAB for signal processing. For embedded systems software design we've learned pretty much everything in C (with a bit of assembly). However browsing some job listings shows there's not many jobs around where I live on the hardware side and many of them require applicants who are familiar with a few languages (on top of C). There's so many listed that frankly it's a bit intimidating considering I'm not even fluent in C yet. I worked briefly at a company for an internship (very briefly) and I just could not cope with the multithreading (I didn't even know what a semaphore was!) and networking concepts and all that was just in C. Any suggestions on what type of languages (object oriented, functional or any other) and what specific language of that type one should learn would be appreciated. Also any tips on how to learn more about multi-threading and networking programming would be great. Thanks!
 
I have an exam this Thursday and I'm having some trouble understanding structures in C. I've been experimenting with them lately and I just don't think I understand them at a basic level (I'm a bit new at programming, so forgive me if this seems like a dumb question). He said we'd have to know how to manipulate them well, so I took an old problem he gave us with arrays and Im turning it into a structure one.

Code:
#include <stdio.h>

f1{
	typedef struct {
  int a;
  int b;
  int c;
} example;
}

example main(){

example one;

one.a = 5;
one.b = 10;
one.c = 15;

}

Ok, so here I wanted a simple structure that would have three elements, each an integer. I made a separate function and want to see if I can manipulate the structure in this new function, and then have this function (main) return the structure (apparently this is possible? Though its weird to me since it doesnt work for arrays-Ive tried). I understand that in this case, "example" is only like a type, similar to int or double and the actual structure is one. So I think Ive defined each element I want. As for returning it, I put the name of the structure in front of the function , which I think where I'm facing issues. Can anyone help? Do I have the right idea?


It's mostly right.

Here is my modification:

Code:
#include <stdio.h>

typedef struct {
  int a;
  int b;
  int c;
} example;


example f(){

  example one;
  
  one.a = 5;
  one.b = 10;
  one.c = 15;

  return one;
}

int main(void)
{
  example ex = f();

  printf("ex = { %d, %d, %d }\n", ex.a, ex.b, ex.c);

  return 0;
}

First, why the f1 block surrounding the structure declaration?

Second, this isn't the way to use the main function. Main is really where the application starts to live and eventually die. The return value of the function is the status code that the OS will receive once the application is done, so you shouldn't change its type. It doesn't give an error because... C has a weird definition of main, but still, you shouldn't try to redefine its signature.

Other than that, it is valid code.
 
It's mostly right.

Here is my modification:

Code:
#include <stdio.h>

typedef struct {
  int a;
  int b;
  int c;
} example;


example f(){

  example one;
  
  one.a = 5;
  one.b = 10;
  one.c = 15;

  return one;
}

int main(void)
{
  example ex = f();

  printf("ex = { %d, %d, %d }\n", ex.a, ex.b, ex.c);

  return 0;
}

First, why the f1 block surrounding the structure declaration?

Second, this isn't the way to use the main function. Main is really where the application starts to live and eventually die. The return value of the function is the status code that the OS will receive once the application is done, so you shouldn't change its type. It doesn't give an error because... C has a weird definition of main, but still, you shouldn't try to redefine its signature.

Other than that, it is valid code.


Thanks, I just figured it out myself too. And thanks for the heads up about main, too.
 

usea

Member
I'm not sure if this belongs here but I feel that I really need to become familiar with more programming languages but I'm not sure which. Just to give you a bit of a background, I'm doing EE with focus on electronics and communications so that includes programming for embedded systems and MATLAB for signal processing. For embedded systems software design we've learned pretty much everything in C (with a bit of assembly). However browsing some job listings shows there's not many jobs around where I live on the hardware side and many of them require applicants who are familiar with a few languages (on top of C). There's so many listed that frankly it's a bit intimidating considering I'm not even fluent in C yet. I worked briefly at a company for an internship (very briefly) and I just could not cope with the multithreading (I didn't even know what a semaphore was!) and networking concepts and all that was just in C. Any suggestions on what type of languages (object oriented, functional or any other) and what specific language of that type one should learn would be appreciated. Also any tips on how to learn more about multi-threading and networking programming would be great. Thanks!
Don't be too put off by job listings that say they require tons of experience with certain technologies, etc. They're describing their ideal candidate, which they'll almost never get. Most companies will jump to hire a person who is competent and able to learn on the job.

You don't need to master a language. Most concepts span language barriers. The more you learn, the easier it will get to learn new things. If you're looking to get into software development, try picking up Java, C#, python or ruby. One or more of those will be used a lot in your area. If you're interested in web development, add php and javascript to that list. It doesn't matter that much which one you pick, since almost everything you learn in the first year will be useful in almost any language.

As for multithreaded programming, that's more of an advanced concept. Don't feel bad about not being amazing at it quickly. In fact, I've been doing it for two years and it's still hard.

This is the page I used to learn it, although it will be a lot different than doing similar things in C
http://www.albahari.com/threading/ (Threading in C#)
It's all in C#, but imo it explains things very well with lots of examples that you could try out yourself without any trouble.

A lot of languages do multithreaded programming differently, but the concepts are similar enough. Hopefully that page isn't completely greek to you, since it kind of assumes C# knowledge (and object-oriented programming knowledge). Maybe download LINQPad or Visual C# express and try to follow along with the examples? Could be helpful. (linqpad is basically like a super lightweight version of visual studio. The free version doesn't come with autocomplete, but it's awesome if you don't want to install and mess around with such a bulky application like visual studio)
 

Window

Member
Don't be too put off by job listings that say they require tons of experience with certain technologies, etc. They're describing their ideal candidate, which they'll almost never get. Most companies will jump to hire a person who is competent and able to learn on the job.

You don't need to master a language. Most concepts span language barriers. The more you learn, the easier it will get to learn new things. If you're looking to get into software development, try picking up Java, C#, python or ruby. One or more of those will be used a lot in your area. If you're interested in web development, add php and javascript to that list. It doesn't matter that much which one you pick, since almost everything you learn in the first year will be useful in almost any language.

As for multithreaded programming, that's more of an advanced concept. Don't feel bad about not being amazing at it quickly. In fact, I've been doing it for two years and it's still hard.

This is the page I used to learn it, although it will be a lot different than doing similar things in C
http://www.albahari.com/threading/ (Threading in C#)
It's all in C#, but imo it explains things very well with lots of examples that you could try out yourself without any trouble.

A lot of languages do multithreaded programming differently, but the concepts are similar enough. Hopefully that page isn't completely greek to you, since it kind of assumes C# knowledge (and object-oriented programming knowledge). Maybe download LINQPad or Visual C# express and try to follow along with the examples? Could be helpful. (linqpad is basically like a super lightweight version of visual studio. The free version doesn't come with autocomplete, but it's awesome if you don't want to install and mess around with such a bulky application like visual studio)

Thanks very much for your reply! I guess I was a bit concerned as my project partner at the company was also a new graduate (though I've still got ways to go before I graduate) and he picked up on all these in a couple of days, that just destroyed me. Also thanks for the links, will look into them in the coming holidays. I was told that C# is a 'nicer' language than C++ so this should be a helpful start. Thanks again!
 

Kalnos

Banned
Thanks very much for your reply! I guess I was a bit concerned as my project partner at the company was also a new graduate (though I've still got ways to go before I graduate) and he picked up on all these in a couple of days, that just destroyed me. Also thanks for the links, will look into them in the coming holidays. I was told that C# is a 'nicer' language than C++ so this should be a helpful start. Thanks again!

I applied to a job that required experience in Objective-C, Java, and C# (among other random techs) at a professional level and I only had done C# semi-professionally and I was contacted within two days of applying and offered a phone interview. It can't hurt really, just go for it like usea said.
 

usea

Member
Just started at a big company.

edit: going to edit out details. frustrating so far.

:( sorry

I have been frustrated at my job quite a lot. It's been better recently, but this past week has been pretty bad. Having to add some functionality to code that was definitely not written in a way that makes it easy to change. I should have just rewritten it completely..
 

Aleph

Member
I'm currently reading the 4th edition of The C++ Programming Language (for C++11), I'm about one-quarter done (I don't know why, but for some reason I find language specification books interesting). My question for any C++ programmer here is, if you had to start a new (personal) project, would you start using the 2011 features right away, or would you wait for more complete compiler/libraries support? (considering that clang/gcc already do C++11)
 

phoenixyz

Member
I'm currently reading the 4th edition of The C++ Programming Language (for C++11), I'm about one-quarter done (I don't know why, but for some reason I find language specification books interesting). My question for any C++ programmer here is, if you had to start a new (personal) project, would you start using the 2011 features right away, or would you wait for more complete compiler/libraries support? (considering that clang/gcc already do C++11)
I don't see a reason not using the features considering it's a personal project. You can only count on compiler support to get better, not worse.
 

tokkun

Member
I'm currently reading the 4th edition of The C++ Programming Language (for C++11), I'm about one-quarter done (I don't know why, but for some reason I find language specification books interesting). My question for any C++ programmer here is, if you had to start a new (personal) project, would you start using the 2011 features right away, or would you wait for more complete compiler/libraries support? (considering that clang/gcc already do C++11)

The only issue I've had with C++11 was binary portability; a program I wrote wouldn't run on our supercomputing cluster without upgrading its glibc. Aside from that, the convenience features make it well worth using. Trying to go without auto and range-based for is maddening now.
 

diaspora

Member
I'm getting a start on programming with C, and from there I'm hoping to branch out to C++ and Java. But for now, I've hit a roadblock... I've got Visual Studio from my campus and am playing around with:

Code:
#include <stdio.h>

void main()
{
	printf("\nHello World\n");
}

gcc hello.c

But I have no idea how to test it. How would I run this?
 

Talents

Banned
I know this question is probably asked a ton here, but is there any good books to read to get started in Computer Programming? I've heard the easiest language to get started on is Java. I am a complete newbie at it but I am very interested in it and am considering taking it as a course at University in a year and a bit.

I'd prefer to get a physical book rather than an online guide as I learn better reading from books.

Thanks.
 

sangreal

Member
I'm getting a start on programming with C, and from there I'm hoping to branch out to C++ and Java. But for now, I've hit a roadblock... I've got Visual Studio from my campus and am playing around with:

Code:
#include <stdio.h>

void main()
{
	printf("\nHello World\n");
}

gcc hello.c

But I have no idea how to test it. How would I run this?

gcc hello.c is a command to use the gcc compiler to compile a file called hello.c. You're using visual studio, so just delete that line and click play
 

diaspora

Member
gcc hello.c is a command to use the gcc compiler to compile a file called hello.c. You're using visual studio, so just delete that line and click play

There is no play button.

edit- not true, there is the debugging option (also F5), but Visual Studio won't let me click it because of reasons.
 

usea

Member
There is no play button.

edit- not true, there is the debugging option (also F5), but Visual Studio won't let me click it because of reasons.
You have to type those reasons or we won't know what they are.

Clicking Play is the same as hitting F5, which is "Debug." It just means run the program, but also pause whenever there's an error.

The alternative is ctrl+f5 or "Start without debugging" which just runs the program. It's the same as navigating to the executable and double clicking on it.
 

diaspora

Member
You have to type those reasons or we won't know what they are.

I don't know what the reasons are. It's just greyed out.

Clicking Play is the same as hitting F5, which is "Debug." It just means run the program, but also pause whenever there's an error.

The alternative is ctrl+f5 or "Start without debugging" which just runs the program. It's the same as navigating to the executable and double clicking on it.

Doesn't do anything.
 
Studying for my midterm. Can anyone help me out? Right now, I'm reviewing LL. LL are easy, but traversing a DLL is where I'm having trouble. Even though my teacher said he wouldn't put it in the exam, I want to practice it.

So a random problem I thought of, if I want to delete the last occurrence of an item in a list, how would I do that? My code:
Code:
public void deleteLastOccurances(String name){
		if(tail==null){
			return;
		}
		if(tail.next==tail && tail.nam.equals(name)){
			tail=null;
			return;
		}
		Node previous=tail;
		Node curr=tail.next;
		Node targetpre=null;
		while(curr!=tail){
			if(curr.nam.equals(name)){
				targetpre=previous;
			}
			previous=curr;
			curr=curr.next;
			
		}
		if(targetpre==null){
			return;
		}else{
		targetpre.next=targetpre.next.next;
		}}
This works except if the item is in my tail since I don't check it in the loop. So my traversal is bad. How does one traverse a CLL when you want to check the tail?
 

usea

Member
Studying for my midterm. Can anyone help me out? Right now, I'm reviewing LL. LL are easy, but traversing a DLL is where I'm having trouble. Even though my teacher said he wouldn't put it in the exam, I want to practice it.

So a random problem I thought of, if I want to delete the last occurrence of an item in a list, how would I do that? My code:
Code:
public void deleteLastOccurances(String name){
		if(tail==null){
			return;
		}
		if(tail.next==tail && tail.nam.equals(name)){
			tail=null;
			return;
		}
		Node previous=tail;
		Node curr=tail.next;
		Node targetpre=null;
		while(curr!=tail){
			if(curr.nam.equals(name)){
				targetpre=previous;
			}
			previous=curr;
			curr=curr.next;
			
		}
		if(targetpre==null){
			return;
		}else{
		targetpre.next=targetpre.next.next;
		}}
This works except if the item is in my tail since I don't check it in the loop. So my traversal is bad. How does one traverse a CLL when you want to check the tail?
Abbreviating LL, DLL and CLL made your post more difficult to understand. I'm assuming CLL means circularly linked list? So what, the tail points back at the beginning? I don't see any .prev or whatever in your code. Is it doubly-linked or not? I have no idea what the structure of your list or nodes are. I'll just guess.

Is your question that you can't find the element if it's the tail? Is it because to unlink a node, you need to unset the previous node's link to it, and with the tail you don't have that until you've looped all the way around? In that case, you'll have to check the tail last, after the loop. In a linked list where you can only move forward through the list, if you want to find the last occurrence of something then you have to check every element.

Code:
public void deleteLastOccurances(String name) {
    if(tail == null) {
        return;
    }
    if(tail.next == tail && tail.nam.equals(name)) {
        tail=null;
        return;
    }
    Node previous = tail;
    Node curr = tail.next;
    Node targetpre = null;
    while(curr != tail) {
        if(curr.nam.equals(name)) {
            targetpre = previous;
        }
        previous = curr;
        curr = curr.next;
    }
    if(tail.nam.equals(name)) {
        targetpre = previous;
    }
    if(targetpre == null) {
        return;
    } else {
        targetpre.next = targetpre.next.next;
    }
}
I added a single condition block, starting with "f(tail.nam.equals(name))". I think that should work.
 
Abbreviating LL, DLL and CLL made your post more difficult to understand. I'm assuming CLL means circularly linked list? So what, the tail points back at the beginning? I don't see any .prev or whatever in your code. Is it doubly-linked or not? I have no idea what the structure of your list or nodes are. I'll just guess.

Is your question that you can't find the element if it's the tail? Is it because to unlink a node, you need to unset the previous node's link to it, and with the tail you don't have that until you've looped all the way around? In that case, you'll have to check the tail last, after the loop. In a linked list where you can only move forward through the list, if you want to find the last occurrence of something then you have to check every element.

Code:
public void deleteLastOccurances(String name) {
    if(tail == null) {
        return;
    }
    if(tail.next == tail && tail.nam.equals(name)) {
        tail=null;
        return;
    }
    Node previous = tail;
    Node curr = tail.next;
    Node targetpre = null;
    while(curr != tail) {
        if(curr.nam.equals(name)) {
            targetpre = previous;
        }
        previous = curr;
        curr = curr.next;
    }
    if(tail.nam.equals(name)) {
        targetpre = previous;
        [B]tail=previous;[/B]
    }
    if(targetpre == null) {
        return;
    } else {
        targetpre.next = targetpre.next.next;
    }
}
I added a single condition block, starting with "f(tail.nam.equals(name))". I think that should work.

Sorry, I meant Circular Linked lists. Tails.next points to the beginning of the list.

I see, so you would need a separate checker. Thank you! Btw, you forgot to set tail to previous if the item is in tail or else when you delete again, you'll be stuck in a loop.

Thanks again!
 

usea

Member
Sorry, I meant Circular Linked lists. Tails.next points to the beginning of the list.

I see, so you would need a separate checker. Thank you! Btw, you forgot to set tail to previous if the item is in tail or else when you delete again, you'll be stuck in a loop.

Thanks again!
Ah, nice catch. I didn't even think about that.

No problem
 

leroidys

Member
So I'm making some programs that run as daemons. Does anyone know if there's any real difference between calling daemon() and just "rolling your own" by closing all fds, forking, exiting parent, detaching from ct?
 
As someone new to programming is Sams Teach Yourself C++ in One Hour a Day (7th Edition) a good book to learn from?

As someone who has the "Sam's Teach Yourself Java 6 in 21 Days" I can tell you that my experience with that series was rough personally. I'm a visual learner that also learns through experience (aka making all the wrong turns first to know why it's wrong) and I constantly felt like I was slogging through it without really understanding why I was doing what I was doing. Plus, the chapters are so dense it was hard to not feel defeated since I was doing about 1/3 to 1/4 a chapter a day.

C++ an hour a day may be structured completely different but that is what I remember from that series.
 

Onemic

Member
As someone who has the "Sam's Teach Yourself Java 6 in 21 Days" I can tell you that my experience with that series was rough personally. I'm a visual learner that also learns through experience (aka making all the wrong turns first to know why it's wrong) and I constantly felt like I was slogging through it without really understanding why I was doing what I was doing. Plus, the chapters are so dense it was hard to not feel defeated since I was doing about 1/3 to 1/4 a chapter a day.

C++ an hour a day may be structured completely different but that is what I remember from that series.

I was actually considering that book initially(the C++ variant) until I heard that that particular book wasn't that good for beginners and that the one hour a day was much better, which why I'm considering getting it.
 
As someone new to programming is Sams Teach Yourself C++ in One Hour a Day (7th Edition) a good book to learn from?

Teach-yourself-C++-in-21-days.png
 

Kalnos

Banned
I honestly can't recommend a good book because it has been so long and these things change but I would recommend learning Python or C# instead of C++ (I'm sure someone will disagree though). I would just look around on Amazon for your language of choice and then read the reviews of highly rated books to see if it would be a good book for beginners. If you go with Python then you can also do the nice beginner stuff at Codeacademy.
 
Top Bottom