rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

:-) LOL! Correct! ... You need to use the -L option with find to follow symbolic links. From the "find" man page:

        -L     Follow  symbolic links.  When find examines or prints information about files, the information used shall be taken
              from the properties of the file to which the link points, not from the link itself (unless it is a broken symbolic
              link or find is unable to examine the file to which the link points).  Use of this option implies -noleaf.  If you
              later use the -P option, -noleaf will still be in effect.  If -L is in effect and find discovers a  symbolic  link
              to a subdirectory during its search, the subdirectory pointed to by the symbolic link will be searched.

              When  the  -L  option is in effect, the -type predicate will always match against the type of the file that a sym-
              bolic link points to rather than the link itself (unless the symbolic link is broken).  Using -L causes the -lname
              and -ilname predicates always to return false.
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please clarify. This description is not helpful, to me at least. Are you trying to understand enums (enumerated data types)? What exactly are you trying to accomplish?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What Ktsuekiame said, plus this:

in your first loop, you are only moving the next element to the space. You need top move ALL of the data one character toward the head of the string, not just one. This requires another loop inside the first one. I think your teacher is trying to instruct you on nested loops... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

No matter the programming language, the process to solve this problem will be the same. Start by writing out the steps you must take, and data structurs you need, to implement the solution. As others have said, we don't do your homework for you...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There is a company that only sells Linux systems (laptops, desktops, servers) at reasonable prices: www.zareason.com

Ancient Dragon commented: nice link +14
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Run this is your debugger so when it segfaults you can tell where it was when it happened. Then you can tell more easily why it dumped core. Also, asking us to analyze almost 300 lines of code is really unfair - we donate our time. It is valuable. Don't abuse it!

Ketsuekiame commented: A good point well made :) +9
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In any case, this is a situation where building a debuggable image and running it in the debugger would quickly show you what/where your problems were.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, what is your problem? Just posting code isn't usually helpful. In any case, the problem is passing *c to qsort instead of just c. The other problem is in your final print loop, you are passing *c[i] to the printf statement instead of c[i].

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Shell variables, including environment variables, are context sensitive. IE, you set a variable in one script, it (or its changes) are not visible outside of it after exit. If they are exported environmeent variables, then they are visible to scripts that IT calls, but not to the script that called it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Why are you using strings to contain numeric (int) values? Why aren't you using arrays of ints instead?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Asking "What's the best programming language?" is much like asking "What's the best airplane?" - it entirely depends upon what you want to do with it.

For system-level programming, C and C++ are the languages of choice.
For system-management and scripting, bash, Perl, and Python rule.
For complex application development, C++, Java, and (for .NET applications) C#.

And of course there are other niche languages such as Haskell, ObjectiveC, prolog, lisp, snobol, fortran,... This list is VERY long! :-) I once did a lot of programming in Dibol, a business language developed by DEC. You can still get it for PC's - called DBL. Just do NOT EVER ask me to program in it again!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but we don't do your homework/schoolwork for you. Make an honest effort first, post what you've done here, and we may then want to critique your work, but let's just say you have NOT gotten off to a good start! :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

By the way, here are a couple of excellent articles on this subject in this week's Embedded Systems newsletter: http://e.ubmelectronics.com/audience/UBMTechNewsletters/07-29-13-EMB-Tech-Focus.html

ddanbe commented: Hey! Good newsletter tip. +14
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The "warranty center" owes you two things: one is a new set of Windows restore discs. The other is to install the restore partition as per OEM requirements. If they will not do so, then file a formal complaint with Toshiba and your state attorney general.

JorgeM commented: great advice that lead to a good solution! +12
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

How is this connected to the system - sata, usb, ide?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster
  1. Make fewer laws.
  2. Fishkill is a town in New York state. There is no solution!
  3. Better marketing.

IT solutions? Who the heck IS your professor/advisor? These are (in my opinion) totally bogus! I'm sure you can come up with some IT approaches to these problems, but why?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Agreeing with ddanbe 100%... If you have no clue now as to what you are interested in with regard to this field of study, then you should change your focus to something like marketing...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Many of the issues involve garbage collection, and its impact upon performance. There are techniques (too involved to get into here) that can be used to improve its efficiency. In fact, there are real-time java virtual machines that use reference-counting GC's vs. the default mark-and-sweep variety; however, most mobile devices use standard JVM's. As a result, this can become an issue unless you employ such techniques as pre-allocating data buffers, store them in pools, and use those for application objects as necessary, reducing the amount of GC required at run time. These techniques are generally NOT taught in most Java programming courses. C++ has similar issues, and so some classes (such as string classes) will implement their own allocators and assign pre-allocated buffers from a pool to class instances as necessary, and return those buffers back to to the pool when they are no longer needed. FWIW, string classes in both Java and C++ often use reference-counting to determine when to delete the underlying string buffer, and copy-on-write (COW) algorithms to determine if a buffer needs to be physically, vs just the pointer being assigned to a new object.

FYI, I own both the first and second editions of the JVM specification books (and have studied both to a great extent), and have done extensive research into garbage-collection algorithms, having implemented a C++ reference counting GC that has allowed major manufacturing systems comprised of 10M+ lines of C++ code to operate without memory leaks and NO application-level delete calls whatsoever. …

frankenfrank commented: interesting and useful post +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You just want to chart securities market moves during the day? Look into charting tools such as GNUplot. That would work very well, and you can tie it to a browser window using JavaScript very easily.

In case you are insterested, I spent at different times about 4 years doing serious stock/options software development for index fund management and then options risk analysis and hedging tools. I worked both as a consultant for the Mellon Bank and as principal developer for a company associated with the Chicago Board Options Exchange (CBOE). I know something of the subject if this is what you mean.

In any case, if you just want to display intraday plots of securities, then I do advise the browser->javascript->gnuplot approach. Most of the "heavy lifting" is already done, and you will mostly need just to periodically push the new data points into gnuplot and then display the graph using javascript.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Java is Java. Mobile, PC, server - it is all pretty much the same code. Android uses a version of Java called Dalvik - it is Java code, but with a different compiler and byte-code interpreter (virtual machine). That said, how you approach application development in each such environment is very different. Mobile devices are much more resource constrained (memory, CPU, storage, etc). You need to be more aware of these issues and operate accordingly. I am a senior engineer for a major mobile phone manufacturer and we write Java code for all the above. Some phones (of the "smart" variety) are pretty well endowed with CPU and RAM, but a lot that we sell are not so (so-called "feature" phones). We write software that has to run on all of our devices, and that is a definite challenge!

These days, most mobile applications that 3rd parties sell are what we call "webapps", using the WebApp API's. That helps insulate them from such issues for the most part. In our case, those applications actually run on our server farms (thousands of high-end Linux servers running all over the world), and only the UI runs on the phone (input and output). Even the rendering of the display occurs on our servers, and only the input/output are handled by the phone. This is becoming more and more a common pattern for mobile phone applications. Tablets are more capable, so this is less an issue for them. In any case, because the actual …

frankenfrank commented: thank you for teaching me this +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Depends upon the optimizer - both execute 100,000 assignments in the end. If the optimizer is good, it will detect that you are assigning x from y without any computation, so it would optimize out the loops and just assign y to x once.

Unimportant commented: Great irony. =) +4
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please indent your code, otherwise it is VERY difficult to read! Example:

int* merge (int *a,int *b)
{
    int *arr;
    int i,k,j;
    int size= MAX1+MAX2;
    arr=(int *)malloc(sizeof(int)*size);
    for(i=0,j=0,k=0; k<size; k++)
    {
        if(a[i]<b[j])
        {
            arr[k]=a[i];
            i++;
            if (i==MAX1)
            {
                for (k++;j<MAX2;j++,k++)
                arr[k]=b[j];
            }
        }
        else
        {
            arr[k]=b[j];
            j++;
            if (j==MAX2)
            {
                for(k++;i<MAX1;i++,k++)
                {
                    arr[k]=a[i];
                }
            }
        }
    }
    return arr;
}

That makes errors a LOT easier to find! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

DarkLightning7 is about 99% correct... :-)

In reality, you need to understand context. When you call a member function of an object, inside that function, "this" refers to the object in context - that the function is operating on. Inside the constructor of SomeClass, "this" is no different than inside the Someclass member function someFunction(). IE, it helps you identify the specific instance of the SomeClass you are operating upon. Confused yet? :-) This is normal.

So, think of it this way. You have a class called Car. You create an instance of a car (make or model not relevant here). You get into the car. In that case "this" refers to the car you are sitting in. Clearer yet? So, you call the Car::start() method. Inside the start() method, "this" refers to the SPECIFIC car you are starting. So...

Car myCar = new Car;
myCar.start(); // Inside start() here, "this" refers to myCar.

Still confused? Keep asking questions. We'll try to get you sorted out! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Thanks for the comment, nitin1. I've been in this business for 30+ years, published articles, contributed to graduate-level text books on large-scale distributed systems, have a US patent for adaptive system software, and was the principal architect/engineer for the software that runs most 300mm semiconductor, flat-panel displays, and disc drive plants in the world today. FWIW, I am an engineer without degree... yet I am titled Senior Systems Engineer for Nokia. If I didn't have the chops, I wouldn't have the title!

I have been doing OOP since the late 1980's. Hold on a second while I grab a few tomes from my bookshelf...

Ok. Here are 4 that I have got a lot out of:

  1. Design Patterns - Elements of Reusable Object-Oriented Software, by Gamma, Helm, Johnson, and Vlissides.
  2. Analysis Patterns - Reusable Object Models, by Martin Fowler
  3. C++ Programming Language, by Bjarne Stroustrup (the creator of C++)
  4. UML Distilled - Applying the Standard Object Modeling Language, by Martin Fowler (forward by Booch, Jacobson, and Rumbaugh)
nitin1 commented: huge respect!! +0
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Don't give short shrift to "bookish type knowledge". I was giving a paper at the OOPSLA conference in San Jose in 1996 and was in the meeting where Booch, Rumbaugh, and Jacobson announced that they were merging their different, but complimentary, object oriented design methods into a single form, UML, and that they would all be updating Rational Rose to encompass that new modeling paradigm. Booch is a great teacher, and if you really want to get into OOPS, then you need to read such books so you can start to get an intellectual appreciation and understanding of the domain. Students of science first take classes to get the theory, and then they go to the lab...

And, good luck!

nitin1 commented: yoo!! too motivating.idk how you meet all thee people. you once said about some intel person, he was your freind. :p +2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Have you installed the wxGTK, wxGTK-gl, and associated development packages?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Learning basic C/C++? Better to use GCC compilers and tools rather than MS ones - they are more "standard". You can install MingW or Cygwin on Windows, or a Linux virtual machine (with Virtualbox for example), and learn there. MS Visual Studio is specific to the Windows environment, and does not translate to other systems very well at all.

FYI, I have 30+ years software development experience in Unix/Linux as well as Windows environments. I only program in Windows (Visual Studio) when I have to, because of its "unique" requirements. IE, code developed for Windows ONLY runs on Windows! Whereas code developed for open source systems (posix primarily) will run pretty much anywhere, including Windows.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

One of the main reasons to use references rather than pointers is that you don't need to check for a null pointer. The object must exist to get a reference to it. A pointer may or may not point to a real object (null if not).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you want 100% control over your software build process, then the only option is (IMO) make w/ appropriate Makefiles, standard compiler, and a command line debugger. I've used many IDE tools such as Visual Studio, Eclipse, Code-Blocks, and others. I always revert to make+Makefile for my serious work.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It is likely that the attributes on the directory in question don't allow this. You need to enable the read, write, and execute permissions accordingly, assuming that the directory is not owned by the writing process(es).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Here is a copy of the Linux C Preprocesor man page (it is a bit long):

CPP(1)                                GNU                               CPP(1)

NAME
       cpp - The C Preprocessor

SYNOPSIS
       cpp [-Dmacro[=defn]...] [-Umacro]
           [-Idir...] [-iquotedir...]
           [-Wwarn...]
           [-M|-MM] [-MG] [-MF filename]
           [-MP] [-MQ target...]
           [-MT target...]
           [-P] [-fno-working-directory]
           [-x language] [-std=standard]
           infile outfile

       Only the most useful options are listed here; see below for the remainder.

DESCRIPTION
       The C preprocessor, often known as cpp, is a macro processor that is used automatically by the C compiler to
       transform your program before compilation.  It is called a macro processor because it allows you to define
       macros, which are brief abbreviations for longer constructs.

       The C preprocessor is intended to be used only with C, C++, and Objective-C source code.  In the past, it has
       been abused as a general text processor.  It will choke on input which does not obey C’s lexical rules.  For
       example, apostrophes will be interpreted as the beginning of character constants, and cause errors.  Also, you
       cannot rely on it preserving characteristics of the input which are not significant to C-family languages.  If
       a Makefile is preprocessed, all the hard tabs will be removed, and the Makefile will not work.

       Having said that, you can often get away with using cpp on things which are not C.  Other Algol-ish programming
       languages are often safe (Pascal, Ada, etc.) So is assembly, with caution.  -traditional-cpp mode preserves
       more white space, and is otherwise more permissive.  Many of the problems can be avoided by …
christinetom commented: Big help, thanks +1
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It mostly has to do with the order of evaluation in your code, which is "implementation defined". IE, on one compiler it may work like you would expect, and another it won't (as this is an example). Consider this, when you call func() the first time, it outputs 0, and returns 1, yet data now has a value of 2 (the value of data before the second increment is placed on the return stack before the increment). The issue is in the line cout<<b.func()<<b.func()<<endl; in main. Since the output is 0231 and not 0123, the compiler is valuating the second call of b.func() before the first (right to left instead of the intuitive left to right), yet the results of the first is output before the return value of the second. Confused yet? :-)

So, the second is evaluated first - printing 0, returning 1. The first is evaluated next, printing 2, returning 3. The return value from the first is then printed in the line in main before the return value of the second, resulting in 0 (from the second), 2 (from the first), 3 (return value from first), and then 1 (return value from second). Confused yet? :-) Welcome to the world of C/C++ compiler quirks!

In any case, this is a good example of a compiler that evaluates arguments to functions in a right-to-left manner (common, due to the use of recursion in building parsers). It is also a good reason to avoid stuff like this: int …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It is unfortunately that this has happened to Opera. They are our biggest competitor in the mobile browser arena and we have a LOT of respect for them. The fact is that this can happen to anybody. Let your guards down in any small area for just a minute and some opportunistic creep will exploit it. We learn from our mistakes, and what differentiates the good companies from the bad is how they deal with it. Admit you screwed up, fix it, and move on are the hallmarks of a good company - one you can trust.

That said, we (Nokia) are going to eat Opera's lunch! At least in the mobile universe. :-) At least that's what we'd like to think... :lol:

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a number of ways to do it. A good way to start is a live usb drive you create with the tool unetbootin: http://unetbootin.sourceforge.net/ That will create a live usb (bootable) drive without touching your computer disc drives. A 4GB thumb drive will do nicely.

The other way is to create a persistent usb image that you can write to just like any disc. Like the live usb, it won't touch your computer discs without you doing so specifically. There are a number of distributions that have such images and tools to install them including Ubuntu, Mint, and others. See their web sites for the tools, images, and instructions. Again, a 4GB or larger thumb drive will work nicely. If I were creating a persistent usb image I would use a 32GB thumb drive as that would have plenty of room for storing documents, installing new software, etc.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You did ask one question - what are nested classes? So, I will answer that. The other issues I assume are class problems, and we don't do homework...

Nested (inner) classes are classes declared/defined in the context of another (outer) class. They can be public or private to the outer class as desired. Here is an example:

class foo {
public:
    class bar {
    public:
        bar() { std::cout << "instantiating foo::bar instance" << std::endl; }
    };
    foo() { std::cout << "instantiating foo instance" << std::endl; }
    bar& getBarMember();
private:
    bar m_barmember;
};

foo::bar& foo::getBarMember()
{
    return m_barmember;
}

int main(void)
{
    foo aFooInstance;
    foo::bar& bm = aFooInstance.getBarMember();
    return 0;
}

You should get the following output when you run the program:
instantiating foo::bar instance
instantiating foo instance

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Time to read the x86 assembler manual. You should be able to find a copy on the Intel web site...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

L7Sqr gave a great synopsis of this. It is not a simple subject. If you want more info, see this wikipedia article: https://en.wikipedia.org/wiki/IEEE_754-1985

FWIW, my best college buddy, Bruce Ravenel, was the architect of the Intel 8087 math co-processor back in the late 1970's, the first implementation of the IEEE 754 standard in hardware. It is still part of our Pentium processors today. FWIW, the 8087 did all computations in 80 bits (not 64), resulting in incredibly accurate computations for the time, pretty much eliminating all rounding errors.

Ok. Continued reading indicates that the 8087 design is not part of the current Intel chip sets, though it has to have been a major contributor to the current math capabilities of Intel's processors. I think they are using 128 bits now... :-)

Moschops commented: I like to reward name-dropping :) +8
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

That is the speed of the RAM chips and channel. If your RAM modules are 1333 capable, and the channel supports that, then you get about a 1/3 memory I/O speedup, which can be significant - hence my comment about "faster == better". :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Faster is better. 64-bits is better than 32. ECC memory is better because your computer will continue to run if there is a memory chip problem. As for 8GB of RAM for Win7-32bits? Don't bother - it can only use 4GB of ram, which is why you REALLY want to install the 64-bit version. It can still run 32-bit applications.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In my words, Java == C++ with training wheels. The biggest issue is which components to "include", much like C and C++... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think it means that the text it is parsing has to be in standard 8-bit ascii or utf-8 format. IE, if your locale (or the user's) is set to Chinese or such (unicode - 2 bytes / character instead of 1), then it cannot parse the text as a number.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

An interpreter is not the same as an emulator or compiler. An binary code interpreter will interpret the machine instructions dynamically at run time. An emulator will be an environment that poses as the target machine, and execute the instructions just like a physical machine. A compiler will take source code and turn it into machine code, which can then be executed on a physical machine, an emulator, or interpreted by the interpreter.

In Linux system, Qemu is an emulator support framework - allowing emulation of many classes of machines. The GCC compiler suite takes source and turns it into the target machine code. It is rare to see a machine-level interpreter these days. Source code interpretation is not so uncommon however. IE, there are C and C++ interpreters that can take source code, and run it without compilation. An emulator requires code already compiled for the target hardware.

Confused yet? :-) This is very advanced stuff...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Did some more debugging. To is initialized to 0, but you are dividing by To (divide by zero == no-no) at the start of the loop so it doesn't go into the loop. So, your solution is to use do {} while (condition); instead of while (condition) {}; - that will work for both cases. FWIW, trapezios not returns 0.954499 and simpson returns 0.954500 as it did before.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

See item #3 in your list of instructions - modify an existing game. That seems to be the crux of the problem. Your professor appears to want that you take one of those single-player games and adapt it to a multi-player model. Sounds like a challenge! :-) He/she is trying to get you to think how to take what is, and adapt it to your needs - requires thought, design effort, and coding work. Good luck!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And get a good reference book, such as Bjarne Stroustrup's "The C++ Programming Language". The current version is the 4th edition - all 1200 pages... :-) Stroustrup is the author of C++, so if there is a better reference, I haven't found it!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

"no as in why would the OP purchase debian?"

Simple. Some times people either are uncomfortable downloading and burning CD/DVD discs, so they purchase ready-to-run media, or they don't have an adequate burner. IE, you can go online or to Best Buy and purchase many Linux distributions... :-) What you pay for is the manufacturing and distribution for the most part. It may cost you $25-$30 instead of $100+ for Windows, etc. Ubuntu used to have a free media program where they would send you free the entire system on CD/DVD, though you had to wait for awhile. I actually got one of those once just to see. Naturally, mostly I download and burn (or create a VM) the iso images. A 4GB live DVD takes me about 2 hours to download, and 10 minutes (and a $0.50 disc) to burn.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, you want us to do your homework for you? :-( Not going to happen! Make an honest effort and if you are still having problems, post the code here and we might decide to help you... DO NOT CHEAT!

nitin1 commented: true!! +2
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Do you want to change the environment variables for all users, or just your own account? Files that start with a dot are not visible. If you want to see them, run the command "ls -a ~". You should see all the files and directories, including the dotted ones, in your home directory. In any case, don't make the changes in .bashrc - it is better to set them in .bash_profile.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Speak with your advisor if you can't come up with a suitable subject on your own. Part of the educational process is learning how to explore the domain you are interested in, and choosing a thesis project is part of that. This is not the place to ask this question as the subject matter is pretty much limitless.