Hai-Etlik

Members
  • Content Count

    81
  • Joined

  • Last visited

Posts posted by Hai-Etlik

  1. Most graphical, mouse driven browsers display the content of the title attribute as a tool tip.

    Title should be used for "extra" information not contained by whatever it modifies. Title or non obvious decription of an image, meaning of an acronymn, destination of a link if the text of the link is not sufficiently obvious. It is not required.

    Alt is only for images and it is REQUIRED. An img element with no alt attribute is technicaly invalid. It should contain text to be used if the image can't be displayed. If the image is purely decorative, give it an empty alt attribute. IE will use the alt attribute for the tooltip if no title is given, other browsers don't. This is important for non graphical browsers (plain text, aural, braille)

    <img src="header.png" alt="my Web Page" /> <!-- Image is a header containing text, alt attribute is that same text -->
    <img src="decoration.png" alt="" /> <!-- Decorative image with no meaning -->
    <img src="me.jpeg" alt="A picture of me" title="Me on vaction in mongolia in 1992" /> <!-- Alt text gives an indication of what's missing, title gives extra information not evident in the picture -->

    <abbr title="Multi User Domain">MUD</abbr> <!-- An abbreviation with the meaing as the title -->

    <a href="http://en.wikipedia.org/wiki/MUD" title="Wikipedia entry on MUDs">MUD</a> <!-- The link text only indicates that the link is about MUDs, the title provides more information -->

  2. I apresate your explanation, still don't understnad it (well), I get that adding const behind it it means the funtion can not alter non local varables (or privet varables in the class) but I thought you did that by making it a pointer (as I call the & or * magic that no book or 5 c++ classese faild to explain well) or decalrig const double or something..

    const at the end of the header of a method (member function) means that it does not change the object or class (static data). Unless that data is declared mutable (Caches, scratch areas, that sort of thing) or you do something ugly like a cast. Generaly if you have a "get" method (read accessor) you will want it to be const like this.

    Const at the start of a data type means that variables of that type can not be altered. If it's a class, only const methods can be called.

    const int, const Pointer3

    if the type is a pointer or reference, then it means that the POINTER can not be changed but what it points to is OK to change.

    const std::string&, const Pointer3*

    if the type is a pointer/reference and the const comes after the pointer/reference charater, then the pointer can be changed, but what it points to can not.

    std::string& const, Pointer3* const

    if you have const before and after, then you can't change the pointer OR the thing pointed to.

    const std::string& const, const Pointer3* const

    As for the difference between a pointer (*) and a reference (&), a reference is basicly a pointer that is automaticaly dereferenced for you.

    void c_function (int* ref_arg)
    {
    do_something(*ref_arg)
    }

    int foo;
    c_function(&foo);

    void cpp_function(int& ref_arg)
    {
    do_something(ref_arg);
    }

    int foo;
    cpp_function(foo);

    Note how with a regular pointer, you have to get a pointer to foo (&foo) and then dereference that pointer (*ref_arg) With a reference, this is all done automaticaly. It's not realy all that useful and it doesn't deal with any of the real difficulties of using pointers (Making sure what is pointed to is realy there, getting rid of things when you are done with them, and it can open type safety holes)

    Point3.h

    #ifdef POINT3_H
    #define POINT3_H

    Should be #ifndef not #ifdef you want to declare the class if it HASN'T been declared, not if it allready has.

    Point3.cpp

    int Point3::getY() const
    {
    return y
    }

  3. I've only seen a const modifier like that on methods. In which case it forces (or at least tries to force) the method to not have any side effects on the receiver.

    If it's valid on non-methods, I would assume it prevents them from altering non local variables (no side effects). In which case the example you gave would seem to violate that restriction. It also has a return type but no return statement. -- After a bit of searching, it looks like const is only valid on methods, not stand along functions.

    Looking more carefuly at your post it looks likely that it is a method as you refer tyo a constructor (it's useful to know things like this) and that x is a member of that object?. If that's the case then the getX() method should fail to compile unless x is declared mutable (ignores constness). Besides this it should at least generate a warnning for having a return type but failing to have a return statement.

    If you want an "accessor method", you probably want.

    int Point::getX() const 
    {
    return x;
    }

    If VALUE is a pointer, non copyable object, or object that is costly to copy. you probably want to return it as a const pointer or reference.

    Foo* const Point::getAFoo() const 
    {
    return foo;
    }

    std::string& const Pointer::getString() const 
    {
    return stringRep;
    }

    Note that the const goes after the * or & so as to say that it is what is pointed at or refered to that is constant, not the pointer or reference itself.

    const char* is a constant pointer to a mutable (C style) string.

    char* const is a mutable pointer to a constant string.

    Finaly your constructor is wrong, it needs to have the same name as the class it is the constructor for. A constractor for class Point3 can not be named Point, it must be named Point3.

  4. I've only seen a const modifier like that on methods. In which case it forces (or at least tries to force) the method to not have any side effects on the receiver.

    If it's valid on non-methods, I would assume it prevents them from altering non local variables (no side effects). In which case the example you gave would seem to violate that restriction. It also has a return type but no return statement.

  5. There aren't realy any fixed requirements. A distro consists of a bunch of packages, you don't need to install all of them and can even replace one package with another. So a typical distro can run on a very wide range of systems depending on how you set it up.

    Running a full desktop environment (Like KDE or GNOME) from a live CD seems like a bad idea with a system like that. The big, fancy, interfaces are simply going to be too big and slow or even unrunnable even without the overhead of a live CD.

  6. Here's the Ubuntu download process starting from their home page

    http://ubuntulinux.org/

    Select "Download"

    http://www.ubuntulinux.org/download/

    Select a mirror

    http://mirror.mcs.anl.gov/pub/ubuntu-iso/5.10/ (The first one listed, any should present the same page though)

    It presents 6 options with clear and simple descriptions of each. If you read them it should be fairly obvious at least which architecture (PC, Mac, AMD-64) you want. And what the difference between the install and live images is.

    Assuming you want a Live CD that runs on a typical IA-32 PC, you select "PC (Intel x86) live CD"

    http://mirror.mcs.anl.gov/pub/ubuntu-iso/5...0-live-i386.iso

    Wait for it to download, burn it, and boot from it.

    That's three clicks from the main page and reading some simple directions. You only need to download the one file and burn it using whatever burnning software you have.

  7. Installing packages should be trivial in Ubuntu

    From a terminal

    sudo apt-get install name-of-package

    Or you can use a graphical interface.

    For a simple one

    Applications -> Add Applications

    For a more powerful one

    System -> Synaptic Package Manager

    Generaly APT is used over the internet, but it works just fine from just the CD.

  8. Well, the lazy way to go would be to change

    #include <stdio.h>

    to

    #include <cstdio>
    using namespace std;

    And otherwise leave the original alone. Your teacher probably doesn't want that though.

    The read and write operations on iostreams do NOT take formatting strings like printf and scanf. And you don't pass a pointer to the read method.

    int foo;
    scanf("%i", &foo);
    printf("The integer variable foo has a value of %i.\n", foo);

    is equivalent to

    int foo;
    cin >> foo;
    cout << "The integer variable foo has a value of " << foo << "." << endl;

    And the proper C++ include for iostream is

    #include <iostream>
    use namespace std;

  9. It would make more sense to rip the tracks into individual files. If you want to retain the quality you could use FLAC. If you don't mind trading some quality for small size, you could use Vorbis, MP3, or some other lossy encoding. As a rule of thumb, FLAC will probably take up about half the space of uncompressed PCM while the lossy encodings at decent quality levesl will probably take about a tenth as much space. You could also mix and match so your favourite tracks are lossless and the rest are lossy.

  10. When I tried to open firefox yesterday, for no reason a box appeared saying which profile I would like to load. The only option was "default", so I clicked it, but it brought up an error message (not exactly sure what it said) and it wouldnt let me log in as the default user. The only way to get to firefox was to create a new profile, which I did, and now I dont have any of my old firefox settins (bookmarks, extentions, themes, etc)

    Can anyone help?

    Thanks,

    Brett

    <{POST_SNAPBACK}>

    That dialog means Firefox was allready running and the new instance you started was unable to merge with the old one. When that happens what you want to do is close all Firefox processes. In Windows you can use Ctrl-Alt-Del to bring up a task manager that will let you kill any Firefox processes that are in the background.

    Once you have done this, you can start Firefox again.

  11. Sorry, my example wasn't really that clear. And it was JUST an example of the arguments you could pass to a printf or scanf, not necessarily ones that would be directly useful to you.

    If you have three format tags in the string, then there should be three arguments afterward. If you have one format tag then there should be one argument afterward. And the types should match: "%i" or "%d" should have an int argument, "%lf %lf" should have two double arguments, "%i %lf" should have an int and then a double as arguments. This applies to both scanf and printf.

    scanf("%i", &intvar)

    printf("Two doubles: %lf %lf", doublevar1, doublevar2)

    The important thing is that the tags and arguments match. In the scanf, the %i matches with int argument, and in the printf the two %lfs match with the two double arguments.

    The else if thing is just an extra bit of refinement, don't worry about it until you have everything else working, and SAVE the working version separately before you try it.

  12. The problem is with your IO function calls.

    Make sure the format tags in the string and the arguments match up. there should be the same number of each and they should have corresponding types.

    %i or %d int

    %f float

    %li long int

    %lf long float or double

    ("%i %i %lf", intvar1, intvar2, doublevar1)

    You might also consider using else to simplify the rate selection. You can do it with just 3 comparisons rather than 6. This probably isn't necessary though.

    You can link ifs together like this.

    if(test1) something1;
    else if (test2) something2;
    else if (test3) something3;
    else something4;

    If test1 is true, then something1 happens and the program jumps to the end of the block of ifs, otherwise test2 is evaluated, and if it is true, something2 happens, otherwise test3 is checked to see if something3 happens, finally if and only if none of the tests are true, something4 happens. So exactly one of the somethings happens.

  13. You may need to activate more than one channel, Probably both of Master and PCM. The details vary with the sound card.

    GNOME (used by Ubuntu) should have a nice graphical mixer that is otherwise just like Alsamixer. Applications -> Sound and Video -> Volume Control.

    You can also put volume controls on your panel, right click on the panel and select "add to panel". Once you have it you can right click, select preferences and then set which channel you want it to control.

  14. DNS allows heirarchical names to be used to access various information including BUT NOT LIMITED TO IPv4 addresses.

    An IPv4 Address is 32bits and is used for routing packets through an IPv4 network.

    A URL is a string which describes the location of a resource. It is a type of URI along with URNs, Different URL schemes have different requirements but most require a hostname which can be either an appropriate network address (like IPv4) or some easier name to be resolved into sutch and address (like a DNS name)