rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@Mike2k
Generally, you are spot-on with regard to the old nVidia drivers, but I have been VERY happy with them since 2008 (CentOS 5.x), including on my nVidia laptop (a Dell D630) as well as my personal workstation (8800GT card). I am running Scientific Linux 6.x on both now, and there are ABSOLUTELY no issues running the proprietary drivers, and I do a lot of graphics intensive work on them.

Recently Linus Torvalds gave nVidia a big "thumbs-up" for their recent efforts to be more supportive of the open source Nouveau driver, instead of the big middle finger he gave them last year! Hopefully they will continue in this direction.

FWIW, the Nouveau drivers have improved significantly as a result of nVidia's contributions to Nouveau. I recently upgraded my workstation to SL 6.5 and the Nouveau driver was MUCH better than the old ones. It still had some irritating glitches, so I replaced it with the current nVidia GeForce driver - no glitches and still performs much better than Nouveau. If it weren't for the small, but irritating glitches (such as issues with cursor tracking between multiple screens), I would have kept the Nouveau driver.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Totally different thing. The 32-bit system is the print server. Just install the compatible 64-bit driver from HP on the Win8 machine and point your print stream to the 32-bit server.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@NardCake
Some of the issues with nVidia cards is the default Linux use of the open source Nouveau nVidia driver, which while significantly improved as of late, is far behind the proprietary Linux drivers in terms of performance and capability, and in the past it was pretty pathetic.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Yeah, if this wasn't mentioned, I think that currently about 95% of the top 500 super computers in the world are running Linux - you can't get much more "big iron" that that! A lot of them are also running scads of nVidia's tesla GPUs for parallel floating point performance.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What kind of VPN server are you trying to connect with?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Naming conventions... :-) I would suggest that you use something other than Int for your AP class to avoid this sort of confusion, such as APInt, or AnInt, etc. Depending upon the font, it can be difficult to tell int apart from Int, especially for us old farts! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but we don't do your homework for you. Show us what you have tried and we can help you find the errors of your ways, and means. Remember, for *nix systems, there are user, group, and "other" permissions on directories as well as files. So, a hint - to list a directory you need r (read) permission on it. To access a file or subdirectory in the directory, you need x (execute) permission. Normally, the owner has all (read/write/execute) permissions on a directory, and they can limit members of the directory's group or others as necessary.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is your WiFi secured? If secured with WEP, change the security to WPA and select a strong passphrase. If not secure, change it to WPA and select a strong passphrase. If already WPA, change the passphrase to a strong one that is difficult to guess.

Also, go into your router web interface and disable remote access/monitoring, and change the admin password.

Finally, what is the make/model of your router/wifi-access-point?

RikTelner commented: Good that you tried to answer. +2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you want to know exactly how to create an operating system from scratch, there are a number of texts out there to help teach you, such as Andrew Tanenbaum's "Operating Systems: Design and Implementation" - where he shows how the Minix operating system works. This was, as I understand it, the inspiration for Linus Torvalds to create Linux. Since all Linux source code is available to study and adapt, that is another source (so to speak) to draw from.

In any case, to integrate operating system code to various processor architectures, you will need to also be able to write some (not a lot) of assembler language for the target processors. Some things require very low-level access that higher-level languages, even C, don't provide.

The process of getting code onto the hardware is called "bootstrapping".

Your questions are good, but the answers are too complex to cover here in a single post. :-) Try to keep your questions focussed/narrow and they will be easier to answer in a reasonable frame.

BTW, another open source operating system is FreeDOS, an MS-DOS clone. That may be another place to start in your OS explorations!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Classes are used to model physical or conceptual entities. An example of physical entities may be the class Animal - an abstract base class. Derived from that are classes such as Cat, Dog, Human, Bird, etc. Derived from Cat are things like WildCat (Leopard, Tiger, Lion, Puma), DomesticatedCat (Abysinian, Siamese), et al. You model basic behaviors in the base classes, and then refine those behaviors in the derived classes. Example: all animals eat food. Some animals only eat meat. Others eat meat and vegetables. And others may only eat vegetables and/or fruit. By using virtual inheritance, you can create a class like DomesticatedCat from the generic Cat class, and with a reference to it as simply an instance of Cat, you can ask what it eats - and it will give you the appropriate answer - mice, cat food, milk/cream, etc. If you create an instance of Lion, and reference it as another Cat, then when you ask what it eats it may come back with Gazelle, Deer, UnwaryHuman, etc. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Swap space is used as virtual memory. IE, if your system and applications need more memory than you physically have, then the swapper will move the least-recently used memory blocks to the swap space, freeing that physical memory for active processes. This can be expensive, since it entails physical I/O to move the memory blocks from RAM to disc. When your process that is using a lot of memory is is done, then memory that has been swapped out but still in use by other processes will remain in the swap space until needed, then they will be swapped from disc into RAM. This is an "on-demand" operation. IE, don't mess with it until needed!

So, it may "lag" (show some latency), but unused memory won't "hang around" if that is what you are asking. Myself, I usually allocate a swap partition at least as large as my physical memory, and sometimes larger "just in case". Example: on my personal workstation, I have 8GB of RAM, but I have a 16GB swap partition. This allows me to have up to 24GB of memory for those rare occasions when I may need it for some memory-intensive computations.

Also note that the Linux system agressively caches frequently used file system data, assuming that you are going to ask for it again. That avoids the need to access it on disc, since physical I/O is VERY expensive as compared to RAM memory access. Since I do a lot of disc I/O, on my …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please show what code you actually wrote. This line is wrong (my bad): vector<TYPE>* list = new vector<TYPE>;

It should be vector<TYPE>* list = new vector<TYPE>();
Sorry about that! :-)

That still won't shut up the compiler - fun with templates!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, install the the 2GB DDR2-800 in the A2 slot (assuming the current one is in the A1 slot). See if that works. If so, then, install the 1GB SIMM in the B1 slot. If it doesn't work, install the 2GB SIMM in the B1 slot and try again... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Too much code, and not enough information. What is the "drive" function supposed to do, for example? What do you mean by a "recursive" quick sort? Do you mean a reverse sort - largest to smallest? Or do you mean a recursive sorting algorithm?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This NOT good!
This is better:

class car {
.
.
.
public:
    car(double mpg = 0.0, double capacity = 0.0);
.
.
.   
};

Car::Car(double mpg, double capacity): mpg(mpg), fuel_capacity(capacity)
{}

The way you did it, if someone instantiated a car type with something other than 0.0 for mpg and capacity, they would be fubar'd! Also, inside the constructor, you want to verify that the values passed are NOT less-than-zero. IE:

Car::Car(double mpg, double capacity): mpg(mpg), fuel_capacity(capacity)
{
    if (mpg < 0.0 || capacity < 0.0)
    {
        // Throw an exception - and remember to tag the
        // the declaration of the car constructor in the header
        // to indicate it may throw this exception.
    }
}

Note that I did not add the throw tag to the declaration - I am leaving that to you. What it is depends upon the exception type you decide to throw. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Yes, it is an instance variable, and only affects the instance you set it in. Make it a class static variable, and that should do what you want.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do note that I don't try to solve all of your problems in one post. However, I do try to get you to see where some of your fundamental problems lay.

Oh, and here is a link to the www.cplusplus.com documentation on list sorting: http://www.cplusplus.com/reference/algorithm/sort/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, here is one problem (starting at line 140):

vector<TYPE> convertToVector(Node<TYPE> *Ptr)
{
    Node<TYPE> *currPtr = headPtr;
    while (currPtr != NULL)
    {
        int i = 0;
        vector<TYPE> list(count);
        list[i] = currPtr->data;
        i++;
        currPtr = currPtr->nextPtr;
    }
    return list;
}

// This would be better.
vector<TYPE>* convertToVector(Node<TYPE> *headPtr)
{
    vector<TYPE>* list = new vector<TYPE>;
    Node<TYPE> *currPtr = headPtr;
    while (currPtr != NULL)
    {
        list->push_back(currPtr->data);
        currPtr = currPtr->nextPtr;
    }
    return list;
}

Note that inside your look, you are creating a new list on each iteration. You need to create the list outside of the loop. Also, by creating an object on the heap (vector<TYPE>*) and returning the pointer, you avoid the overhead of copying the entire list on return.

Also note my change in the function signature. I assume you meant to pass in the head pointer? :-)

Anyway, these are common issues in your code. You are getting there, but you have work to do yet! Keep it up.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Rik, if you want to run FreeDOS, run it in a virtual machine. It thinks it owns the hardware, so DO NOT try to run it directly on your computer. I've had no problems installing it in a VirtualBox VM. Tell VirtualBox that the Type is "other" and Version is "DOS".

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Then for all of these, using the list-to-array-sort-back-to-list methodology is the most straight forward in my experience. Using qsort() for an array is trivial - you just need a comparison function, which is also valid for bubble and insertion sorts. For your case, you will likely find that the insertion sort is the most efficient, if implemented properly - consider head/tail optimizations for large lists. Use memmove() to move the data elements down one index location in the array instead of moving each separately from the insertion point. Think about these points and see what you can do to implement them, and at that point I will critique your work if you are still having problems.

Finally, consider writing out the algorithms you are going to implement in pseudo code. I will be happy to comment on that as well.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

An approach I have used in the past quite effectively was to create an array with the data in the list, sort that, and then use the sorted array to recreate the linked list. Sorting a linked list directly is a real PITA, and AD's suggestion is one possible method. BTW, what ARE the 3 sorting algorithms you are to use. Obviously, from your post, an insertion sort is one. I am going to assume (possibly wrongly) that the others are a bubble sort, and a quicksort?

For the insertion sort, walk through the list and insert the data into an array at the appropriate position (possibly needing to move the items below it down one element, hence the "insertion"). Then you can move the data from the array back into the list on a 1-to-1 basis.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you want to figure out how to write your on DOS (Disc Operating System), look at FreeDOS - an open source version of MS-DOS: http://www.freedos.org/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The images are too small and are unclear when expanded to a reasonable size. Please repost the images at a larger scale.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It all depends upon the word size of the architecture. A 32-bit system will be 4 byte aligned. 64-bits will be 8 byte aligned. This is a definite case of caveat programmer (programmer beware)! :-) A lot of new developers have been bit by this.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Hibernate, spring, and struts are all pure Java. They have nothing to do with JSP, servlets, et al. RTFM - Google is your friend!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What AD said, and thanks for posting your code. We get a lot of people just asking for us to do their homework for them, without trying to solve the problem(s) themselves. You get an up-vote from me for that! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I haven't analyzed Banfa's answer for correctness, but it looks good! IE, in n days, 2^(n-1) == really big number for medium sizes of n. Example, 2^(16-1) == 32768, 2^(32-1) == 2147483648. So, in 31 days (about a month) they'd owe about a billion $. :-) Of course, in a 30 day month, it would be 1/2 that, and in a leap-year February (29 days) "only" $250M, and $125M in a normal February... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

For C++, there isn't much of a problem. With C, it is preferable to use malloc/realloc to resize arrays. The nice thing about realloc is that that data in the old array will end up in the new one. You only need to zero out the new elements. I have used this in C++ code for resizable collections of stuff, to great effect.

Note that in Moschops example, the elements of a[n] are not initialized and can be any value held by an int, which in this case is whatever is in memory on the stack at the time of construction. He uses scanf() to initialize the members, but it is usually appropriate (and safer) in such a case to simply zero out the array members before use. IE, memset((void*)a, 0, sizeof(a));

If 0 is a valid value, then use -1 for the value, as in memset((void*)a, -1, sizeof(a));

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also, since the function returns a reference to an object, returning 0 (null) is not valid! This function should ALWAYS return os.

cambalinho commented: thanks +2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

"Thanks for replying. Indeed,it is a school project and I don't need the code written. I just needed a heads up and your comment helped me that way. I will follow your directions and if I want to do this on GUI, will that be too hard to implement?"

Java has some very good GUI libraries to use that will help in this regard such as Struts, Struts 2 (a newer version of Struts), JavaServer Faces, Tapestry, Wicket, Spring MVC, Stripes, and probably more. Do some Google searches on these libraries and decide which to use (you only need one). Struts/Struts-2 are popular choices. Not necessarily the best or easiest to use, but popular. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is not C++. What are the '^' tokens doing in the argument list? Also, is rbFromInches->Checked a member variable, or a method. You are using it as a variable. Finally, this is not enough code and context to know what you are doing. :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is this a school project? We won't write your code for you, but we will help you sort it out if you make a reasonable attempt at solving the problem.

Your first problem is to model the system. Java is object-oriented. Before you even get into the code, think about the entities you need, such as Ticket, Reservation, WaitingList, Passenger, FlightSchedule, etc. These are your classes. Then, think about the behavior of each class, and write in plain language how each behavior should work. Example for Ticket - reserve the ticket, book the ticket, etc. Example for Reservation - confirm the reservation, cancel the reservation, etc. Finally, think about how each class of item reacts with the others. Methods from one class will likely interact with other classes.

Be thorough and complete. Once you have done this, you will be ready to code. FWIW, I have written very complex systems in Java and C++, and 80-90% of my time is spent in modelling the system, and 10-20% in actually writing the code. Why? Because once I understand the system and how it has to behave, the coding is just a matter of implementing what I have created, but in another language.

As for learning Java, the language itself, there are tonnes of books and tutorials out there, many of which are available online. Remember, Google is your friend! :-) Here is a link to the java classes/api's for Java 7: http://docs.oracle.com/javase/7/docs/api/ - I have found this resource invaluable …

অসীম commented: Thanks for replying. Indeed,it is a school project and I don't need the code written. I just needed a heads up and your comment helped me that way. I will follow your directions and if I want to do this on GUI, will that be too hard to implement? +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I agree with Mike that the preferable construct is int* var - indicating that it is an integer pointer, which is an actual type. Moving the * to either next to the variable name, or between the int and variable name as your last example shows, kind of obfuscates that distinction.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I hope you have a good (great) attorney. If you sold an app that does A to Google (or whoever) for a gazillion $$, then write one that does something entirely different! If it is as great as the first one, then Google (or whoever) will probably pay you 2 gazillion $$ since you have a proven track record!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. We don't do your homework for you. Do you understand C++ passing function arguments by value vs. passing them by reference? If not, let's start there. If you do, tell me what YOU think they mean (with illustration code), so if you are falling into the deep end I might be able to help you get back to shore! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Not doing your homework for you, but will give a clue, think bit-wise comparisons based upon some bit of information in your "truth table".

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Looks sort of like Windows DOS shell code. Gah...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Very much different. Android runs stuff in a virtual machine that takes java code and compiles it into Dalvik virtual machine code. Apple apps are more machine-level and use (I think) Objective-C (an object-oriented language similar in some respects to C++) which is then compiled into native code. IE, if you have an application or game that you want to run on both systems, you will have to port it from one to the other. There is a tool called webapps (I think it is Javascript) that both may support, but I'm not sure. If so, then that may be your best option. In any case, webapps is a browser-based language. It will only run in the confines of your mobe's web browser.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

See my reply to D Ray about his power problem. Likely similar situation.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Jason, I know what you mean, though I do some of my best work at stupid o'clock, after a couple of shots of good scotch. My head hits the keyboard, and it finishes the task for me! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also, general pointers-to-functions is useful for what we call jump tables - functions to call based upon some index value. It is used a lot in Linux kernel programming - you get one input and you call one function. You get another input and you call something else. This can be done much more efficiently (and dynamically) than hard-coded if/else or switch statements.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, pointers to functions is useful stuff. It can be especially useful in complex polymorphic stuff. We use pointers to member functions for this sort of stuff, so you can change the behavior of classes dynamically at runtime. An example would be to enable different callback functions for event handlers depending upon differing criteria, without having to depend upon derived classes for each type. This is one of the more obscure areas of C++ programming, but I have found it useful in the past. That said, the last time I used pointer-to-member-functions was about 10 years ago. I generally try to keep stuff simpler than that since it tends to give one a headache trying to determine what is going on! Testing is a real PITA... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Exactly what Moschops said. Here is a proper implementation, but still pretty useless... :-)

void* aFunction(int* pToInt)
{
    cout << "something" << endl;
    return (void*)pToInt;
}
void f_voidFct()
{
    void *(*voidPtr)(int *);
    voidPtr=aFunction;  // here I get the error
    int a=5, *ptr_a=&a;
    void* p = voidPtr(ptr_a);
    // p should have the same value as (void*)&a or (void*)ptr_a
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The extern keyword declares that a variable or function is implemented elsewhere, likely in another translation unit (source file). The static keyword is another beast, and depends upon whether it is declared such in a header or in a source file. If in a source file, then that is a local variable or function. If in a header, then a unique instance of that item will be created in each source file that includes the header. In such a case, if it is a function declaration, then each affected source file will have to implement the function. In such a case, it is better to implement the function in the header as an inline function, unless you want differnt implementations for different sources.

Do note that the above does NOT apply to static member functions or variables of classes. In any case, there is a good discussion of these issues here: http://stackoverflow.com/questions/558122/what-is-a-static-function

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you tried one of the other php mysql libraries, such as the mysqli class? I have had good results with that connecting to remote servers. Here is some code, the class I use to connect with mysql servers from my php applications:

<?php

// php_flag register_globals on
// Some includes here.

/**
 * Encapsulates the mysql connection to the application database.
 * @author zippy
 * @version 1.0
 * @updated 23-Sep-2013 3:56:25 PM
 */

class MyAppDbConnection
{

    private $m_DbHost = NULL;
    private $m_DbPort = NULL;
    private $m_DbName = NULL;
    private $m_DbUser = NULL;
    private $m_DbPassword = NULL;
    private $m_DbConn = NULL;


    /**
     * 
     * @param host
     * @param port
     * @param dbname
     * @param dbuser
     * @param dbpass
     */
    public function __construct($host = "localhost", $port = 3306, $dbname = "whatever", $dbuser = "zippy", $dbpass = "")
    {
        if (is_null($this->m_DbHost))
        {
            $this->m_DbHost = new String('p:'.$host);
            $this->m_DbPort = (int)$port;
            $this->m_DbName = new String($dbname);
            $this->m_DbUser = new String($dbuser);
            $this->m_DbPassword = new String($dbpass);
        }
    }

    public function __destruct()
    {
    }

    public function connect()
    {
        if (is_null($this->m_DbConn))
        {
//            print 'Connecting to MySql<br/>';
            $this->m_DbConn = new mysqli($this->m_DbHost . ':' . $this->m_DbPort,
                                        $this->m_DbUser,
                                        $this->m_DbPassword,
                                        $this->m_DbName);
            if ($this->m_DbConn->connect_errno)
            {
                print 'Unable to connect to MySql: ' . $this->m_DbConn->connect_error . '<br/>';
            }
            else
            {
                print 'Connected to MySql<br/>';
            }
        }
    }

    public function disconnect()
    {
        $this->m_DbConn = NULL;
    }

    public function fetch(String $stmt)
    {
        return $this->m_DbConn->query($stmt);
    }

    public function prepare(String $stmt)
    {
        return $this->m_DbConn->prepare($stmt);
    }
}
?>

Note that I do build my php from source and …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I don't know about Astra32, but if it is looking at the smart interface of the SSD, then it is probably correct. SMART is a tool on most all current drives that monitors in real-time the behavior of the drive, including disk read errors, sector remapping, temperature, etc. On my Linux system, I use it to monitor my drives, and when it indicates that a drive is starting to degrade, or fail, then I know I need to replace it. I had a failing drive this week that because the SMART interface informed me of this situation, I was able to back up the data to a new drive to replace it. It is now FUBAR, but because I saw the situation in time, I lost no data (including all of my Doctor Who collections, going back into the 1960's).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

64-bit system? Run a 64-bit OS. Yes, 64-bit pointers in your software take more space, but not enought to make any significant difference. In any case, your system can take better advantage of available memory, and swap (virtual memory) space, and will perform better since the CPU is designed to handle 64-bit operations more efficiently. In such a case, smaller is NOT better! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, you could always fall back on the old C standard fprintf() format strings. Sometimes it is a lot easier than C++ output manipulators, though if your class is trying to teach you C++ output manipulators then that may not be an option... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Bit-wise comparison != numerical comparison. In a your comparison it is only looking to see if the fourth bit is set.. For -8 the top bit is set for the negative, as is the fourth bit, hence your problem. For a bit comparison of two numbers do this:

if ((a&b) == a) // a==b

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Try this:
if "%2" == "" goto end
It has been a long time since I have written any complex DOS/Windows batch commands, so I may be mistaken... :-)

theashman88 commented: Thanks for your help it worked +2