BomberMouse
Member
Probably the ones with higher salaries/benefits on those levels. Gotta replenish the ranks with cheaper labor.
Why would anyone want to work in a company like that. Is beyond me.
Probably the ones with higher salaries/benefits on those levels. Gotta replenish the ranks with cheaper labor.
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.Why would anyone want to work in a company like that. Is beyond me.
BRAND_ID MODEL_ID
1 1
1 2
2 1
1 3
2 2
3 1
etc
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;
/
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.
error: cannot convert 'bool' to 'node*' in assignment
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;
}
using namespace std;
class node{
friend class list;
private:
node *previous;
node *next;
int data;
public:
node();
~node();
};
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...
};
This looks like the offending code to me. You probably meant != instead of =!Alright, another basic C++ question. I am gettingand 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?Code:error: cannot convert 'bool' to 'node*' in assignment
The offending code:Code:} while( search =! tail );
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;
No problem. I stared at it for several minutes before I finally saw it.It's always the small things. Thank you usea!
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?
class node{
private:
node *previous;
node *next;
int data;
public:
node();
~node();
node::~node()
{
if( previous )
{
delete previous;
}
if( next )
{
delete next;
}
}
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;
}
#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;
}
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?
#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;
}
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.
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.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)
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!
Just started at a big company.
edit: going to edit out details. frustrating so far.
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.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'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)
#include <stdio.h>
void main()
{
printf("\nHello World\n");
}
gcc hello.c
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
You have to type those reasons or we won't know what they are.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.
Hello World in C++ with Visual StudioI don't know what the reasons are. It's just greyed out.
Doesn't do anything.
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;
}}
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.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:
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?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; }}
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;
}
}
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.
I added a single condition block, starting with "f(tail.nam.equals(name))". I think that should work.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; } }
Ah, nice catch. I didn't even think about that.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!
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.
As someone new to programming is Sams Teach Yourself C++ in One Hour a Day (7th Edition) a good book to learn from?