theepicoftyler
Member
Thanks a lot guys. Looks like there's some good resources there. I figured it'd be a little tougher, but it's something I want to pursue so thanks for pointing me in the right direction.
Is MATLAB discussed here? I'm having trouble trying to write working code to create an iteration.
Ok, sorry. I misread your question as a more newbie one. My bad!yes, I realize all this and also that class in a template and class in c++ are in fact two different ideas. It's just that in most use cases typename and class behave the same inside a template. template<class T> describes a primitive like an int just as easily as it does a proper class or struct.
Anyway it's not an issue and now I have the polymorphism I wanted without that blasted vtable pointer adding 4 bytes to every vector.
Edit: If I was using clang I wouldn't even have been an issue as allowing the use of typename in this context is proposed as part of C++1z and it's apparently already implemented in clang.
Ok, sorry. I misread your question as a more newbie one. My bad!
In general the template rules are esoteric (it's part of why I say they're evil -- to be precise, I would say they're unfinished... and yet part of the language standard. Alas.), so I'm never surprised when some seemingly minor difference sends crap sideways. They're slowly refining templates into something sane, but the emphasis is on slowly.
Was the vtable space really hurting you? In general, I've accepted the slightly suboptimal cases (except where the profiler tells me not to) as a sacrifice at the altar of code maintainability. I dream of a day when C++ won't ask me to choose... but that is not this day.
Is MATLAB discussed here? I'm having trouble trying to write working code to create an iteration.
Just got decimated by a Functional Dependency test.
-__-
Just looked this up. Seems like it's a way to describe a simple concept in a complicated way.
What are it's applications in relation to comp sci?
From what I've learned about it, it applies to databases and their constraints. Like one table requires a foreign key from another table, and is functionally dependent on that key existing in the other table. Database design confuses the hell out of me, and I have a final on it tomorrow....
Has anyone ever tried one of these programming bootcamps? Scam, legit, or somewhere in between?
Specifically, I'm looking at Bloc, because they keep spamming me with their shit. I've discovered that I have extreme difficulty keeping to some sort of self-study/self-improvement schedule. I work far better when I have some structure imposed on me from an external source, but since I graduated I've been stagnating, if not deteriorating in terms of skills/knowledge.
So, yeah. Any advice, be it programming or career stuff, would be helpful here.
Its more of a motivational problem. Left to my own devices I would just spend all my time playingIt really depends on what your focus is. Bloc looks like it would be for "App" creators, Treehouse looks like it's web design/development focused, ect.
I'd just try one of the free sites though if you are just looking at brushing up on various skills.
Its more of a motivational problem. Left to my own devices I would just spend all my time playing. I figure I'd apply myself more if I was actually paying a tutor/mentor.DOTA
From what I've learned about it, it applies to databases and their constraints. Like one table requires a foreign key from another table, and is functionally dependent on that key existing in the other table. Database design confuses the hell out of me, and I have a final on it tomorrow....
Database design confuses hell out of everyone and all databases suck equally (though some suck in mysterious ways that might seem that they suck more)
Ah, I think I'm with you now.Yeah it's kind of an issue because I'd like everything to be tightly packed when working with graphics libraries like opengl, which loves to work with memory offset and stride, also the overhead of 4 bytes on a 12 byte object or even an 8 byte object is a little high when I'll be using so many of them.
The other major restriction is i have a swizzle type which is like a reordering, of the elements of a given vector. so for a vector v, v.xxx or v.yxz is a member variable of v that is a swizzle, the major issue was making sure that swizzles are subject to the same math as vectors, but that swizzles actually require no storage being made up of reference variables. If the swizzle is a member of a vector and requires storage, the many swizzles I want to have further bloat the vector storage.
Has anyone ever tried one of these programming bootcamps? Scam, legit, or somewhere in between?
Specifically, I'm looking at Bloc, because they keep spamming me with their shit. I've discovered that I have extreme difficulty keeping to some sort of self-study/self-improvement schedule. I work far better when I have some structure imposed on me from an external source, but since I graduated I've been stagnating, if not deteriorating in terms of skills/knowledge.
So, yeah. Any advice, be it programming or career stuff, would be helpful here.
Gonna sound like a dumb question, but...
How do I output my HTML into an email ad?
Got asked as a favour to do an email phamplet, but while I know how to format it in an email format I haven't learnt how to send it out as an actual email.
First you put on Space Jam OST and then you start rocking out with table elements like it was 1996. I wish I was kidding.
That's a nice starter template for emails too! Space Jam is the best thing that's ever happened to web development!
Serious? Explain this to me please.
I feel like I'm missing something that everyone else knows.
edit: unless you were joking, it's late
Sort of joking, but really as <table> elements still rule the email world -> The Space Jam page is made with tables like everything else in 96 -> Copy table structure from the Space Jam page -> replace images -> ???? -> email template ready to send out!
class GameCharacter
{
protected:
string name;
int hitpoints;
Weapon *weapon;
public:
virtual ~GameCharacter() = 0;
virtual void attack(GameCharacter *opponent) =0;
string to_string();
};
class Player : public GameCharacter
{
public:
virtual ~Player() {};
};
class Warrior : public Player
{
public:
Warrior(string n);
};
I would want to use virtual ~Player() = 0; instead of virtual ~Player() {}; like my professor said i should but it won't let me do that, saying there is an undefined reference to that in Warriors constructor in the .cpp file.
NVM: Figured it out.
%Introduction to Numerical Methods - Coursework 2
%Question 3
clear all
clc
f=@func;
x0=input('First initial guess: ');
x1=input('Second initial guess: ');
nmax=input('Maximum number of iterations: ');
while nmax<=0
disp('Choose a positive integer: ')
input('Choose a new value: ')
end
tol=input('Specifiy a tolerance value: ');
while tol<=0
disp('Choose a tolerance greater than 0: ')
input('Choose a new tolerance value: ')
end
secant(@func,x0,x1,nmax,tol)
%Question 5, 6 and 7
r=nthroot(10,10);
[B]err=abs(xi-r); <--- consistently told that xi is an undefined variable
[/B]
q=(1+sqrt(5))/2;
a=[];
b=[];
for i=1:(iter-1);
errk=err(:,i);
errknext=err(:,i+1);
c=errknext/(errk^q);
a=[a i];
b=[b c];
end
disp('Displays the absolute error after each iteration');
disp('b');
function [x, y, iter] = secant( f, x0, x1, nmax, tol )
%SECANT Secant method for root finding.
% [X, XI, ITER] = SECANT( F, X0, X1, NMAX, TOL ) finds a zero, X,
% of the function F(X) using the secant method. XI is a vector of
% length ITER that contains all the iterative approximations to X,
% where ITER is the number of iterations used. X0 and X1 are the
% initial values required for the secant method, NMAX is the maximum
% number of iterations allowed, and TOL is the convergence criterion.
%
xi(1)=x0;
xi(2)=x1;
n=2;
while tol<abs(f(xi(n))*(((xi(n)-xi(n-1))/(f(xi(n))-f(xi(n-1))))))
xi(n+1) = xi(n)-(f(xi(n))*((xi(n)-xi(n-1))/(f(xi(n))-f(xi(n-1)))));
n=n+1;
if n==nmax
break;
end
end
x=xi(n);
y=xi;
iter=n-2;
disp([x,y,iter]);
end
Is there any advantage software wise in using MacOS to program?
OKAY SO
Basically, we have to recreate the secant method in MATLAB, which I think I've done. For one of the questions, it asks me to find the absolute error after each iteration. However, whenever I get the code, I always get an error when I get to the "err=abs(xi-r)" part because it tells me xi is undefined, even though I define it in my function.
put "global xi" in both the main routine and the function.
I'm assuming that makes xi a variable in all workspaces? I did that, and it passed the line I was stuck with, but now it says "iter" is an undefined variable too.
global xi iter
Tried that and got no errors, although the code doesn't do what I want it to do. Thanks though!
Were doing OOP and since that class is an abstract base for inheritance we would use a pure virtual destructor in it. I have to admit I didn't pay that much attention in that lecture as I should.It's weird that your professor said that because there's no use for a pure virtual destructor.
Look at:
http://stackoverflow.com/questions/630950/pure-virtual-destructor-in-c
http://stackoverflow.com/questions/1219607/why-do-we-need-a-pure-virtual-destructor-in-c
CodeBlocks (what were using) crashes all the time under OS X for me.Is there any advantage software wise in using MacOS to program?
Is there any advantage software wise in using MacOS to program?
Just get xi as an output variable from your secant function. In the function, you have it as an output y, so in your main code replace this:OKAY SO
Basically, we have to recreate the secant method in MATLAB, which I think I've done. For one of the questions, it asks me to find the absolute error after each iteration. However, whenever I get the code, I always get an error when I get to the "err=abs(xi-r)" part because it tells me xi is undefined, even though I define it in my function. I'll just post the code and see if anyone can spot why it won't work.
secant(@func,x0,x1,nmax,tol)
[~,xi] = secant(@func,x0,x1,nmax,tol)
I have recently started an internship with a friend of mine that has been working at the place for about two years. He has a fairly large code-base (to me at least) that he's built up over that time, so he really knows it inside and out. Obviously it's a little hard for me to come in and have any idea what I'm doing with his code haha.
Does anyone have any recommendations when it comes to learning somebody elses code? Right now he's having me try to implement small things and ask him questions if I get confused about what something does, where the data is coming from, etc. Just curious as to how I can become more productive more quickly.
I have heard good things about Navicat, but it is not free.Anyone have a recommended tool to manage/visualize a Postgres database other than pgadmin III? (OSX btw)
Ask a lot of questions. Hopefully he is someone that enjoys explaining his thought processes and problem solving techniques to other people.
If there is a function that you don't quite understand ask him to explain what he was intending for that function to do, and why he gave the function the data he did, etc.
I am in a similar situation. I'm working on a project with a colleague where my portion is <1000 lines of code while his is this 8000+ loc monster. But thankfully he is really interested in explaining his code to others, so we've gone through the program function by function so I understand it fairly well at this point.
Good luck!
Thanks for the advice! I will definitely ask more questions. I have quite a bit of time to learn everything I need to but the faster I can become more of a help to him the better.
Be open with him to. If he knows that you are craving for a task to work on to help him out and learn, he will probably be more open to handing something off to you or giving you something from the task list that I'm sure exists.
Yeah, right now he has me working on something further down the list while he works on something that's higher priority. So if I end up needing a bit of help with the task, it's not a huge deal as no one is expecting this feature immediately. I'm assuming this is the way that we'll continue working for a while.
For free, you can try to use a web-based one that relies on PHP or Java.Anyone have a recommended tool to manage/visualize a Postgres database other than pgadmin III? (OSX btw)