pseudorandom21 166 Practically a Posting Shark

What's up with all the "hacking" lately? I thought that's what we were doing, but we're not on the news.

pseudorandom21 166 Practically a Posting Shark

I think the best choice is to begin learing a lower level language like C++ or java, after you master those, you can easily go up to more higher languages. The other way around is not that easy

Lol, I love C++ (it was my first language), but I have a hard time telling anyone to learn C++ before anything else, because that takes f***ing forever. "Learning curve" really means "more time spent doing nothing." It may take him the next 3 years to learn C++ as his first language, so you can understand my concern about someone on a programming forum dictating 3 years of time.

My best advice if you decide to take that route is to learn other programming languages as well. I would actually recommend the book "Learning Visual C++ 2010" by Ivor Horton, it teaches C++, C++/CLI, and using Visual Studio. C++/CLI is a managed language that uses the .NET framework, and as such makes your transition to learning to use any of the .NET languages much easiesr.

Java and other languages are still big contenders these days too, but here's a big tip:
"Don't invest too much time in a language that won't be used 3 years from now."

pseudorandom21 166 Practically a Posting Shark

And how does stringstream solve
1) recursion
2) comma-separated blocks?
It helps to read carefully... :icon_rolleyes:

Hey Kid, read the forum rules and add the information you forgot.

It's a good start at least. For recursion you'll usually want to keep your data around, often times by passing it as argument to the function's parameters. I suppose (according to your needs) you could make a static string inside the function.

Oh and actually that doesn't convert an int to string! (oops)

template<typename T>
string ToString( T in )
{
	stringstream ss;
	ss << in;
	return ss.str();
}
pseudorandom21 166 Practically a Posting Shark

Hi i am a College Student and has a thesis of Face Recognition, this thesis was great and i want to have an experience building this thesis. But the problem is i don't know where to start.


I have already studied some of structure approach of this thesis and apparently i discovered that it could be done in Visual C# language, but my problem is i do not how to build it.

Can anyone know how to build it? and somehow what kind of Library or devices etc. i'll be using in order to do this kind of thesis?

I am using right now a Visual Studio 2008.

Any reply would be great from you guys...

Thank you... and GOD Bless...

Is this what you want? http://www.codeproject.com/KB/miscctrl/webcam_c_sharp.aspx?display=Mobile

If not, you'll have to be more specific.

pseudorandom21 166 Practically a Posting Shark

Int to string is easy in C++ with a "stringstream", or if you prefer you can use an old C function.

int someInt = 256;
string out;
stringstream(someInt) >> out;
pseudorandom21 166 Practically a Posting Shark

Post your code between the code tags like this: [code] /* Code */ [/code]

What does this do?

if (a == 1 || a == 3 || a == 5 || a == 7 || a == 9 || a == 11 || a == 13 || (a == 2 && b == 13)
|| (a == 4 && b == 1) || (a == 6 && b == 13) || (a == 8 && b == 1) ||
(a == 10 && b == 13) || (a == 12 && b == 1) || (a == 14 && b == 2))

It's a pretty complicated piece of logic that can probably be refactored to something much simpler.

pseudorandom21 166 Practically a Posting Shark

I'm hoping for a second opinion on which of these two motherboards to buy (I hope this is the right place).

http://www.newegg.com/Product/Product.aspx?Item=N82E16813128511&Tpk=Gigabyte%20A75M-UD2h
http://www.newegg.com/Product/Product.aspx?Item=N82E16813138331&Tpk=Biostar%20TA75A%2b

Obviously the Biostar has better advertising, which one would you pick, and why? (Space inside my case is not an issue at all, and the USB 3.0 ports are an extreme bonus).

I will be pairing one of these with an AMD A8 APU for my new build. Also, the price difference is of no concern.

Oh and I also was wondering about swapping out my hard drives, I never really get that part quite right. What is the process for swapping a hard drive (Windows installation) to the new machine?

pseudorandom21 166 Practically a Posting Shark

I would be shocked if you are. Dirty minds like to write code, I hear. ;)

Nahh, your code is just way better. ;)

pseudorandom21 166 Practically a Posting Shark

I would re-organize your includes to be (much more neat):

#include<windows.h> 
#include<commctrl.h>
#include<conio.h>

#include<cstdlib>
#include<cstdio>

#include<iostream>
#include<string>
#include<vector>

and your entry-point is wrong!! int main(char argc) should be int main(int argc, char *argv[]) I think maybe you should make a function to get the input character-by-character. It makes the code look neater and much easier to modify and extend if you use functional decomposition.

Basically you should read that codeproject article I posted, and be willing to put a little more work into the program, writing a windows hook is really not a difficult task and the other ideas in the article will be a fun learning experience too.

pseudorandom21 166 Practically a Posting Shark

Using Win/Mac is like breathing to me. I suppose I must repetitively fumble around with my hardware (keyboard, laptop), a brain interface solves that problem.

pseudorandom21 166 Practically a Posting Shark

If you're still wondering, a variable on the stack has an address, which points to a reserved section of memory. The process is veery similar to using dynamically allocated objects with pointers.

Hopefully this small example can clear up some of it:

#include <iostream>
using namespace std;
int main()
{
	int someInt = 0; //<-- memory allocated and initialized to 0.
	cout << &someInt << endl;//<-- print the address of someInt
	//^^ It really prints the address of the base of the allocated section of memory.
	int *dynamicInt = new int(0);//<-- memory allocated (on the heap) and initalized to 0.
	cout << dynamicInt << endl;//<-- print the address of dynamicInt

	//Assign both sections of memory the value of 1.
	someInt = 1;
	*dynamicInt = 1;//<-- here the pointer is "de-referenced"
	cout << "someInt = " << someInt << endl;
	cout << "dynamicInt = " << *dynamicInt << endl;

	//Create a reference to both.
	int &someRef = someInt;//<-- disregard the syntax with regard to the address
	int &otherRef = *dynamicInt;//

	//Modify both with the reference.
	someRef = 2;
	otherRef = 2;
	cout << "someRef = " << someRef << endl;
	cout << "otherRef = " << otherRef << endl;

	delete dynamicInt;//<-- free dynamically allocated memory.

	cout << "Press RETURN to continue." << endl;
	cin.get();
	return 0;
}
pseudorandom21 166 Practically a Posting Shark

Ahh that makes sense.

Some guy on here a while ago didn't like how un-random Random() was. We discussed ways to be more random then just to base it on time, and he ended up using the microvolt noise from his microphone jack to seed Random(). Try and replicate electrostatic noise!

Sweet idea, I like it.

pseudorandom21 166 Practically a Posting Shark

Thanks. What you suggested seems to work, I just have a doubt: after doing the ss >> input, I see that all white spaces are trimmed and the lines split into several chucks. I tried copying every chunk into a char array, but I can't seem to be figuring out the cast (eg. for line #7):

char arrBuffer[10][64];
stringstream ss (dataStructure[6]);
          while (ss >> input)
                 for (int k=0; k<=9; k++)
                      arrBuffer[i] = (char) input;

I only need three fields from the textfile ("Profile Name", "Renewal Start Date" and "Expiry"). The dates are split (since there's spaces in the middle), but putting them together shouldn't be too difficult

Why do you want to use character arrays at all? This line is completely nonsensical: arrBuffer[i] = (char) input; because "input" is a C++ string class instance.

Here's a small C++ string class demo I wrote a while back:

#include <iostream>
#include <string>
#include <algorithm>
#include <sstream>
using namespace std;

int main()
{
 string cppString = "Hello World.";
 cppString = "No error, no confusing C functions.";
 getline(cin,cppString);//No buffer overflow from too much input.

 //Use much like an array.
 for( std::string::size_type i = 0; i < cppString.size(); i++ )
   cppString[i] = 'x';

 cppString += " -- Simple string concatenation too.";

 //Usable with the C++ STL algorithms.
 random_shuffle(cppString.begin(), cppString.end());

 cout << "Can still get a C string if you REALLY want to also." 
  << endl << cppString.c_str() << endl;

 //Easily convert from string to int/floating point type.
 int someInt = 0;
 cin >> cppString; …
pseudorandom21 166 Practically a Posting Shark

Heh heh heh, I bet you kids never had an 8MB graphics card named "Rage".

<shudder> the ATI Rage IIC

pseudorandom21 166 Practically a Posting Shark

Show me yours and I'll show you mine.

Totally worth it.

pseudorandom21 166 Practically a Posting Shark

Hey I found an awesome hosting website, unfuddle.com
It seems to be exactly what I wanted, and appears to feature an unlimited number of subversion repos.

pseudorandom21 166 Practically a Posting Shark

Assuming I get to retire....

I would probably occupy myself with survivalism, or maybe be too lazy. I might just end up banning myself from PCs and start reading books. Archery sounds fun too.

pseudorandom21 166 Practically a Posting Shark

I was just wondering what is the usual solution for synchronizing solutions between laptop/desktop (or maybe in another case between home/work) ? I was thinking an svn repo. would do the job, but where to find free hosting, or can I host it myself?

pseudorandom21 166 Practically a Posting Shark

Agreed, we aren't in the stone ages of C programming--use vectors. The "app terminated in unusual way" may also be an uncaught exception, from my experiences.

pseudorandom21 166 Practically a Posting Shark

The easiest way may be to use the C++ STL.

ifstream inFile();//<-- file opened and checked for errors elsewhere
vector<string> dataStructure;
string input;

//Skip the first 5 lines:
for(int i = 0; i < 5; i++)
  getline(inFile,input);
//Store file in a data structure
while(getline(inFile,input))
   dataStructure.push_back(input);
//Extract some tokens
for(vector<string>::size_type i = 0; i < dataStructure.size(); i++)
{
stringstream ss(dataStructure[i]);
while(ss >> input)
   cout << input;//<-- token
}

Depending on how large the file is are you sure you want to store it in memory? Also, the use of the function "exit" in C++ is likely discouraged as it may result in destructors not being called (don't take my word for it, google it).

Not to be a stickler too but, it's usually considered bad practice to mix C and C++ IO.

vSize is zero because you've already read the entire file and the "get" pointer is at the end of the file, you have to set it back to the beginning to read the file again.
:: someFile.seekg(0,ios::beg);

pseudorandom21 166 Practically a Posting Shark

ok, i am going to have the program open another program that i downloaded from your second link and i am wondering how to position a different window from the console window using SetWindowPos(). How would you?

This may be easier http://msdn.microsoft.com/en-us/library/ms633534(v=vs.85).aspx

pseudorandom21 166 Practically a Posting Shark

This may also be a helpful snippet:

public static int GetRandom(int min, int max)
    {
      byte[] b = new byte[sizeof(int)];
      new System.Security.Cryptography.RNGCryptoServiceProvider().GetBytes(b);
      int i = BitConverter.ToInt32(b, 0);
      Random r = new Random(i);
      return r.Next(min, max);
    }

Is it appropriate to seed the Random class every call like that? I was just thinking it would be more appropriate to make a static Random seeded once for the lifetime of the application (as is typical with C rand() function).

pseudorandom21 166 Practically a Posting Shark

Oh there is a way to make your program run on a certain date/time, on W7 it's under:
Accessories -> System Tools -> Task Scheduler

It's a very useful Windows feature too :D

Also, I'm not yet convinced it's impossible to block ctrl + alt + delete, as soon as ctrl is detected the application can inject another keypress after it, ruining the combination. Another approach is to disable Windows' ability to actually run the alt+tab and ctrl+alt+del routines (maybe in a somewhat malicious way). What happens if you terminate explorer.exe when the user presses ctrl + alt + delete ? IDK, but it sounds fun!

Break out your windows hooks everyone!
http://msdn.microsoft.com/en-us/library/ms632589(v=vs.85).aspx

Note that I just assumed using a keyboard hook won't let you block ctrl + alt + del and alt + tab. I suppose if you can find a way to get your code into the address space of the process that does the ctrl + alt + del stuff then you can crash it, assuming Windows won't let you simply "terminate" it peacefully. But then again I suppose I could be entirely wrong.

Might want to block ctrl + shift + escape too, or better yet, all control keys (alt, control, etc.)

This link has some code and information about locking the desktop: http://www.codeproject.com/KB/winsdk/AntonioWinLock.aspx?df=100&forumid=62485&exp=0&select=1638161 it may be a bit outdated though.

pseudorandom21 166 Practically a Posting Shark

Now you guys are depressing me, I'm 21 already and haven't even got to use my skills for money. 50 - 21 = some wasted time, <sigh>.

pseudorandom21 166 Practically a Posting Shark

so.. are your chances of winning proportional to your effort? I just love those contests, it's nice to pitch a penny in the well but you should be able to work a little more to pitch a few extras IMO.

pseudorandom21 166 Practically a Posting Shark

I tend to think Iterators are more of an idea than being tied to a single implementation. A predefined function is one that is implemented already.

Stl algorithm: std::random_shuffle( someVector.begin(), someVector.end() );

pseudorandom21 166 Practically a Posting Shark

Do you have a handle to the other form? Here's how I have done it (when I first used .NET).

class FormOne{
   public void SomeEvent(){ FormTwo f2 = new FormTwo(this); }
}

class FormTwo{
   public FormTwo(FormOne ofm) {
     ofm.SomeEvent();
   }
}
pseudorandom21 166 Practically a Posting Shark

Hi, I'm trying to display a message in the compiler output using VS2010.
In C/C++ we can use: #pragma message(">> Win32 <<") , but for C# I'm not really sure what options are available.

pseudorandom21 166 Practically a Posting Shark

I don't even like using facebook, I get online to see if I have any messages, if not I just close the window.

I guess I just have no friends ;)

pseudorandom21 166 Practically a Posting Shark

<3 Daniweb.

pseudorandom21 166 Practically a Posting Shark

Well if the precision of the mouse isn't necessary then I use a gamepad. Basically the only time the gamepad annoys me is when I need to make a slight, like one or two pixel adjustment and can't get it right (sniping). Gamepad definitely not recommended for FPS games, but I just don't know what I would do without my xbox360 controller for dead space, mirror's edge, and sometimes crysis, and fallout new vegas.

Not to get too entirely off-topic, but Crysis 2 is amazing.

pseudorandom21 166 Practically a Posting Shark

Reading from a hard drive is typically around a million times slower than reading/writing to memory. I read that somewhere, don't quote me.

pseudorandom21 166 Practically a Posting Shark

make it public

pseudorandom21 166 Practically a Posting Shark

I can but I won't.

pseudorandom21 166 Practically a Posting Shark

It can't find the implementation of "AdjustTokenPrivileges", maybe your prototype (declaration) doesn't match the header of the definition for the function?

pseudorandom21 166 Practically a Posting Shark

You have to call that function somewhere in the program. I'll leave it up to you to figure that one out.

pseudorandom21 166 Practically a Posting Shark

1. Your success with multithreading is entirely up to you, imo you'll want to dedicate a bit of time to it because how can you expect to create applications that do non-trivial things with single-threaded applications?

2. Google try/catch in C++, chances are you just suck and this is a pathetic question, which do exist, no matter what daniweb tries to tell you.

pseudorandom21 166 Practically a Posting Shark

That would mean you should be searching for numbers that have nothing to do with -99, and when you want to quit the application -99 then becomes important. Your code looks like you are a C++ beginner, and I think you don't rest too much in a simple question, I would bet you are best to find your own way, and I would provide these most helpful references, please do become a better programmer. For our and your own sake.

http://www.cplusplus.com/doc/tutorial/
http://www.cplusplus.com/doc/tutorial/program_structure/
http://www.cplusplus.com/doc/tutorial/variables/

pseudorandom21 166 Practically a Posting Shark
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
void main()
{
int gdriver=DETECT,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
int i=100,j=100,f1=1,f2=1,r=50,k;
l:
// printf("\n\nEnter the co-ordinate where from you want to start to move the circle : ");
// scanf("%d%d",&i,&j);
cleardevice();
// printf("\n\nEnter the redious : " );
// scanf("%d",&r);
// if(r<i||r<j) {printf("\nWrong entry, Try again.");goto l;}
cleardevice();
getch();
while(!kbhit())
{

setcolor(WHITE);
circle(i+1,j+1,r); // printf("%d, %d",i,j);
delay(2);
/* for(k=1;k<=10;k++)
{
setcolor(k);
circle(i+1,j+1,r-(k*r/10));
delay(1);
setcolor(BLACK);
circle(i+1,j+1,r-(k*r/10));
} */
setcolor(BLACK);

circle(i+1,j+1,r);
if(i<639-r&&f1==1)
{i++;f1=1;
}
else
{i--;
if(i==r) f1=1; else f1=-1;
}
if(j<480-r&&f2==1)
{j++;f2=1;}
else
{j--;
if(j==r) f2=1;else f2=-1;
}

}
}








Try this , Here is one single ball, read it try to upgrade into two balls

Don't use "void main()", there are two proper main function headers, and they are:

int main(int argc, char *argv[]) and int main()

Using "void main()" can cause problems, for a detailed explanation as to what kind of problems it can cause please consult google.


and for your information if you ever want to upgrade to a newer compiler, (like Visual Studio Express, or MinGW) the first thing you should try is using STANDARD C++ headers, like instead of "fstream.h" it should be #include <fstream>

pseudorandom21 166 Practically a Posting Shark

string(size_t, char) is a constructor overload, the constructor is a function that initializes the class.

Primitive data types (like int, float, double, char) don't have constructors, nor do they have functions associated with them. In languages other than C++ (like C#) integer types to have a set of functions available, making them much more than "POD" or Plain Old Data.

i.e., in C#,

Int32 someInt = 128;
Console.WriteLine(someInt.ToString());

In C++ (assuming cout didn't support outputting an integer),

int someInt = 512;
string out;
stringstream(someInt) >> out;
cout << out << endl;

http://www.cplusplus.com/reference/string/string/string/

pseudorandom21 166 Practically a Posting Shark

lool, so what was the idea? You wrote a program and you don't know what it does?

What exactly is done to the input to make the output?

pseudorandom21 166 Practically a Posting Shark

Don't modify your header files!!!! At least the ones that come with the compiler anyway.

pseudorandom21 166 Practically a Posting Shark

It's pretty sad when people need to do something like that because of how Apple operates. I'm really not a fan of Apple, I don't own any of their devices but I did some research on creating apps for the iPhone. From their website I could judge I wasn't going to like being forced to work with Apple.

pseudorandom21 166 Practically a Posting Shark

Sounds like a great opportunity to use boost!

pseudorandom21 166 Practically a Posting Shark

Do I need to recompile a C# .DLL ?

pseudorandom21 166 Practically a Posting Shark

What do you mean by "broadcasts a heartbeat"?

pseudorandom21 166 Practically a Posting Shark

Chances are we don't know what the problem is without seeing the code.

pseudorandom21 166 Practically a Posting Shark

No, he means another thread. C++ currently doesn't come with a platform independent way to spawn threads, so you'll have to either rely on Operating System API calls, or use a library (I recommend Boost).

There are plenty of examples of both ways and I suggest reading some tutorials on multi-threading w/ C++ first.

pseudorandom21 166 Practically a Posting Shark

Well what I'm really asking is how are plugin systems usually done? (The kind that allow users and third parties to add plugins)
What's a good way to do that?

pseudorandom21 166 Practically a Posting Shark

You forget extern "C" ? Prevents name mangling if I remember right.

try:

extern "C" DLL_EXPORT void *InterfaceFactory( char *pInterfaceName );