rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Has this tape drive + tape worked before? Did you rewind the tape after erasing it?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What cereal said. Also, if you are running a GUI desktop, then the file system browser will also work for you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The content of software engineering are requirements, models, code, test plans, documentation, and a lot more. The end-game output is software.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Use std::cout instead, unless you added the line using namespace std; at the top of your code (after the #includes).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And your problem is what?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

@NathanOliver
The OS will cache the file (at least Linux will), but if the stream is using unbuffered I/O, then it will not pass that to the process. It will usually physically read every time you access the file to read a line of data.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is where you would use the std::set template class. It will automatically order your data for you. You can specify an optional comparison function to the template if you want something other than natural order, such as reverse ordering. Here is some documentation for the class: http://www.cplusplus.com/reference/set/set/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The C++ STL (Standard Template Library) has a lot of collection types which will work well for this including vectors (resizable arrays), maps, hashmaps, etc. Go to http://www.cplusplus.com/reference/ for the entire reference manual.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What does top, sar, iostat, netstat etc tell you? Just describing the problem as you did isn't particularly helpful. Many things can cause this sort of issue. You do have sysstat (sar) running don't you? :-) Also, do you have Glance installed on this system? That will tell you a lot.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I don't know about windows cmd.exe doing this, but the bash scripting language does it just fine:

pass `brute_force` >output.txt

The back-quotes execute the brute_force command inside them, and then insert the output at that location in the argument list to the pass command. You can get a bash shell by installing the cygwin tool set in Windows - that will give you a pretty decent unix/linux environment, and still be able to run Windows programs from the bash command line.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Physically, any 2.5" laptop sata drive will work. However, a lot of the Sony Vaio hardware has embedded identifiers that the BIOS interrogates and if they aren't Sony "branded" devices, they won't work. The only way to tell for sure is to try one. I know we had issues of this sort with a Vaio that my wife had some time ago.

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

Windows 8 has enabled EUFI secure boot. You need to disable that via the BIOS settings, or you need to be sure that the Linux distribution you are installing is secure boot enabled (signed kernel and drivers). This is a serious problem these days. IE, don't purchase ANY computer with Windows 8 pre-installed if you want to run Linux on it! Yes, you can, but it is a serious PITA. FWIW, you cannot disable secure boot on ARM systems (tablets) with Windows 8 or RT pre-installed.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

As far as I know, these is no "standard" way to do that. What precisely are you trying to do, other than count the number of object that have been instantiated?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

One way is instant messaging. Install Pidgin. Open source and works well: http://www.pidgin.im/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, it indicates that you have edited the source file since you built the image. Rebuild, and rerun to be sure it is crashing where it thinks it is. Then, we can take a closer look at the source. In any case, please generate a stack trace so we can see where in the call tree it is, other than right now it thinks it is crashing at line 218 in main() in the call to gsl_rng_env_setup. Since the source has changed since you built it last, this may not be really where it is crashing... :-)

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

This is a variant of the "Traveling Salesman Problem". There are well-known algorithms and programs that deal with it. The problem is not perfectly solvable without searching ALL possible routes, but good solutions are possible with reasonable use of computer time. Here is a link to the wikipedia article about the subject: http://en.wikipedia.org/wiki/Travelling_salesman_problem

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I think you wanted this:

 's/\(wireless\.1\.ssid=\).*/\${SSID}'

to be this:

 's/\(wireless\.1\.ssid=\).*/\${SSID}/g'
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Both of the above replies are basically correct.

  1. Provide your code.
  2. If you are trying to use the comparison operator (==) on a non-trivial class, you need to write an '==' operator to deal with it.
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Specific error messages would be helpful...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

IE, what sepp2k said. IE:

    #include <stdio.h>
    #include<string.h>
    struct student
    {
        int* ptr[23];
        char* name[12];//store address of character string
    }s1;
    int main(void)
    {
        int roll=20;
        s1.ptr[0]=&roll;//ERROR
        s1.name[0]="zahid ali";//ERROR
        printf("roll no of student :%d\n",s1.ptr[0]);
        printf("name of student:%s\n",s1.name[0]);
        getch();
        return 0;
    }
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The stdout stream is buffered. It doesn't get written to output until either some time has passed, or the buffer is full. To ensure that output to stdout is printed immediately, then you need to call the fflush(stdout) function after the fprintf(stdout,...), or printf() function.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

/etc/hosts is not used to override DNS settings. That would be /etc/resolv.conf, which in many systems is reset from network settings on reboot. It is better to use the network manager tool to reset your DNS server entries. That way, when you reboot, the DNS servers you prefer are made active in /etc/resolv.conf.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Look at the scoping of your statements. Each process will output info about the parent process, including the root process, hence the 3 messages about parent process pids. This is where properly indenting your blocks of code can be helpful. IE:

#include <stdio.h>
int main(void)
{
    int child1,child2;
    int i;
    child1 = fork();
    if(child1==0)
    {
        printf("This is a child1 process and pid is %d\n", getpid());
    }
    else
    {
        child2=fork();     
        if(child2==0)
        {
            printf("This is child2  process and pid is %d\n",getpid());
        }
    }
    sleep(1);
    printf("The parent process has pid %d\n",getppid());
    return 0;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you want to protect such stuff, use an encrypted zip folder. NEVER rely upon proprietary software like this - caveat user!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can always test the high bit of the expression to verify that it is a 0, in which case a shift will/should be ok. Usually, getting to this level of optimization is a case of "is it fast enough?". Code logically, and suscinctly first. Then, if it is too slow, look at optimizations. There are always trade-offs, especially in the domain of efficiency vs. simplicity/ease-of-maintenance. To quote myself:

"First, make it as simple/clear/reliable as possible, then make it fast, but ONLY if you need to!"...

After 30+ years of serious coding, this is advice I give myself every day! :-) IE, keep it lean, and mean, and then worry about performance. Usually, the former takes care of the latter.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your second example should work. What platform+version+kernel+bash version are you running? You could try this:

TS20="710000\/393"

as an option.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please post the compiler errors, especially with regard to line numbers where the errors are detected.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The capability to automatically direct an X-Windows tool, such as this, to a specific workspace, is dependent upon the application supporting those options. Multiple workspaces is NOT an X-Windows capability, but one more associated with specific window managers. You will have to switch to the workspace you want to run it on first, and then start the tool.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The gcc variants for Windows are MingW, and the gcc native compilers in Cygwin. In any case, RTFM with regard to optimization settings (-ON where N is the optimization level). As for you specific code, the only thing I can see at the C level (sorry - bad pun) is the multiplication by 2. That can be reduced to a left-shift by 1 bit. IE,

/* Instead of this */
int ADDR = VIDEO_BASE + (WND_X + POS_X) + ((WND_Y + POS_Y) * SCR_X) * 2;

/* Try this */
int ADDR = VIDEO_BASE + (WND_X + POS_X) + (((WND_Y + POS_Y) * SCR_X) << 1);

The only real caveat here is if the left shift causes a register overflow.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Make an effort, show us the code, and we might help you debug it; however, we DO NOT do your homework for you.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ask HP support. It is unlikely that there are any simulators for this gear available, unless HP has one.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It is possible that the optical emitter or lenses are out of alignment. If this unit is under warranty, send it in for repair. Optionally, get a second, DVD, drive. You can purchase good DVD read/write drives for under $50 USD these days.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

File a complaint with your state attorney. If you have an attorney, have them draft a letter of demand to Toshiba, the warranty repair center, and the store where you purchased the system. Don't take no for an answer!

That said, you might be better off installing Linux on the system... :-) At least you won't have to put up with this BS!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is this an X-Windows program, or a text-based one? I don't have it on my RHEL 6.4 system, and it doesn't appear in any of my repositories.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is not simple. First how is the keypad and display connected to the 8051 - via uarts, or other I/O? If direct I/O to the 8051, which pins are involved with each? Do you know how to read the pins (set/read registers, etc)? Have you written out the pseudo-code to do all of that? What about timing issues?

So, don't expect us to do your work for you. Write out the pseudo-code first, and then write the require assembler code. At that point, we may be able to help you sort out the problems.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Pointers to integers are often used in C programming when you want to set an external variable inside a function, and return some other value. Example:

typedef struct {
  int sizeofbuffer;
  char buffer[1];
} somestruct_t;

int getSizeOfData(somestruct_t* pStruct, int* pBufSize)
{
    int err = 0;
    if (pStruct == 0)
    {
        err = 1;
    }
    else if (pBufSize == 0)
    {
        err = 2;
    }
    else
    {
        *pBufSize = pStruct->sizeofbuffer;
    }
    return err;
}

int myfunc(somestruct_t* pStruct)
{
    int bufsize = 0;
    int err = getSizeOfData(pStruct, &bufsize);
    switch(err)
    {
        case 0: /* Got data */ printf("buffer size == %d\n", bufsize); break;
        case 1: /* Void pointer received */ break;
        case 2: /* Should not happen */ break;
        default: /* Unrecognized error value */ break;
    }
    return bufsize;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

After ptr is incremented, it is pointing past the end of the stack frame, so if someone had placed some bad data on the stack in the right location, it could execute malicious code when you access it for the next output statment.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also, you need to declare the type in the function argument list. This should not compile. And it would core dump since buff[] is uninitialized.

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

There is also unetbootin: http://unetbootin.sourceforge.net/

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Not necessarily. In any case, your use of it is incorrect. Ok. You are looking for empty-ssid inside the named file then? If so, your syntax for grep (order of options) is incorrect, and it should be like this:

SSID=`grep -o empty-ssid ${FILE}`
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Study good code. There are some great examples out in the open source world. You should visit the gnu.org web site - all their tools have source available. Start with small utilities at first, and try to understand what they are doing to implement the functionality that the tool provides. Then, try writing some of your own tools, keeping things simple at first. From there, work your way up until you can confidently handle more complex tasks.

Good luck, and happy coding! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This is where you use the back-quote method, as in

SSID=`grep ${FILE} -o empty-ssid`

You do need the file "empty-ssid" to exist in the local directory however or you will still get the "No such file or directory" error.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Read/study the source code for nmap?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Try using our friend Google... Or go to Wikipedia - they have good articles on these subjects.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Let us know how the pendrivelinux tool works for you. If it also fails, then there is something else going on. In such a case I would have to ask if this system came with Windows 8 installed on it, and whether or not it is UEFI with Secure Boot enabled?