rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

One last thing. If in your function you are iterating through the array, put a flag in the last position, such as -1 for int arrays, so when you hit that value, you know you have reached the end of the array. The std::array and std::vector classes have a size() method that allows you to iterate to the end quite safely, otherwise you either need a placeholder / flag for the end of the array, or pass the number of elements in the array as an argument to the function.

FYI, std::array<T,size_t N> is only for C++11. For earlier versions of C++, use std::vector<T>. The std::array<T,size_t> class is presized using the second argument in the template declaration. Myself, I prefer vectors. For small collections, it is about as efficient as arrays, and the resize algorithm is quite efficient. Before the STL was invented I wrote a container class that used the same algorithm they use for std::vector<T>. You could insert a 100,000 records in practically no time.

I use std::vector<T> objects frequently for the work I am doing now for Panasonic Factory Solutions.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

try int dir[] in the function definition (the declaration is in the header - the definition is in the source file by standard convention). Another thing, you will be making a copy of the array this way. If the array is big, It is better to use a pointer to the array as in:

// Declaration
int findMobile( const string&, int* ) const;

// Definition
int findMobile( const string& word, int* dir ) const { return dir[0]; }

An alternative is to use std::array<int> or std::vector<int> instead for the array, and pass that variable by reference. Since you are using C++, that would be a better solution.

Also, if you are not modifying the array, I would suggest that you use a const qualifier for that argument like I did for word.

Final point. If you do use a pointer to the array, you absolutely should test it for null in the function before you access it, as in: if (0 == dir) { /* fail */ return -1; }

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

vector<array<type> > mystack_of_arrays;

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your private keys are typically kept in an encrypted file that uses a key that only YOU know. Yes, if someone has placed a trojan in your system, they can get all this stuff. If that has happened, then you are well and truly pwned and all your secrets are their's. If not, then you are safe and your communications are secure.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

My friend has an old HP desktop. Memory is going flakey (random bluescreens and memtest86 shows bad chips). Reconditioned HP memory (1 year warranty): $10. New Kingston (lifetime warranty): $16. Guess which ones we bought? So, 1 year vs lifetime warranty == $12 for 2 2GB SIMMS. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Seems that they are taking some visual clues from Mozilla / Firefox. :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It seems your code has defined the function pointer that returns scal has no matching version that takes a void* argument. Post the function declarations that may be relevant.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Class pop-quiz question? What do YOU think is the difference? Tell us here, and we might decide to correct your misunderstanding.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What the others said. Describe the problem and its symptoms/errors.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Can you boot from CD/DVD/USB drive?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon the browser. For example, Firefox will allow you to specify in the configuration pages that opening a shortcut or new link will open a new tab or window.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

We don't do your homework for you. Try to solve the homework problem and if you are still having difficulties then post your code here.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

How are you generating your random numbers? Show your code please. Assuming you have assigned a random number (usually using the rand() function if C or C++) to randomnumber1 and randomnumber2, then your computation should be correct. You initialize your random number generator with a seed value - often the local time value, and then each call to rand() will produce a new (independent) value.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I also use ffmpeg for this stuff. I find that this works well for most all video formats:

ffmpeg -i "input file" -target ntsc-dvd -q 0 -async 20 "output file name".

This will create an mpg file. The -async 20 will sync the audio every 20 ms which works well to keep audio in sync with "the lips". :-) -q 0 will keep the output video quality close to the input quality. It will also transform non-standard audio formats to ac3.

This will work with most any input video format.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The thing about arrays that are dynamically updated (new or changed entries) is that to keep it sorted is expensive. Myself I have resorted usually to using an insertion sort algorithm where when you insert or modify an entry that will change the order it should be in, you do it at that point, and don't bother to sort the entire array. Things to consider are head/tail optimizations where you determine that an entry, or changed entry, will go at the head or tail of the queue. This has been very effective for me. FWIW, the insertion sort algorithm is a version of bsearch. It finds the point where the new/changed entry will go, moves the rest of the elements down one (resizing the array if necessary), and then placing that entry at that point. I will try to post some code to do this tomorrow when I get back from work.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So describe precisely what the equations are supposed to do - pseudo code helps - and make some effort to code the algorithms. Also, did you mean to output the value of an unmodified variable D, or did you mean to output the value of DeltaX in main()? In addition, the '\n' is not needed as endl will output a newline for you, as well as flushing the stream.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Sorry, but we don't do your work for you. Make an effort to code this in the language of your preference and then we can help.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

FWIW, the php.net web site has very extensive reference documentation, and some decent examples of usage of the language. In my efforts at Nokia, I found it invaluable. Decent search capabilities included.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Make some effort to code this yourself first. As a bit of advice, use PHP as the object-oriented (C++ like) language that it is. Create your classes with the member variables and methods you need. Build up strings with the html and javascript you want the client to process, and then emit them as needed. Most examples of PHP on the internet are totally bogus crap and will lead you down the path to web perdition!

FYI, I used PHP extensively at Nokia - even wrote a cell phone emulator with it. I used this approach and had a functional emulator in a couple of months, including the time to reverse-engineer the protocols the phones used to talk with our servers. Let's just say that consistent and solid documentation on that was "sparse"... :-) I also used PHP to develop very sophisticated performance tools used by our QA department to test phone firmware and capture the data to a MySQL database for off-line analysis by the QA manager. It reduced his time to generate the data and reports for a new firmware from a couple of weeks to a couple of days, greatly increasing the efficiency of his department. People could use my software to pull up very complex graphs, charts, and tables detailing many performance metrics for various phone models and firmware that they used since it was all stored in that MySQL database. I used PHP for the server-side processing and database I/O; html, css, and javascript for …

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I've had very good luck with VirtualBox - been using it constantly for almost 10 years now. Very solid. At work we use VMware and have a tonne of ESXi servers and run VMware workstation on our laptops as well. Seems very solid also.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

When it crashed, did you get a traceback of the crash? Java (and Dalvik) will provide a nice stack trace to show you where the problem actually occurred. Since you say it only happens when closing the application, then I suspect you have munged something in your code that on exit the system cleanup code can't deal with it. I'm not going to analyze your 350+ lines of provided code to tell you why...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Your code isn't complete the X and Y Diffusion functions do nothing, and you never call them from your base code. Think about what you are doing, and make sure that the code reflects that thinking, algorithmically speaking.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It depends upon the table definition. If a_id is unique, then you need to alter the table structure so that a_id is no longer unique and the primary key is composed of a_id and to_user_id. Then, you can have multiple rows to the same a_id, but each a_id can only have one copy of to_user_id. SQL does not deal well with multiple values like you want unless you do this, or create a secondary table that is linked (joined) to the first one via a_id, and the first table has no to_user_id. Unless your table has other data associated with a_id (such as name, address, whatever), then the first suggestion I made would be optimal. If it does have such info, then my second suggestion would be appropriate.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Create a separate results array, one element less than the array that contains the numbers. Iterate through the array and store the deltas between each pair to the results array. Then you can easily find which pair(s) are closest, as well as there are any other matches. Let's say that your data array gets the values 0, 1, 4, 5, 6. Your results array should end up with the values 1, 3, 1, 1. Now you can easily see which items have the same distance as you put it.

I will leave the coding for this algorithm in your capable hands. I will help like this with schoolwork, or help you figure out what is wrong with your code, but I won't give you the answers... :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First of all, insert your code example inside code blockes, as in
My sample Code:

<table class="display" id="example" width="100%" border="1" cellpadding="0" cellspacing="1" bgcolor="#000033" style="border:1px #000066 solid; text-align:center;" >
<thead>
<tr>
<td height="30" width="2%" bgcolor="#1A4779" class="white_bold" >S.No</td>
<td bgcolor="#1A4779" width="8%" class="white_bold">Student Name</td>
<?php 
$jjsublist = mysql_query("SELECT * FROM subject,subject_master WHERE subject.standard_id = '1' AND subject.Subject_code=subject_master.id  GROUP BY  subject_master.subject_name ORDER BY subject.sub_id")or die(mysql_error());
$count = mysql_num_rows($jjsublist);
    while($jjsublist_res = mysql_fetch_array($jjsublist))
    {
?>
<td bgcolor="#1A4779" width="10%" class="white_bold"><?php echo $jjsublist_res['subject_name'];?></td>
<?php 
    }
 ?>
<td bgcolor="#1A4779" width="5%" class="white_bold">Total</td>
</tr>
</thead>
    <tbody>
 <?php
 $jj = 1;
 while($jjsub_res = mysql_fetch_array($jjsub))
    {
 ?>
      <tr bgcolor="#FCFAF7" class="jjanto">
            <td><?php echo $jj;?></td>     
            <td><?php echo $jjsub_res['Name'];?></td>
           <?php     
$jjsublist = mysql_query("SELECT * FROM subject,subject_master WHERE subject.standard_id = '1' AND subject.Subject_code=subject_master.id  GROUP BY  subject_master.subject_name ORDER BY subject.sub_id")or die(mysql_error());
$count = mysql_num_rows($jjsublist);
    while($jjsublist_res = mysql_fetch_array($jjsublist))
    {
?>
             <td><input type="text" name="subject" id="subject" class="subjectmark" size="5" maxlength="3" /></td> <?php } ?>   
            <td><input type="text" name="calctotal" id="calctotal" onclick="calculate_Duration(this);" class="joeljowintotal" readonly="readonly"  size="10"/></td>        
      </tr>
    </tbody>
    <?php
            $jj++;
        }
    }
    ?>
</table>

Next, you are breaking the rule of good php programming - do NOT mix output with your php code. Use the php code to generate the entirety of the HTML output. It works very easily that way. Then you just have to output the resulting HTML string from the php variable you stored it in.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What was the application, and why didn't just use the tools provided by the operating system?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Time for you to read the Cisco documentation. I'm sure they cover that in the installation/configuration docs for the switches in question.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

If you are running SQL Server 2012 on Windows Server 2008, there is a patch you need to install. Don't remember what it is, but you should be able to find it on the MS web site.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

HTTPS / ssh encrypt the data stream. There are some issues with that, depending upon the hash and encryption algorithms your particular implementation is using. However, they are mostly pretty secure. As for blocking specific implementations of the game code / data stream, that is up to the implementors. They "own" it, and can allow or disallow what they want. "Legal" has nothing to do with it.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Which brackets are you talking about? The squiggly brackes such as {...}, or the <?php...?> ones?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

First, check the cables and connections. I assume it has power. It is possible that a connection is bad, a cable is bad, or the video card is bad. If the video card has another connector, try that.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Comparing integers? Not such a problem. Floating point numbers? Gah!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

And that is just the beginning of your problems... There are things like the fact that floating-point values on computer hardware aren't always exactly what you think. The fact is, 1.1 may be represented in hardware as 1.1000000001 or something like that. Caveat programmer!

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

What? Besides the fact that this is a terrible piece of code? You are mixing doubles, integers, and floating point values. You need to cast everything to a double to compare them, otherwise the math co-processor will mis-interpret what you want.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Build software. Test it, and if it passes systems-level testing, then you release it. This is an important job in the software enginering world.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Typo? Ok. But the function does nothing. Again, what is your intention?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

So, where is this function defined? I don't see a definition anywhere in your code.
Also, please make clear what your intentions for this are.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Why not derive MyClass from MyOtherClass, and make the DoSomething() function virtual? Then, you don't need to implement it in the MyClass class...

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Accidental double posing?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Also you can get MingW which a GCC compiler which works well with Windows. Then, there is Cygwin which is a Linux-like bash shell that runs on Windows and has the full GCC/G++ compiler suite.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I listen to audio on my Linux system all the time. High def stuff without problems. I use VLC as my media player, and my system runs pulse audio and alsa sound libraries. I do have a good pair of Bose speakers... Windows never sounded so good.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

How old is it? Have you tried cleaning the dust out? Did you spill anything on the keyboard?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

I have to assume you are running VMware and VirtualBox? In either case, I haven't seen this error. It may be that your OS image that your are trying to install is corrupted. Try another.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

The only algorithm I used in commercial software was, before AES and all that good stuff, triple DES. Still pretty secure. So, unless you are a serious math wiz and security expert, don't try to "roll your own" encryption software, as others have so clearly stated here. Do it as a learning tool only. Just because you cannot break your algorithms doesn't mean others cannot.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Well, your last for_each() statement doesn't do anything. Neither does your last std::cout << '\n'; other than output a newline just before you terminate the program. Why not use std::endl instead? Also, what is the output of the statement before the loop where you display the size of the map?

Finally, what exactly is your problem?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

It is saying basicially that the first argument is a type for x and y. Then it assigns to x the value of y, and then increments y. Next it creates a new variable x and assigns the current value of y to that, as well as incrementing the value of y. At the end of all of this, y == the original value of y + 2, but since nothing is done with that, it is thrown away. Likewise, since x is not returned, it too is thrown away. Result? Nothing, although since you define y as an extern variable, it will retain the final value, including after the function f(int n) is called. The function f(int n) is a recursive function. If the value of n is not 0, then it will execute the macro SUB() and thereby increase the value of y by two.

Confused yet? :-)

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

My wife is a physicist and her systems are all Mac's - a Mac Pro for work-type stuff, and iBook for gaming, internet, and such. Assuming you have a good monitor, keyboard, and mouse, then a mini is a good deal for the price.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Good start Viny. Also, remember the KISS principle - complex code is fragile and difficult to understand or debug. Let each function do one thing perfectly.

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

Is this a web server? Or just a system that is accessible via the internet?

rubberman 1,355 Nearly a Posting Virtuoso Featured Poster

One guess is that this is a virus that has embedded itself in the BIOS firmware. You need to reset / clear that, which will probably require that you short out a couple of contacts on the motherboard of all your systems, and reconfigure the bios. Then you need to totally erase the hard drives (including the boot sector) and reinstall the operating system(s). This will not be fun, fast, or easy. It is also why my wife and I do not run Windows systems...