rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Using a tool like Virtualbox will consume system resources (cores, RAM, etc) as L7Sqr mentioned, but it works very well. I use it daily for work and home use. I run Linux under Windows 7 with Virtualbox at work, and Windows XP at home under Linux with Virtualbox as well. Both approaches work very well.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

There are a number of methods to do this. One is to create a chroot environment for each process. You can restrict precisely what applications can be run there, and associated them with specific system directories. This is somthing like what L7Sqr mentions about "sandboxing" the applications, instead of separate file systems. That said, you can create a virtual file system that is actually a file that is mounted with the loop specification. IE, you can create an empty file, initialize it with a file system internally, and then use the "mount [-t fstype] loopfilename" command.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What deceptikon said. The window manager probably supports drag+drop, (pretty standard these days) but both source and destination applications have to handle the drag and drop events respectively, otherwise nothing will happen such as you want. "Wrapping" the application in another window buys you nothing. Even with C#, your application has to provide a drag and/or drop event handler/call-back.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Glad we could help! :-)

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

Suzie is being nice to you - we are not supposed to solve your homework assignments for you, though I think she just gave you a foot up to help you get started. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Use a web-enabled pdf plugin? Why re-invent the wheel?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

This isn't C++, it is php. since you are already in the php environment, why do you use the '<php print... ?>' construct in the fwrite function on line 14?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

RTFM? Sorry, but it is elementary. Here is the Linux manpage for floor():

FLOOR(3)                   Linux Programmer’s Manual                  FLOOR(3)

NAME
       floor, floorf, floorl - largest integral value not greater than argument

SYNOPSIS
       #include <math.h>

       double floor(double x);
       float floorf(float x);
       long double floorl(long double x);

       Link with -lm.

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       floorf(), floorl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 || _ISOC99_SOURCE; or cc -std=c99

DESCRIPTION
       These functions return the largest integral value that is not greater than x.

       For example, floor(0.5) is 0.0, and floor(-0.5) is -1.0.

RETURN VALUE
       These functions return the floor of x.

       If x is integral, +0, -0, NaN, or an infinity, x itself is returned.

ERRORS
       No errors occur.  POSIX.1-2001 documents a range error for overflows, but see NOTES.

CONFORMING TO
       C99, POSIX.1-2001.  The variant returning double also conforms to SVr4, 4.3BSD, C89.

NOTES
       SUSv2  and  POSIX.1-2001  contain text about overflow (which might set errno to ERANGE, or raise an FE_OVERFLOW
       exception).  In practice, the result cannot overflow on any current machine, so this  error-handling  stuff  is
       just  nonsense.   (More  precisely,  overflow can happen only when the maximum value of the exponent is smaller
       than the number of mantissa bits.  For the IEEE-754 standard 32-bit and 64-bit floating-point numbers the maxi-
       mum  value  of  the  exponent is 128 (respectively, 1024), and the number of mantissa bits is 24 (respectively,
       53).)

SEE ALSO
       ceil(3), lrint(3), nearbyint(3), rint(3), round(3), trunc(3)

COLOPHON
       This page is part of release 3.22 of the Linux …
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I'd boot from a live Linux DVD/CD, and then wipe the drive entirely with the dd command. Assuming that the drive is /dev/sdb, to this: dd of=/dev/sdb if=/dev/zero bs=1M
That will erase the drive, writing 0x00 to each position (byte) on the disc. Then you should be able repartition it and create a new file system on the partition(s), or install a new OS on the drive.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, show what you would do. Then we can help you. The main thing is whether you want a doubly linked list (each node points to the previous and the next), or a singly linked list (each node just points to the next). It either case, the last node has to have a link to the first node.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Myself, I like lagged-fibonacci sequences, salted with some really random variables such as the decay of some radioactive isotopes, the temperature at various locations on the earth, the current density of the solar wind impacting the earth, etc. FWIW, my wife is a particle physicist and uses Monte Carlo routines to model elemenatary physics. Really random number generators are essential in that work.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And what IS your problem. Most rand() functions are at best "pseudo-random" - ie, not so much. This is a good tutorial on the subject: http://www.phy.ornl.gov/csep/CSEP/RN/RN.html

From the site: page 2

 Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin. -- John von Neumann (1951) 

Anyone who has not seen the above quotation in at least 100 places is probably not very old. -- D. V. Pryor (1993) 
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

Since this is C++, use 0 to initialze these variables. IE:

double* data_list = 0;
double* filter_list = 0;
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

Circular queues confuse a lot of programmers since they are not generally supported directly by computer languages. Key points: head of queue, and tail of queue. Circular queues are generally organized as an array, and the biggest issue is usually the one of "wrapping around" from head to tail, or tail to head (depending upon direction of navigation). In any case, python not-withstanding, write out the pseudo code (algorithms) on how to deal with adding/removing elements, and navigating the queue.

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

Not much different from overloading any class/function. Please show an example of what you are trying to accomplish.

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

For an iPhone, if you want to reduce your data footprint, then try Opera's mini browser. It is a proxy browser. Their servers do the fetching and rendering, and only send paint commands to your phone, significantly reducing the amount of data that your phone uses for web browsing. I'd recommend Nokia's xpress browser, but we don't yet support the iPhone... FWIW, Opera is our biggest competitor in the mobile browser domain, but it is a quality application. I don't dis' the competition when they do a good job and we don't have a competing product.

As for Max Safe Browser? Never heard of it. I'd be careful - there are lot of seemingly legitimate apps out there that are trojans. I'm not saying this is (I don't know), but the fact that I've never heard of it (and I follow this domain pretty closely, for professional reasons) is not positive.

That said, Apple does vett iTunes applications pretty well, but they are not always faultless.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

For a system drive (read-mostly, write occasionally) then an SSD is a good choice (mirrored drives for reliability). For data storage (a lot of writing and over-writing, database, etc) then you want spinning media in a RAID-5 or RAID-10 configuration. The reason for this is that current generation SSD's have a limited number of cell writes before the cell becomes useless. Current SSD controller software mitigates this by trying not to write updates to the same cell, and if you are using well less than 50% of the drive, this is good and gives decent life to an SSD, but not all are created equal. For SSD's, get "industrial" strength devices (pricey). For hard-drive RAID's, get commodity (but good quality) devices. There is always the tradeoffs between price, performance, and longevity.

Ketsuekiame commented: Agreed. I typically use SSD for OS drives and magnetic storage for everything else. My last SSD has lasted 3 years like this and shows no signs of failure yet. However, the Vertex 2 I used for write-heavy operations and it died within 14 months +11
rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

A lot depends upon whether this has the HM76 or HM86 chipset. The HM86 can support i3, i5, and i7 chips, but the socket may be a problem. As for memory, it should be able to support 4-16GB of RAM, depending upon the simms that you install. Go into the BIOS and list out the hardware/chipset specs here and we can probably tell you better how much you can enhance this system.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Please note that we don't do your homework for you! Write the code, and we can critique it, but until you make a reasonable effort to solve the problem on your own, don't expect much from us...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Deceptikon, I'm not sure your answer was apropros to the question. It was being unable to declare a static variable inside a class defined inside a function. Honestly, I have never done that! IE, something like this I think is what (in my interpretation of the post) he meant (I may be waaay off-base...):

int functionx(void)
{
    // Local class
    class foo {
        static int s_var;
        .
        .
        .
    };
    int foo::s_var = 0;
    .
    .
    .
    return 0;
}

Personally, in 20+ years of C++ coding I have never used this construct, so I don't know if it is legal or not, and I don't have the time to dig through my C++ standards docs to see if it is allowed. I think that classes internal (and local) to a function should be ok, but the static variable part I'm not certain of.

Maybe some other expert out there can enlighten me! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Actually, usually the temporary variables, arguments, call and return points are pushed onto the stack, for normal function calls. Inline code just gets converted into code as though you typed it directly into the translation unit (as you indicated toward the end of the post). As you indirectly pointed out, if the inline function is too complex, then the compiler is free to turn it into a local static function, and call it via normal means. Local variables are still pushed onto the stack. Some optimizations may use registers, but not by default, as far as I am aware. Of course, you can specify that a function argument or variable is a "register" type, but the compiler is free to ignore that if there are no free registers to use. Caveat Programmer - you cannot take the address of a register variable or argument!

FWIW, C++ class methods that are implemented in the header are "inline" by default, even without the inline directive. This is why one wants to only implement simple getter/setter or other methods in the header. More complex methods should be implemented in the source file, out-of-line. People who come to C++ from Java often don't realize that implementing all the code in the header is not necessarily a "good thing", and can cause serious code bloat. Why? Because everything in Java is effectively "inline". It is all implemented in the class definition. C++ is another thing entirely! :-)

Anyway, I think that generally your post was …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What L7Sqr said, with emphasis! You are working for an advanced degree and have no idea what problems you are interested in solving? Good luck is all I can say! If the two subjects you mention (network and web/android development) are both of interest to you, then flip a coin. FWIW, web/android are not necessarily mutually inclusive subjects. Web coding is used on all mobile devices. Android is a "mostly" mobile computing environment, but in reality, it is Linux for smaller devices. So, as far as I can tell, you are interested in three subjects: networking, web development, and android/mobile. So, figure out what is most interesting to you, and go there.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

N1GHTS has giving you a good hint. That said, we don't do your homework for you... :-(

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Question. Is this on a Linux system, or is it Windows? The standard Linux/Posix C/C++ libraries have some common interval timer functions that can get you down to millisecond to microsecond or nanosecond intervals. Not sure about Windows. I use these in Linux frequently in order to determine if stuff (network operations and such) is taking too much time in order to trigger off retry / reconnect logic.

As for the sorting/merging code, read Knuth's Volume 3 "Sorting and Searching". He covers most of this stuff pretty darned well. In any case, make an attempt to solve the coding problem and we can help with issues you may run into. That said, we do not do your homework for you! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Ok. Explain yourself! :-) You obviously fixed it, but others may benefit from your "discovery"...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Create public getter/setter methods for your class member variables and use those to get/set the member values. If you do that, you won't have to cast the child to parent class. Just call the methods on the Camion object. Also, you have your assignment reversed. It should be ptrMovil=&camionObject. Also, you should use the appropriate cast operation. In trivial cases like this, your approach (reversed) will work, but it won't in cases where you have multiple inheritence. Avoid casting unless ABSOLUTELY necessary. Using the appropriate methods is a better approach, and more reliable.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So Dani, have you found something suitable yet? Hope your project is going forward well.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also check the screensaver settings. Disable it, or set it to a long period when running this sort of application and/or movie. Either that, or move the mouse every once in awhile... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

We run thousands of servers in the Amazon "cloud". You can rent either virtual or physical servers. Physical ones are more expensive. They have a lot of options about storage, I/O performance, memory size, number of virtual cores, clustering, etc. My department, performance engineering and testing, runs about 100 servers in 2 regions (Oregon and Virginia) at a cost of about $8000-$10000 per month. In truth, a $100 / month per server (4 cores, 16GB RAM, 1TB disc) is not too bad. If we aren't using the servers, we shut them down, and don't incurr additional costs. Some of our servers are smaller, and others larger (up to 16 cores and 48+ GB of RAM). Needless to say, the larger ones cost more! :-) A mid-size system with 2 cores and 8GB RAM is actually quite cheap. Go to the Amazon (AWS) site for pricing.

Part of this cost is for a Hadoop cluster that I run (about 12 4 core systems w/ 16GB RAM and 1TB disc each) to store system performance data. They run 24x7 with no downtime.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry I haven't had time to review your code yet - too much stuff going on at work. Hopefully Gabriel's code will help you sort this out. I still intend to get to it. Anyway, my boss has me working full time on major projects with both our analytics/operations and QA teams. I need a clone! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Good thread! Best laugh all day! :-) Thanks folks. My company has been purchased by MS (the deal hasn't cleared yet, but will soon), and WE are confused by the change. 1/2 of our discussions mention "SkyDrive" and 1/2 "OneDrive". Begs the question, just who's on first (sic)?

FWIW, here is a great description of the term SIC: http://en.wikipedia.org/wiki/Sic
So, I think it is apropros in this context. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I up-voted ddanbe's post. That said, operator overloading can be very useful, especially output/input operators and such. As mentioned in ddanbe's post, date classes often overload the + operator. Example, adding a number of days to a date. IE, today + 7 = same-day-next-week.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Go read Donald Knuth's "The Art of Computer Programming" Volume 3 - Sorting and searching. He gets into this in quite a bit of detail. In fact, this is considered the "Bible" of the subject, especially binary tree algorithms. It has held an honored central location on my 6' x 12' (six by twelve feet - 72 sq feet) office bookshelf for many, many years.

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

NP. Glad to help clear your mind - I use a nice Scotch Whiskey to do that! :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, build your code::blocks to be debuggable. There is probably a build option for that. Next, build wx to be debuggable as well. Finally, rebuild your project from scratch.

More information required. It seems you are building this with GCC in Windows. Is this the MingW compiler, or in Cygwin?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Contact Apple's iOS support team, or post this in their user forums.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Contact MS Hotmail support. This is not something we can help you with. It is an application-specific issue, no matter if someone else has had this problem.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The open source MySQL database can handle this sort of load very easily. There is also PostgresSql which is more "Enterprise" capable. I use both, as well as Sybase and Oracle. For small Linux database loads, MySQL works very well! I use it to store system performance data in large data centers.

As far as distros, for this sort of system, use a Red Hat Enterprise Linux, or a clone such as CentOS or Scientific Linux. We run CentOS on thousands of systems. It is reliable, cheap (0$), and performs very well.

Routers? Well, I am not an expert on that. Depending upon your requirements, you can go cheap (for small businesses - mine came from my ISP - a Motorola Netopia router - nice, small, inexpensive, capable), or expensive (such as Cisco - suitable for larger businesses), or you can go into the "cloud" and rent time on Amazon AWS servers. Then you have a lot more options.

Connection speeds depend entirely upon your needs. My small consulting business gets along with 5-6mbps (megabits / sec), but my day job requirements are MUCH higher than that (gigabits / sec). With Amazon, you only pay for outgoing data. Incoming is free.

If I were in your position, I would definitely look into Amazon's cloud services. Buying hardware and software is today just so "retro"... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

You have a hardware failure. Remove the disc drives and send it in for repair. If you send it in with the drives, they will probably reformat them, unless you specifically tell them not to, but that is no guarantee that they won't...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

In Unix/Linux and similar systems, you can set the file's attributes so that ONLY the owner or administrator (root) can access the file. As for program access only, then the only means is to encrypt the file, and allow the user to specify the password on the command line. Combined with file attributes, this would keep anyone but the owner who knows the password from accessing the file and its contents.

Anyway, since this is in the C# forum, I have to assume it is a Windows system, most likely. In that case, you really need to encrypt the file and keep the password secret.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but we don't do your homework for you. Please write the code, and post it here. Then we may be inclined to help sort out your problems.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon your intention. Normally in recursive functions you would do this (assuming you don't want duplicate numbers):

node* insert_in_tree(int number,node* p_tree)
{
    if(p_tree == 0)
    {
        p_tree = new node;
        p_tree->num = number;
        p_tree->p_left = 0;
        p_tree->p_right = 0;
    }
    else if(number < p_tree->num)
    {
        p_tree->p_left = insert_in_tree(number,p_tree->p_left);
    }
    else if (number > p_tree->num)
    {
        p_tree->p_right = insert_in_tree(number,p_tree->p_right);
    }
    return p_tree; // refering to this
}

To determine if this is correct, I would have to see the rest of your code. Note that these changes allow you to keep to the optimal "1 return point per function". It also may allow the compiler to optimize the code a bit better.

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

Oops. Double posted... :-(