rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Research "Sieve of Eratosthenes" for better understanding of how to do this. There is a good Wikipedia article on it: http://en.wikipedia.org/wiki/Sieve_of_Erastosthenes

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I assume you want to randomize these values on startup? if so, then don't initialize the dizi[5] array on startup, but have an initialization function that will set the values randomly. IE,

void randomizeArray(int array*, int arraySize)
{
    for (int i = 0; i < arraySize; i++)
    {
        array[i] = some_unique_random_value_between_1_and_5;
    }
}
int main(void)
{
    int dizi[5];
    randomizeArray(dizi, 5);
.
.
.
    return 0;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon whether you want to create these shapes in a text console/window, or graphically. What is your operating system and desktop environment?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In some spaces such as scientific and internet/cloud computing, embedded systems, and mobile devices, Linux already has an insurmountable lead over MS products. It is more efficient resource-wise, faster, and a LOT cheaper! The ONLY market where Windows has an advantage over Linux is on the regular user's desktop/laptop and some business server environments (Active Directory, etc).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First off, you need a cracked version of OSx since normally it relies upon firmware ONLY found on Apple hardware. Then, you need to be sure you have a compatible video card. You might try installing OSx in a virtual machine first, just to figure out what the processes are that you will need to follow to install it on real hardware.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

They may also restore from the restore/recovery partition, which most OEM systems have installed on them. I've done that for my clients except in cases where the recovery partition was infected with a virus.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What's in a name? Nothing. Format and/or set the label for the drive to whatever you want. Then safely remove it, plug it back in, and the new name/label should appear with the drive icon. A lot of thumb drives are identified as "Generic USB Flash Device", or similar. Don't sweat it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Perhaps you have a problem with your RAM. If you can, run the memtest86 software to test your memory.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Shut down, take the battery out, hold the power button/switch on for 10-20 seconds. Let sit for at least 10-30 minutes before putting the battery back and restarting the system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

FWIW, I was Principal Software Engineer for a major software company for almost 20 years, and now am Senior Performance Engineer for one of the largest technology companies in the world. I do know something of this subject.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In your call() function, inside the branch if (m>n) you have three subsequent calls to call(), each of which potentially calls itself 3 more times. This can cause a lot of stack winding/unwinding, hence time. Also, each call() has these 3 divisions in setting up its automatic (stack) variables, and divisions are expensive, especially compared to simple shift operations. You can reference the Intel processor documentation on the Intel web site to find out how many cpu cycles are required for an integer divide, vs a shift operation.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The call() function is heavily recursive. This leads to simplicity, but can create a lot of processing overhead, especially with stack setup/teardown on each function call. Also, in your code, you initialize variables by dividing the argument by 2, 3, and 4. Since the components of the operation are integers, the divisions by 2 and 4 can be sped up significantly by using shift operators instead of division. IE:

a=n>>1;
c=n>>2;

This will work fine on Intel processors which won't wrap the bits around if a bit is shifted off the end. I think ARM processors will work the same way, but I'm not 100% sure of that.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Unless you are committed to Windows and having viruses interfere with your computing life, then wipe the system and install Linux instead... There is a learning curve, but most get past it pretty quickly. There are open source replacements for most Windows software, and there is Wine which will allow you to run many Windows programs natively in Linux. Additionally, there are free virtual machine managers, such as VirtualBox, which allow you to run Windows natively in a virtual machine for those programs that won't run in Wine. You can take snapshots of the VM periodically, so if you get a virus in the Windows VM, you can simply revert to the last snapshot, automatically removing the virus and all its side-effects. That's what I do. I have one or two Windows programs that I have to run in Windows, so I use a VM on my Linux system. It gets infected occasionally, so when it does, I just revert to the last snapshot, and voila! No more tears!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, do a full shutdown, then make sure that all memory is cleared. If this is a laptop, you may need to remove the battery and hold the start button/slide on for 10-20 seconds. If a desktop, then shut down and remove the power cord for at least 30 seconds to 2 minutes. Depending upon your make/model there may be some other thing you need to do to make sure that all RAM and volatile flash memory is "drained". Then restart the system. Some viruses can infect the volatile flash memory so that when you do a warm restart, they reinfect the system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

To make this simple, if you don't read/modify a global or local static variable, then you can have as many instances of your function running as you want. All non-static local data, including the incoming argument, are stack-based, and each thread is running with its own stack. So, in effect, your example is "thread safe".

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Actually, the integer 9 would be (in 32-bit binary) 00000000000000000000000000001001

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A flat text file could have an index too. You can't be too strict about these sorts of definitions.

True enough. I worked on MCBA manufacturing accounting software years ago that used flat files for the database, along with indexes to speed random access to the data.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Assuming that you shut down normally, this should not happen. It will happen either if you tell the system to do a check on reboot, or if there is a file system problem with the drive. Is this a FAT, or is it an NTFS volume?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, on my system (an RHEL 6 clone) it shows up in the repositories as ant-jmf.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

From the symptoms:

1. A new drive gets further than the old one, but still fails to boot.
2. You find the drive recognized in the BIOS.
3. You made sure the system was booted without any residual data in flash or ram.

I think your disc controller (is it IDE or Sata?) is bad. If IDE, there are two ports. You might try setting the other port to master and after changing the jumper on the drive and plugging it in to the other connector, try installing to and booting from the other port. That's kind of a last-ditch possibility. The last option is to send it in to Dell for repair, although the cost will probably be more than to buy a new system altogether!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A flat file is a file that contains a set of records. The records are normally seperated from each other by a space, a comma, or a new line. You could export a spreadsheet file to a comma seperated list i.e. a text file where every item is seperated by a comma. You can reasd this type of file with a text editor

A not flat file is a file where the records are organized with an index (this is a simplified explanation). The index will then point to the actual location of the record. You would normally need some application like a database management system to read this type of file.

A non-flat file can also be a structured file, such as indicated by Narue's mention of XML as such an example. Indexes are not necessary for such.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you are programming in C, then you can use the interval timer with the functions setitimer() and getitimer(). This is a standard function in Linux. Not sure about Windoze.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Simulate? Or capture the screen in reality using C? In either case, the answer is yes. However, doing this with a GUI vs. a text (vga) screen is a very different process. If you are running Linux, then it is simple, and you can get sample code from a number of open source sites.

Well, I said simple, but in reality it is only relatively so. How much C and graphics programming experience do you have?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

No. I usually install the package in my distribution's repository. What file did it say it could not find?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It sounds like one of your drives has gone belly-up.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Since this is supposed to be a MS Windows process, which should not be trying to execute data as code (which is what DEP is designed to stop), then I think you have a virus.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Leave this one at phone pole length... You can get decent (and new) video cards for between $50 and $100 USD from many on-line stores, although I'll grant that this one will cost you between $250 and $300 (about $300 USD at buy.com - http://www.buy.com/prod/visiontek-900352-radeon-6950-graphic-card-800-mhz-core-2-gb-gddr5/219360590.html). Before you buy this "brick", I would suggest that you do the research and figure out whether or not you and unbrick it, and whether or not you are willing to flush the $$ the card will cost you if you can't fix it.

Do bear in mind that this card requires two PCI slots.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can't just pass addresses between separate processes on modern operating systems because each process has its own virtual memory. This would include using an RPC (remote procedure call). That would work for old monolithic systems such as DOS, but I don't think it will work with any Windows systems since NT, and it certainly won't work with Linux, Unix, etc. An RPC will marshal the procedure argument data at the sending end, and unmarshal it at the receiving end, but you can't send a structure with addresses in it. You have to send the things the addresses refer to themselves.

So, just to make sure we are clear, what EXACTLY are you trying to do? Describe the environment (client, server, interprocess communications methods, etc) that you are trying to accomplish, in as much detail as possible.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can use a timer with an interrupt handler for the timer expiring event (ETIME). This was the old way to do it, and should work with VS 2008 just fine.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ancient Dragon is correct. In your original example, s is a char*, but string literals are const char*, and non-mutable - usually the compiler assigns them to read-only memory. The way that AD did it, to declare s as an array, means that the compiler will take the string literal as an initializer for an array that is in writable memory. IE, it gives the same result as this:

char s[12] = { 'h','e','l','l','o',' ','w','o','r','l','d',0 };

but the way AD did it is a LOT easier!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Are the client and server separate processes? Or are they threads inside the same process?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Unfortunately, SCSI drives sell for a premium over sata ones, but it may be possible to find a scsi<->sata adapter. Ok. Doing a quick Google search I found a bunch of these devices to allow sata drives/arrays to connect with a SCSI controller. They seem to be in the $150 USD range. Don't know about how much in Europe (you mentioned Euros in your last post).

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ah Narue! You beat me to the post, again! :-) Seems like we are giving more or less the same advice.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You need to check if fgets() returns the address of lineBuffer vs. NULL inside your loop, since when you read the last line, the eof flag on infile will not have been set. So, change your loop internals to this and see what happens:

while (!feof(infile))
{
    if (fgets(LineBuffer, BUFFERSIZE, infile) != NULL)
    {
        printf("%s", LineBuffer);
        fprintf(outfile, "%s", LineBuffer);
    }
}

From the fgets() man page:

fgets(s, size, fp) returns s on success, and NULL on error or when end of file occurs while no characters have been read.

You might also want to check for an error after reading the line, just in case... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Check on the HP web site. Looking at the technical reference manual for the x2100 workstation, it has SCSI and IDE controllers, so the short answer is no, it does not have a sata controller. However, you can get a PCI sata controller for external drives for under $100 USD that would have 4 ports that can each support multiple devices. I use one on my workstation that has 3 RAID enclosures and a single drive dock, for a total of 13 connected drives. I think the controller cost me about $71 (w/ shipping) almost 3 years ago. Looking on the buy.com web site, today it is $69 w/ shipping. It is an Addonics ADS3GX4R5-E controller card.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

1. Test that the incoming node** q argument is not null.
2. Test that after assigning *q to cur, that cur is not null.
3. Test that the data element in the nodes you are comparing is not null.
4. Simplify, simplify, simplify.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please be more explicit as to what this code is supposed to be doing, and what the error is.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Don't underestimate the amount of work it will take to do this. I have written SQL databases from scratch in the past, as well as C++ libraries to "wrap" SQL databases, used in major application software systems that run manufacturing operations all over the world. The database wrapper library was designed so that only parts of one class needed to be re-implemented to support different dbms's, and then loaded as a shared library, allowing the same code base to support Oracle, Sybase, Ingres, and Informix rdbms products without change or even recompiling at the application layer. This was done to replace a commercial library with similar functionality (Rogue-Wave's DBTools) because of licensing and performance needs. I forget how long it took to implement, but it was probably 6 months to a first commercial release, and I had years of experience writing similar code in C already, and years writing complex C++ application support libraries, so I knew what problems were likely to occur before I started.

In any case, Narue's suggestion about design first, and redesign when necessary, is so true! I always start with a design first using UML to model the system. That lets me look at the entities (classes, structures, etc), their relationships, and their behaviors in a consistent and visual fashion. Good UML modeling tools will also let you simulate the system as you design it, and in many cases today support round-trip engineering where it will actually generate code from the model, and vice-versa. …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You can also use the tolower(ch) function to make sure uppercase letters are seen as lowercase ones, then you can do something like this

switch( tolower(ch) )
{
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u':
        printf("vowel");
        break;
    case 'y':
        printf("may be vowel");
        break;
    default:
        printf("not vowel");
        break;
}
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You may also want to write in a mutex so that the thread that saves the file doesn't try to do so when the in-memory data is being modified, and vice-versa.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is this a newly purchased system, or an old one that they "inherited"? FWIW, most HP computers (including notebooks) have a recovery partition that if you boot from will allow you to repair a damaged operating system, which it seems you have from your reported symptoms.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The series 3 is a Sata-3 drive which they say reads at 550MBps (megabytes / second), not 555Mbps (megabits / second) which your controller will not do. If the controller is a Sata-2 controller, it will handle something around 350MBps.

The other issue is whether or not this drive will work in your Sony. A Sata-3 device will work with a Sata-1 or Sata-2 controller, but only at the controller's speed. However, Sony Vaio systems have been notorious in the past in not allowing components that are not Sony provided or authorized. My wife had a Vaio some years ago and this was a real problem for her. So, I think you need to contact Sony about whether or not a non-Sony SSD will work in this system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It may be a Unicode issue in that what you think you are asking for, and what is really on the system are different - single-byte name vs. multi-byte Unicode name. Other than this possibility, I'm out of ideas... :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Just remember the KISS principal. It works really well for any complex system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The focus of the whole paper is demonstrating an understanding of Windows networks. Thanks for your reply though.

Ok. Re-work it and post it here. I'll be happy to be as critical as I can! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I've heard a lot of good things about AMD gear, and I have used a lot of ATI graphics boards in the past. Frankly, I don't you can go far wrong with either AMD or Intel CPU's, but AMD gear is definitely lower cost so if you are very price sensitive it would be the better choice.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

BTW, for a system this small, more than one domain controller is probably overkill. Also, are you limited to Microsoft software (IIS, DC, etc)? Or can you consider other web servers and network controllers such as Linux, Apache/Tomcat, OpenLDAP, etc?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Always be clear on what you are trying to accomplish. I only responded to what you said in your original posting. Work up your scenario a bit more fully, and I'm sure that I and others here will be happy to critique it. In any case, I admire someone who has been working a schlub (but honorable) job and is trying to improve their lot in life. To that end, I apologize if I implied you are lazy - I'm sure that is far from the truth. Anyway, have a great holiday season, and I wish you the very best New Year!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, I have been using Intel gear exclusively (other than IBM, HP, and DEC Unix gear) for 30+ years, and no problems as yet. My current workstation is a dual quad-core Intel motherboard and cpu setup that has been running non-stop for 4 years now. Video is an nVidia 8800GT w/ dual 24" Dell displays. I've had disc drives and RAID arrays die for various reasons, but the system itself has been dead-bang reliable.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Boot from your recovery partition and have it fix the system. My guess is that some dll's have become corrupted. As to why this happened when in hibernate mode, that is a mystery. My guess is that it was only in sleep mode, not hibernating since when in hibernate mode the system is physically powered down and a power failure should NOT affect the machine in any way.