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

Right shifting 1 by 8, 16 or 24 times isn't going to get you anywhere. After a single right shift, the number will become 0 and 'AND'ing it with any number would make no difference. Oh and BTW, 0XF is the same as 0XFF or 0XFFFFFFFF.

Try something like:

int main()
{
    int x,y,z, i = 16;

    x = (unsigned char) (i >> 2 & 0xff );
    y = (unsigned char) (i >> 3 & 0xF );
    z = (unsigned char) (i >> 4 & 0xFFFFFFFF );

    cout << "Original number: " << i << '\n';
    cout << "x=" << x << endl;
    cout << "y=" << y << endl;
    cout << "z=" << z << endl;
    getchar();
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Is it too late to join the tournament?
Nah, just jump in the fray. Write a PM to the admin if these people don't let you in. ;-)

ndeniche commented: lol +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If you are selecting it from a Calendar widget, won't it be automatically validated? Of course you can't pick out '123/123/123' from it, can you?

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

Tutorials wont' teach you everything and definitely not the way you expect it to be. If you are serious on this AJAX thing, getting a good book would be recommended. Also, it depends on which server side language you would be using but I will safely assume that you are working with PHP.

Also since AJAX is just a framework which does nothing more than provide a bunch of functions which can send request to the server and accept the request via Javascript, expertise in the server side language of your choice would be expected if you want to develop some real application or start serious studying.

If you are not familiar with PHP, I would recommend you to do a bit of PHP before jumping on the AJAX bandwagon. And as far as tutorials are concerned, a simple google search for 'Ajax with PHP tutorials' or 'AJAX tutorials' should come up with quite a few useful results.

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

A function with a base case(the terminating condition) and a recursive case, calling itself is known as Recursion. So whats basically happening in the above case is that to tackle the problem of the generation of result set which grow exponentially, and to simplify the solution, I decided to call the same function within itself seeing that each run of the function would generate a permutation for me.

Maybe you should wait a bit longer before submitting this solution or start reading your text book or the ample resources on the internet. :-)

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

Maybe this should be a good starting point:

// Untested

import java.net.*;
import java.io.*;

public class A
{
    public static void main(String args[])
    {
        try
        {
            ServerSocket ss = new ServerSocket();
            ss.bind(new InetSocketAddress(100));
            System.out.println("Application started");
            Thread.sleep(1000000000);
        }
        catch (SocketException e)
        {
            System.out.println("Application already running");
            System.exit(1);
        }
        catch(Exception e)
        {
            System.out.println("Application encountered some problem.");
            System.exit(1);
        }
    }
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Dump the loops, what you need is a recursive algorithm which would work for arbitrary lengths of arrays. One of the way is using 'Heap Permute'. Here is a sample program which you can easily adapt to use with C style strings:

// Untested

const int SIZE = 4;
static int counter = 1;

void swap(int arr[], int one, int two)
{
    int tmp = arr[one];
    arr[one] = arr[two];
    arr[two] = tmp;
}

void print(int arr[])
{
    for(int i = 0; i < SIZE; ++i)
    {
        cout << arr[i] << "  ";
    }
    cout << " ------->  " << counter++;
    putchar('\n');
}

void permute(int arr[], int size)
{
    if(size == 1)
    {
        print(arr);
    }
    else
    {
        for(int i = 0; i < size; ++i)
        {
            permute(arr, size - 1);
            if(size % 2 == 1)
                swap(arr, 0, size - 1);
            else
                swap(arr, i, size - 1);
        }
    }
}

int main()
{
    int myArr[SIZE] = {1, 2, 3, 4};
    permute(myArr, SIZE);
    cin.get();
}
Killer_Typo commented: a very smart man indeed +6
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If you don't know anything about Javascript, first start off with it before jumping in the AJAX bandwagon.

1. W3Schools
2. Javascript Kit
3. HTML Goodies
4. Javascript Tutor

The above ones should get you started. Of course, if you have any specific queries, you can always ask them here. :-)

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

Implementation of Red Black Trees in Java along with applet for illustration purposes.

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

A linked list is nothing by collection of nodes which contain data and a pointer to the next node.

Node
-----^------
[data | ref] -> [data | ref] -> ....

Create a class called as Node which would have an Object reference to hold reference to objects and a Node reference to hold a pointer to the next node in the linked list.

The linked list class would contain a member variable 'head' of type Node which would point to the head of the list.

As for the rest, you should read up on something related to Linked Lists. Read this and this.

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

> can we run a run() method with out using a start() method in a program?
Yes, but it won't work the way you expect it to work.

Calling the run() method directly would be like calling a normal method. No thread of execution is created, no concurrency. On the other hand, calling the start method spawns a new thread of execution which can execute concurrently with other threads by executing the run() method.

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

> I could have sworn that one fizzled out. Oh well.
See. You do this and wonder why the forum is a boring and dull place. :)

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

> Which one was that?
This?

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

You just have to accept the user input, send the data to a script on the server (python or perl) which would append the data to a file which already exists on the server.

Maybe you should start off with this if you plan on using CGI with Python or this for CGI with Perl. I personally haven't done any of this so don't know a lot but the links should suffice the purpose.

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

Narayan, have you done some research on your part? Have you skimmed through the IE bug database(if there is any) to see if this problem has been encountered by others? Maybe you are using some Gecko specific features in your code which don't seem to work well on IE. Have you tested your code on Opera as well as Netscape?

There are numerous possibilities as to the reason this is happening, most of them seem to be stemming from not using cross browser compatible code.

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

Start off with a simple project of creating a 'simple login page'. The user input would be validated against the values in the database. After you finish this, let us know so that we can suggest you better and tougher exercises.

Considering that you have already completed your course, I am sure you must be knowing how to go about this project.

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

libsdl is a better choice than BGI since it has a host of functions and has better tutorials and support on the internet than BGI. Considering that you have one entire month for making the game, you can easily switch to libsdl and finish off the project.

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

> y c++ is not fully oops
Because it was meant as a OO replacement for C programmers. Also not everything is an object in C++. In pure OO languages, even a class in an object and everything which happens, happens due to message passing between objects. Smalltalk is a pure OO language.

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

Narue, before starting a new thing you must finish off pending business. We are still waiting for the results of the previous competition...

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

Though I personally haven't used it, this seems promising.

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

You can access the parent window or the window which opened the new window using the global reference 'opener'.

Keep one hidden field each for the data which you want to pass from the new page to the original page and using the reference of the original page (opener), manipulate the fields of the parent window.

Something like this:

<!-- Parent (ee.html) -->
<html>
<head>
    <script>
    function go()
    {    
        window.open("dd.html");
    }
    </script>
</head>
<body>
<form name="frm">    
    <input type="text" value="Hello" id="txt" name="txt" />
    <input type="button" name="btn" id="btn" value="Button" onclick="go();" />
</form>
</body>
</html>
<!-- Child (dd.html) -->
<html>
<head>
    <script>
    function go()
    {
        alert(opener.document.frm.txt.value);
    }
    function change()
    {
        opener.document.frm.txt.value = "This is changed text";
        this.close();
        opener.focus();
    }
    </script>
</head>
<body onload="go();">
    <form>
        <input type="button" value="Change Value in Parent" id="btn" name="btn" onclick="change();"/>
    </form>
</body>
</html>
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Midimagic, you are getting confused between the 'display' attribute and 'visibility' attribute of CSS. Visibility attribute never removes the element from the page, it just hides it. It still influences the page layout and takes up space.

The difference between 'hidden' and 'collapse' is that 'collapse' works on normal as well as table elements, whereas 'hidden' works only for normal elements.

Fungus, I gave you a working sample code which nearly does what you want to do. If you want further help you have to at least try out something and paste it here and tell me what is not working.

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

> Even if you could do that, Firefox closes so quickly that nobody could read it.
The 'onunload' event fires before the browser is closed and if an alert is fired, stops the window from closing so 'closes so quickly' is not an issue as such. The problem here is that the OP wants a function which would be fired _if and only if_ the browser is closed which I don't think is possible using any standard way.

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

Yes, the visibility property works cross browser. But the catch here is that when the visibility is set to 'hidden', the element is still present there and still contributes to the layout of the page, it just isn't visible.

On the other hand, setting the display property to nothing('') will remove the element and effect the layout of the page since the element is physically not there (though I guess it exists in the DOM since we can always make it come back).

Choose the method which suits you the most in the given scenario keeping the above things in mind. Here is an interesting read.

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

> although i doubt i will get those titles
That is the exact intent behind proposing this idea. Narue would be the one gobbling up all silver medals and you all folks would be left behind sucking thumbs. Sheesh, Narue really is a scheming kind. ;-)

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

> I go into the irc... so why ain't i been rep spammed?
I am almost always there and I have never see you even once. :-)

> Why will it be reversed?
Too late, it already has been reversed.

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

This thread with its controversial title has stopped being of any use to anyone. Closed.

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

India.

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

You need to paste what you have achieved so far, I mean the CSS and the base code, so that I have something to chew on.

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

You can use the 'className' property of an element to change the class name on the fly.

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

> there is a function in c++ called strlen() which tells you the length of an array
That would only be for char arrays, not any array.

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

> He didn't rep me at all!! Let's ban him!
*hint* He repped only those who hang out with him in the IRC.

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

> BORLAND C++ is the best!!
'Created a game using C++ and OpenGL' is much better thing to write on your resume than 'Created a game using Borland C++'.

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

Every object you create can have a draw method, which will know how to render itself on the screen. So you just need to call the draw method of each object in a loop for all objects in the game. The object will have its own information like color, position etc. so you don't need to worry about the location of drawing.

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

No, that won't work. Destruction of a class object has got nothing to do with the display. You would anyways need to actually 'erase' the thing which is on the screen. Thus your logic would consist of two parts: Game logic and graphics.

When the pawn is moved, you need to call the move() function on the object as well as repaint the screen instead of just destroying the object.

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

> Okay......anybody know any get rich quick schemes on the internet?
Wake up and start working.

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

Like I said before, you need to read the function reference which is inbuilt in Turbo C to find it out since I have never worked with such things. Read something related to view ports concepts in Turbo C.

You have two choices:
- Use clrscr() and redraw the entire board with the updates
- Clear a specific portion of the screen using some functions in BGI.

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

> "talk really nice and white." Hmm.. Whatever could you mean by this.
An expression I use for 'act like an angel'.

> You want to pay for the hot chicks' meal in case you end up getting lucky
I run the risk of the chick not agreeing with me and I end up wasting my precious money. :P

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

I am sorry I highlighted the wrong part.

The statement you ought to change is: string[25] = '/0'; . It should be string[25] = '\0'; , which is a null terminator.

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

You should try to copy and paste the exact code provided to you, at least till you get the concepts right.

I pasted:

for(int i=0;i<24-1;i++)
{
    string[i] = getch();
}

You wrote:

for(int i=0;i < 24,i++)
  string[i] = getch();

Don't you think these two are different?

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

For anyone out there who wants to have a nice dinner with a hot chick and that too for free:

- Ask a chick out for a date in a four/five star hotel. (preferably one who doesn't know where you live)
- Take her to a hotel far away from your house.
- Have a nice dinner, talk really nice and white.
- When the dinner is about to end, disappear from there never to be seen around that area or in the area where the girl lives for a few days.

Simple. Works like a charm. ;-)

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

Why a null terminator after each character input? I guess it was a typo.

char string[100];
for(int i=0;i<100-1;i++)
{
    string[i] = getch();
}
string[i+1] = '\0';
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Damn, someone bad rep Rash for me as I have to spread some around first..
I have given him enough good points to last for 2-3 rounds... ;-)

joshSCH commented: Damn your rep power. I would bad rep you, but I'm afraid of the consequences :) +16
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> It's not often that I get to play with someone as uptight as christina.
Shoo, go away and mess with Betov and his henchmen. :-)

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

> what's your name in yahoo?
> did you take the move?
The same name you saw there. Just to not leave you in hesitation, I did pass a comment about the bishop. And no, I didn't make a move.

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

I was watching the game and no, I didn't move it. Though I think if Jocamps says he didn't make the move, he must be telling the truth, in which case, I am at a complete loss on how something can happen on its own.

Come to think of it, would a really famous site like Yahoo! which hosts chess game be so buggy to allow someone to carry on with other's game without even asking for a confirmation? Or should it really allow a watcher to play the game since I distinctly remember pressing the watch link.

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

I don't think so, I was the watcher.

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

I don't know, it seemed all natural to me. But then again if Jocamps says the game got disconnected, then such must have been the case though I fail to imagine how an automatic(awful) move must have been made.

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

> *cough i was joking *cough
Its nice that you regard Joey as a mind reader to have known from your smiley'less' post that you were joking. :-)

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

I am afraid I don't know a lot about Turbo C graphics library and its specific functions. But for erasing the previous figure and redrawing it at a new location, consider erasing the particular part of the screen where s1 is present or clear the whole screen and draw a new s1 at the specified location.

You can find the function reference here.