~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Storing floating point numbers would be a havoc with the above algorithm. The repeated multiplication and division is going to kill the values which you actually started out with. But still pretty good one. Also since its very much possible that the values inserted might be numbers close to the overflow limit, multiplying them with a multiplier can result in an overflow.

PS: Sam, congratulations on getting a star.

Rashakil Fol commented: This comment caused my post above to get a negative rep, so now you get one, too! -1
John A commented: Counterbalance! +12
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just keep in mind that with caching, you also run the risk of having inconsistent data in your hand / in database. Almost in all cases, there is a pretty algorithm which sits tight taking care of all this, not to mention this would rarely come from your side in a real time scenario since its pretty much complicated. Usually the framework / API which you use provides a simple / easier ways of handling things. A nice example would be Entity beans in J2EE.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The last one is pretty awesome. Chariot racing has never been this fun. So for me, its the POP-Two Thrones.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I would recommend either of them to anyone who is bored. =p

Sigh, I wish Developers could afford to get bored... ;-) But considering that the rating of Heroes has really gone up, beating even the famous 'LOST', I am pretty sure it must be having some interesting elements.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Any game can run on an infinite number of gaming-capable platforms, provided that the company ports it to each of them.

But Halo has been successful mostly on the XBOX platform. The PC version was aimed at being a replacement for the current multiplayer action games gods like Counter Strike though it failed at it.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Actually both are pretty decent. 'Heroes' is much more of 'save the day' stuff while 'The Office' is pretty funny. Considering that I have seen only one episode of both of them, I might be wrong.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I have to admit this thread is one of its kind. We don't get to see such things everyday. I must admit that one more question and you would force Narue into giving you an infraction. I can imagine her banging her head on her screen at this very moment. ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Say that in a Java forum and you would get gobbled up by the supreme freaks who believe that the more things the container does, the better. In case you haven't worked with J2EE, in almost every scenario, CMT does a great job. The only times 'own designing' i.e. BMT is required is when fine grained control is required over transcations, a thing rarely needed is normal J2EE applications.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Third reason is there are no frameworks for business logic part of applications

There is always J2EE. Business methods of the Entity bean having CMT (container managed transactions) are implemented by the container.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

He didn't really mean it.

As far as program is concerned, read this, this and this.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Asking it here would be more like it.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe something like this, though I am not very sure.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey, just tried it now, and it works for me as well. Thank you so much ~s.o.s~!

You are welcome my friend. ;-)

So it works when .... what? Rounded corners enabled, dropdown menu disabled? Or vice versa?

For me, its only the rounded corners. When I disable them, off goes the spell checker.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

That's crazy? They have absolutely nothing to do with each other? How can that be?

But thats how it works out to be in my case, believe it or not. :)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Let me rephrase this...are you blonde or sly?

;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
binarySearch(sortedArray, first, last, key);
if (pos == mid)
{
    printf("\nNumber has been found!\n");
}
else
    printf("\nSorry number was not found.\n");
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It has somehow started working. Turns out that if I disable rounded corners, the spell-checker stops working. All I had to do was enable the option again.

Solved.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Thats not the way an input tag is written -- its an empty tag. As per the XHTML standards, it should be something like; <input type="text" name="txtName" />

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

why here the const is droped? can you explain it more specific here?

this is a feature of C and C++ to cater for old code.

This is the part of the agreement the compiler has to follow or to allow. If it makes you happy, think of it as a feature which the standard mandates.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Which OS are you on and how were you trying to execute the program?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why not just package the required DLL's into a installer and ship them with your executable?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

char* str = "Literal"; Though the above is a constant string literal, nothing prevents you from modifying it. The compiler has no way of enforcing it at compile time. To make the compiler know that this is a string literal which shouldn't get modified, we write: const char* str = "Literal"

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The problem you are facing is because of placing the return statement before the print statement. A return statement means you want to duck out of the function with the given return value. This means, any statement after return won't be executed. Ideally your program should have only one exit point i.e. only one exit.

How about something like:

int binarySearch(int sortedArray[], int first, int last, int key) 
{
    int pos = -1;   
    while (first <= last) 
    {
        int mid = (first + last) / 2;
        if (key > sortedArray[mid]) 
            first = mid + 1;
        else if (key < sortedArray[mid]) 
            last = mid - 1;
        else
        {
            pos = mid;
            break; // we have found the element, no need to continue
        }
    }
    return pos;
 }

Also it is a bad practice to place display statements inside your processing algorithms except for debugging purposes. Call the search function in the main() function and depending on the return value, print the desired output.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Make that Triple Concur.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

So kid, try to be modest instead acting smart. This kind of attitude won't fetch you any help.

Thread closed.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Print the entire array in main() after accepting user input and see if it is printing out any records, which it definitely should.

And why pass the variable 'i' when you can declare it as a local variable in the function itself. Passing it around won't serve you any purpose, will it?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

BTW, what's the criteria for the hot threads? I've seen threads that are marked as "hot" and with 4 replies(?)

The criteria for 'hotness' depends not only on the number of replies, but also on the number of views. I bet you must have seen a resurrected / old thread.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Instead of using pointer variables for marking the beginning and the end, make your life simpler by keeping numbers as markers. That the calculations would become simpler and more logical. The bugs cropping up in your program are because of pointer calculation.

How about something simple like this?

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just a small hint for you. Make changes to suit your purposes since handing out complete solutions won't be such a good idea... ;-)

document.onmousedown=disableclick

function disableclick(e) 
{

    var message = "Right click is disabled";
    if (document.all) 
    {
        if (event.button==2||event.button==3) 
        {
            alert(message);
            return false;
        }
    }

    if(document.layers || document.getElementById && !document.all)
    {
        if (e.which == 3 || e.which == 2) 
        {
            alert(message);
            return false;
        }
    }
}

I would assume that you know where to place this code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Better yet, add a new function to the String object type by using the prototype property.

String.prototype.trim = function() 
{
    return this.replace(/^\s+|\s+$/g, "");
}

And then use the function trim as if it belonged to the String type.

var str = "   okay this works fine    ";
alert(str.trim());
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*sigh* But it doesn't matter since I am getting around to learn / use CSSMate and GreaseMonkey. If it turns out to be well, it won't matter even if you color the whole site black... ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The thing you experienced is also known as Short Circuit Evaluation. If you want to find a way around it, try using the logical version of Bitwise AND. Something like this: $ret = $ret & foo(); //notice single & This way you can be always sure that the second part is evaluated irrespective of the outcome of the first one. Though normally in such situations, the preferred way would be to place the return value of the function in another variable and use it in the real equation.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I mean why look up other sites. We are pretty happy with whatever you come up with. Some of your customizations to Daniweb are really good.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This way we DON'T appear as if we're one giant jack-of-all-trades trying to cover everything and anything.

But we do cover almost everything. And by the way how colors change this fact still beats me?

Also I notice that the color thing is the CSS doing and not images(since I couldn't make the colors go away).

Oh and by the way, whatever happened to your original streak. Daniweb != MSN, Google News etc.

I can't tell whether you're joking or not.

Actually both. I mean there is a real difference between "Yay, off to the S/W section to help out people" and "*sigh* back to moderation duties..".

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Right, but again it is implementation specific. The language doesn't mandate it.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Portability?

I thought it was ease of maintenance? ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Does your program perform the sorting properly? Try printing out the values of the array after sorting to see if it works. If yes then try putting print statements inside your Binary Search algorithm and see how the algorithm traverses through the array. And if it still doesn't work, post the code with proper formatting.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Ah..it seems like everyone seems to like it. Please ignore my previous post.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

303

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Old VB was an object based language, not an object oriented one. There is a major difference you know.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

*Arghh* they are hurting my eyes. I have even stopped visiting the software development forum because of it. ;-)

IMHO, colors are not needed for one to know they are entering or leaving a particular section, since I would be the one performing the action. Like someone had stated before, what works for someone else might not work for us. The idea as I may assume is borrowed from Slashdot but its important to know that Daniweb is not a blog.

Maybe its just me, but sorry to say but these funky colors are making Daniweb look more like a fun thing where kids play games rather than a place for developers / professionals to hang out.

Again like the others, I have started thinking what you want Daniweb to become, since instead of taking inspiration from someone we should strive to become (Google Groups, TheScripts) where simplicity is of paramount, we are trying to become a Jack-of-all-trades and Master-of-none.

Thank you.

tgreer commented: Agreed. +7
Sulley's Boo commented: x_x agreed just like tgreer :p +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

:$

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hehe maybe its just illusion. Funny the others flatly refused that it wasn't getting darker.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Ah..thanks for letting me know its not my eyes. Oh and I have yet to read that 'God' thread. Hope I have real fun reading it. ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hmm...its a pity. I know I am old but not old enough to be wearing glasses. But seriously you guys have scared the hell out of me. I hope its my really old monitor / graphic card which is causing the problem.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

For someone who still thinks I am bragging / joking, here is the proof. I am using FF on Win 2003 if that makes any difference.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe Dani ought to know about this as it was working fine for me a couple of hours back.

PS: Am I seeing things or the rep dots are really going dark green...

iamthwee commented: You need glasses. -2
John A commented: iamthwee, you aren't very nice :P But no, I can't see any change in the color... +11
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I know I said I'd stop in this thread, but I can't help it :(

:-()

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Considering that the new reputation feature of displaying the name of the repper is out, its quite interesting to skim through some old threads and see what some people think about others.

Here is one interesting thread which has a lot of 'interesting' rep activity. I just thought you would like it. Read through the rep comments and you would really have a good time.

Feel free to post your own observations / interesting threads.