Yes, you can simplify this code - I would suggest to dismiss branching statements in "decode" procedure and make use of static array of LED patterns. Something like:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAKE_PATTERN(b1, b2, b3, b4, b5) ((b1 << 4) | (b2<<3) | (b3<<2) | (b4<<1) | b5)
#define EXTRACT_BIT(pattern, bit) (((1<<bit) & pattern) != 0)

static int ledStates[] = {
                        MAKE_PATTERN(0,1,1,1,1),
                        MAKE_PATTERN(1,1,1,1,1),
                        MAKE_PATTERN(0,0,1,1,1),
                        MAKE_PATTERN(1,0,1,1,1),
                        MAKE_PATTERN(0,1,0,1,1),
                        MAKE_PATTERN(1,1,0,1,1),
                        MAKE_PATTERN(0,0,0,1,1),
                        MAKE_PATTERN(1,0,0,1,1),
                        MAKE_PATTERN(0,1,1,0,1),
                        MAKE_PATTERN(1,1,1,0,1),
                        MAKE_PATTERN(1,1,1,0,1),
                        MAKE_PATTERN(1,0,1,0,1),
                        MAKE_PATTERN(0,1,1,0,0),
                        MAKE_PATTERN(1,1,0,0,1),
                        MAKE_PATTERN(0,0,0,0,1),
                        MAKE_PATTERN(1,0,0,0,1),
                        MAKE_PATTERN(0,1,1,1,0),
                        MAKE_PATTERN(1,1,1,1,0),
                        MAKE_PATTERN(0,0,1,1,0),
                        MAKE_PATTERN(1,1,1,0,0),
                        MAKE_PATTERN(0,1,0,1,0),
                        MAKE_PATTERN(1,1,0,1,0),
                        MAKE_PATTERN(0,0,0,1,0),
                        MAKE_PATTERN(1,0,0,1,0),
                        MAKE_PATTERN(0,1,1,0,0),
                        MAKE_PATTERN(1,1,1,0,0),
                        MAKE_PATTERN(0,0,1,0,0),
                        MAKE_PATTERN(1,0,1,0,0),
                        MAKE_PATTERN(0,1,0,0,0),
                        MAKE_PATTERN(1,1,0,0,0),
                        MAKE_PATTERN(0,1,0,0,0),
                        MAKE_PATTERN(1,0,0,0,0),
                         };

typedef struct LATGbits
{
    unsigned char LATG1;
    unsigned char LATG0;
    unsigned char LATG13;
    unsigned char LATG14;
    unsigned char LATG12;

} LATGbits;

void decode (unsigned char * msg) {
    char * found = strstr(msg, "DO=");

    if (found == NULL)
        return;

    int ledPatternIndex = (int)strtol(found+3, NULL, 16);

    // something wrong with input string parsing
    if (ledPatternIndex == 0 && strstr(msg, "DO=0x00") == NULL)
        return;

    if (ledPatternIndex > 31)
        return;

    int pattern = ledStates[ledPatternIndex];

    LATGbits lATGbits;

    lATGbits.LATG1    = EXTRACT_BIT(pattern, 4);
    lATGbits.LATG0    = EXTRACT_BIT(pattern, 3) ;
    lATGbits.LATG13   = EXTRACT_BIT(pattern, 2) ;
    lATGbits.LATG14   = EXTRACT_BIT(pattern, 1) ;
    lATGbits.LATG12   = EXTRACT_BIT(pattern, 0) ;
}

int main()
{
    decode("DO=0x07");
    return 0;
}

Hope that helps !

As unofficial rule - all C/C++ macros are written in all caps. Underscores simply helps to improve readability if constant consists from several words. It's possible to name a variable with underscores, but it's uncommon. So if you see all caps symbol with underscores in it - you can be pretty sure that it's a macro definition.

[QUOTE=hovestar;1721794]Or you could devise an AI to follow the left wall[/QUOTE]
This doesn't works if maze has disconnected walls.

[QUOTE=fallopiano;1464979]Hey everyone, as the title suggests I'm trying to find a function or some code that'll execute a string of code in Lua.
[/QUOTE]
[URL="

What language is the most difficult to compile and why ? (except natural ones)

[QUOTE=mohan_198505;787487]4.Login name and password are hardcoded in the program and not strored in any file.[/QUOTE]
I find this self-contradictory. "Hardcoded" means that password WILL BE stored in program file as embedded string resource. So for added security i suggest to hardcode not plain password, but instead MD5 hash of password. And when user enters password - you will do check md5(password)==[ICODE]hardcoded_md5_of_password[/ICODE].
Point is that if something will extract password hash from the executable file - he/she will not find-out password, because md5 hash is one way encryption. (Unless he/she does bruteforce,- generates all possible passwords and compares it's hash with stored one).
In any case a way of storing md5 hash is a LOT more secure than storing just plain password.
p.s.
google MD5,- there a a lot of md5 implementations in C.
good luck

seems there is a better way to implement what you want, see here:
[url]http://stackoverflow.com/questions/1637587/c-libcurl-console-progress-bar[/url]

[ICODE]write_data(...)[/ICODE] is callback function which will be called every time each new data portion arrives from internet. So basically you should measure download speed and remaining time in your function write_data():

  1. save current time in local variable time1
  2. then download speed will be [ICODE]written/(time1-time2)[/ICODE]

  3. save current time in global variable time2
  4. remaining time will be [ICODE]bytes remaining/download speed[/ICODE]
    Current time you can get with functions in time.h.
    As about bytes remaining, i am not sure. It should be => total fize size - current file size. The problem is how to get total file size. Check libcurl documentation - maybe there are some functions which probes file sizes on net before downloading it.

good luck.

And a bit shorter version ;)
CODE=C)[/CODE]

Also i want to say that this question is related to compiler design. So i would suggest to learn compiler design/programming in general, before advancing to concrete problem.

[QUOTE=anu john;416424]Ye. it will be a kit with ethernet chip n rj45 connections.therefor the tcp/ip protocols needed will be taken care of..
nw i need to program my controller using c language in a way that i can access my sql server 2005 on a remote machine...Also im trying to find out if keil compiler supports vc++, since i know that sql can be connected using this language...
plz reply...[/QUOTE]

Then i think most simple way to achieve this is:

  1. run your own web server somewhere on net.
  2. connect web server to SQL database through PHP or other methods.
  3. make HTTP calls (POST/GET) from your ethernet chip to that web server.

So that is communication will be =>
your controller <-> http server <-> sql server

As about SQL problems i could suggest only 2 things, because main perfomance problem is disk IO:

  1. Read/write from/to SQL server as rarely as possible. (Maybe you can cache data localy for some miliseconds or so and after reaching cache limit - send data for update to SQL server. Reads you can perfom more frequently, but also should be lowered as possible)
  2. Put all database files on [URL="

From the problem description is not clear - Do you want just move 3D model in space or animate different pose ? Ok, I make assumption that you want to animate pose, because you mention different body parts.
How to do that just google keywords "mesh deformation" and/or "skinning GPU".
Here is a crash tutorial how to do very simple mesh deformation on GPU-
[url]http://www.ozone3d.net/tutorials/mesh_deformer.php[/url]
(skinning should be done on GPU with the help of vertex shaders because it should be more efficient)

Happy coding.

I don't think that SQL server (or any other database server) is suited for multiplayer purposes. Usually game devs for multiplayer mode writes it's own server and client. So I would recommend to you to write TCP/UDP server and client by using System.NET library. Check this out-
[url]http://www.codeproject.com/KB/IP/socketsincsharp.aspx[/url]

Since you didn't write a language in which you want to program - for the beginner i would recommend either [URL="

[QUOTE=akki30;1285547]how this function is used. i m so confused n not getting the proper result[/QUOTE]
Fibonacci number is calculated in pretty straightfoward way:
[IMG]http://upload.wikimedia.org/math/0/c/e/0cebc512d9a3ac497eda6f10203f792e.png[/IMG]
No additional comments needed...

Indeed CUDA is only for nVidia cards. I suggest better using OpenCL. Also if these calculations is only for computing image transformations- you can try Pixel Shader.

Additional idea how to see similarity between Vigenère and XOR ciphers is this- compare encryption formulas-

Vigenère cipher => [ICODE]C = (P+K) mod 26[/ICODE]

XOR cipher => [ICODE]Cb = (Pb+Kb) mod 2[/ICODE]

Here C/P/K is ciphertext/plaintext/key letters respectivelly and Cb/Pb/Kb is ciphertext/plaintext/key bits respectivelly.

So the only differences are:

  1. Vigenère performs modulo 26 arithmetic and XOR performs modulo 2 arithmetic.
  2. Vigenère encryption is letter-by-letter and XOR encryption is bit-by-bit.

So as you can see from the formulas both ciphers make substitution in plaintext data. And hence both ciphers are called [URL="

A VERY interesting question ! Thanks for asking such thing :)

Both methods are polyalphabetic ciphers. There are some algorithms for polyalphabetic ciphers which computes key size from ciphertext. Once key size is known, ciphertext can be splitted into columns which are vulnerable to simple [URL="

Wiki is our friend:
[url]http://en.wikipedia.org/wiki/Maximum_subarray_problem[/url]
Kadane's algorithm performs in O(n) for 1D array.

[QUOTE=AuburnMathTutor;1257975]
I pointed out that we started with a language that was much farther from natural languages, i.e. machine language, and have since developed languages that are more similar in structure to English.
[/QUOTE]
Seems you are over-fitting your observations of programming language evolution of C-like languages. Take a look at array programming language named J, which descended from APL in 1990.
[url]http://en.wikipedia.org/wiki/J_(programming_language[/url])
Quicksort algorithm written in J is:
[CODE]
quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)
[/CODE]
Is it closer to natural language ? Or is it closer to machine language ? Or maybe is it closer to neither ?
Still you may ask some fans/matematicians which uses J for math related problems quick research, and I guarantee that you will get answer Where is the power of tacit programming J language. So in the end you may understand that programming languages (like natural languages) evolves in many directions. The only reason for language to be alive (like natural one) is active community of developers that still develops in that language. Thats all.

[QUOTE=GameGuy;1212348]
How long, if I have no experience, until I am making 3D FPS'?
[/QUOTE]
My advice - don't start with FPS project. It's the problem which faces beginners of game programming. If you want to learn 3D game programming - at first choose very basic 3D project - such as 3D card game. For example take a look at my 3D card game which i've developed in about 3-4 months:
[url]http://coding-experiments.blogspot.com/2010/02/carousel-fishing-card-game.html[/url]
And these 3-4 months I've also spent for learning C++/DirectX. But given the fact that i have general development experience about 8-9 years, it is not hard for me to learn basics of any language. So im predicting, that for novice programmer such 3D card project may take even longer => 6-8 months. So FPS project is certainly not for beginners (except maybe if you wont develop 3D game engine, but use already existing. Still in that case i think FPS is not the way to go). So choose lighter 3D project and go on.

P.S.
If you want you can use my card game as starting point. You can modify/use it's source as you wish.

P.P.S.
Books that i've used in process of development -

  1. "C++ Primer, Fourth Edition
    By Stanley B. Lippman, Josée Lajoie, Barbara E. Moo"

  2. "Introduction to 3D Game Programming with DirectX® 9.0
    Frank D. Luna"

  3. "3D Math Primer for Graphics and Game Development
    By Fletcher Dunn and Ian Parberry"

1,2 was heavily used while 3 can be considered as optional, ...

[CODE=C]

include <stdlib.h>

// on windows clear screen with
system("cls");
// on unix/linux clear screen
system("clear");
[/CODE]

I made some fixes, here corrected version:
[CODE=C]

include<stdio.h>
include <stdlib.h>

void getOption();
void getData(int num1, int num2);
void calc(int option, int num1, int num2);
float add(int num1, int num2);
float sub(int num1, int num2);
float mul(int num1, int num2);
float divm(int num1, int num2);
void printResult(float result);

void clrscr() {
// define what is clrscr() - legal on Win
system("cls");
}

void getch() {
// getch is non-standard C and should be avoided.
// use ANSI-C compliant getchar function
getchar();
}

int main()
{

clrscr();
getOption();
getch();
}

void getOption()
{
// initialize num1,num2 to something
// otherwise you will get runtime error
int option,num1=0,num2=0;

clrscr();
printf("[1] Addition\n");
printf("[2] Subtraction\n");
printf("[3] Multiplication\n");
printf("[4] Division\n");
printf("\nChoose options: ");
scanf("%d", &option);
calc(option,num1,num2);

}

void getData(int num1, int num2)
{
printf("Enter two integers: ");
scanf("%d %d", num1, num2);
}

void calc(int option, int num1, int num2)
{
switch(option)
{
case 1: clrscr();
printf("\"ADDITION\"\n");
getData(&num1,&num2);
printResult(add(num1,num2));
break;

case 2: clrscr();
printf("\"SUBTRACTION\"\n");
getData(&num1,&num2);
printResult(sub(num1,num2));
break;

case 3: clrscr();
printf("\"MULTIPLICATION\"\n");
getData(&num1,&num2);
printResult(mul(num1,num2));
break;

case 4: clrscr();
printf("\"DIVISION\"\n");
getData(&num1,&num2);
printResult(divm(num1,num2));
break;

default: printf("Invalid key");

}
// put pause, before repeating user actions
system("pause");
main();
}

float add(int num1, int num2)
{
int add;

add=num1+num2;
return add;
}

float sub(int num1, int num2)
{
int sub;

sub=num1-num2;
return sub;
}

float mul(int num1, int num2)
{
int mul;

mul=num1*num2;
return mul;
}

float divm(int num1, int num2)
{
float div;

div=num1/num2;
return div;
}

void printResult(float result)
{
printf("The result is: %.2f\n", result);
getch();
}

[/CODE]

-If you want to become better [I]generalist developer[/I] - linux is a must because of plenty development languages/environments choises.
-If you want to become better [I]game developer[/I] - windows is a must because of tools avialable for GPU development. (Unless you want develop for some console/device, in such case Win may not have big bonus)

nope, this is just my little research on your problem.

You can start here-
[url]http://en.wikipedia.org/wiki/Computer_vision[/url]
Yes, you will need to track motion, but it's problem you concentrate too early.
At first you need to concentrate at object (hand) recognition phase.
You could start here-
[url]http://www.codeproject.com/KB/audio-video/face_detection.aspx[/url]
Also somehow i think for such project perfomance is important thing cause you will operate on video frame data on real-time, so JAVA is not an option here.
Better take C/C++.

Good luck.

[QUOTE=pato wlmc;1260648]Well, right now i'm using linux, but i've heard that windows is really best for programing videogames ( on c++ ) well, wich O.S. do you think is the best?

P.D. Sorry for the bad english jeje :$[/QUOTE]
When it comes to game development definitely answer is Windows. Simply because nothing beats it at tools available for game & graphics development. For example,- take a look at existing programs for Pixel Shader development & testing under Linux/Mac/Windows:
[url]http://en.wikipedia.org/wiki/GLSL#IDE[/url]
From these nothing beats feature-rich and bug-free program "Render Monkey" which currently is only for Windows.
This is just one example, but in principle same should hold for many other development tools for graphics-driven applications.
If you want second example take a look at NVIDIA solution which lets developing programs for GPU (through OpenCL,CUDA,...) DIRECTLY in Visual Studio ->
[url]http://developer.nvidia.com/object/nsight.html[/url]
So we can say that now Windows has IDE for GPU development. Do Linux has GOOD alternatives to this ?

[QUOTE=ranjita.cdt.esg;1257189]
at first i was very happy seeing all the links you provided but when i implemented it, it did not workout.
[/QUOTE]
Can you be more concrete ? What results you got and what you expected instead ? Also have you tried different sharpness kernels - 3x3 and 5x5 ?

[QUOTE=ranjita.cdt.esg;1257189]
checked up nvidia site also downloaded opengl cg library also it is very slow i think it does not run on my pc and laptop very slow can get that to work at that pace.
[/QUOTE]
It can be that your computer video card has no pixel shader support - and hence program runs under emulation mode, which is slow. Google it- does your video card supports pixel shaders and until what version pixel shaders are supported. (1.0-5.0).

(That Cg lib MUST run fast on modern GPU's, because it uses hardware accelerated processing. Unless your video card is OLD and/or integrated - like Intel).

[QUOTE=ranjita.cdt.esg;1257189]
Shall i send the code to you and blurred image to u r email id.
[/QUOTE]
Just post here image after sharpness filter applied and tell us - what was not like you expected to be.