Wow, nevermind.
I had created my a Graphics object from the image like this:
Graphics g = Graphics.FromImage( pictureBox.Image );
Which is wrong, and it should be:
Graphics g = pictureBox.CreateGraphics();
Now it's working just fine.
Wow, nevermind.
I had created my a Graphics object from the image like this:
Graphics g = Graphics.FromImage( pictureBox.Image );
Which is wrong, and it should be:
Graphics g = pictureBox.CreateGraphics();
Now it's working just fine.
Hey I'm making a small application for my gaming buddies, and I have a picturebox that I'm drawing on.
The problem is, it appears as though the Location property of the MouseEventArgs is wrong, and it becomes even more so toward the bottom + right portion of the picture, like a lack of precision that gets multiplied as x and y increase.
Do I need to use a different way to get the mouse cursor location?
The idea(s) aside, how does a lone programmer with a few languages at his disposal make awesome software?
Do you think with proper research, planning, and design a lone programmer can make awesome software, or do you think it will usually require a couple of partners?
How do I learn more about the research, planning, and design of software engineering? Programming is a skill that is (somewhat) easily obtained, but how many resources are there from which to learn the necessary skills to create awesome software?
#include <string>
#include <algorithm>
int main(){
std::string text = "reversi mei!";
std::reverse(text.begin(), text.end());
}
There is also a book by Wenbo Mao which may be worth your time.
http://www.amazon.com/Modern-Cryptography-Practice-Wenbo-Mao/dp/0130669431
I think the application could be cool because if it didn't consume a lot of resources I would let it reside in my system tray, it could incorporate some other cool stuff too, like customizing notifications, etc. I think a Windows 7 style pop-up box telling me about some event would be superior to checking a website.
If I were to be doing it, I would consider Java or C#.
Hey those variable names don't look very descriptive, sometimes a meaningful name is helpful.
Here's an even more-complicated way to print the contents of a string.
std::string inputFirst = "Clearly.";
std::copy(inputFirst.begin(),
inputFirst.end(),
std::ostream_iterator <std::string::value_type> (std::cout));
We need to know about your "string array".
I'm assuming you mean the mathematical kind of function, and finding the absolute maximum and absolute minimum, if they exist.
Basically unless you want to parse some strings you can code the math function directly in a C++ function, such as this:
int ComputeValue(int x){
//f(x)= x + 3
return x + 3;
}
Now, to use that function you insert an X-value much like a graphing calculator would, and it returns the Y-value. I'll leave the rest up to you.
http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/
http://www2.research.att.com/~bs/bs_faq2.html#int-to-string
In C++, stringstreams are amazing.
template<class int_type>
int_type stoi(const char *str){
int_type i = 0;
std::stringstream(str) >> i;
return i;
}
//You get the idea.
I think it means you need to create a separate class named "CarInsurance" as per your instructions, and all it has in it is the two variables, and the function.
It will need to "throw" from inside the function, an ArgumentException, using "throw".
http://msdn.microsoft.com/en-us/library/1ah5wsex(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/system.argumentexception.aspx
:
throw new ArgumentException("Some error message", "someParamter");
I added a #pragma managed
before the form's definition and it works fine now. <shrug> the clr settings are correct.
I have a C++/CLI form, and a native class in separate files.
I include the header file of the native class at the top of the Form.h
This causes the compiler to try to compile the constructor of the Form as a native function and spits out 100+ errors and causes the compilation to halt.
Any ideas why?
I'm not saying this is the best way to do what you want, but you can #ifndef out a block of code:
//#define TESTING
#ifdef TESTING
void Test(){ //<-- inactive pre-processor block.
}
#endif
#ifndef TESTING
void Real(){ //<-- Active code.
}
#endif
You can use a stringstream, bjarne stroustrup has an example on his website under the FAQ section last I checked.
Try this on for size, and it can certainly be improved with error checking, etc.
#include <sstream>
#include <string>
template<typename value_type>
value_type FromString( std::string input ){
value_type r = 0;
std::stringstream(input) >> r;
return r;
}
scheduler, egg timer, advanced start menu, a better GUI for the windows command prompt, I would be willing to bet there is a list of project ideas on this website somewhere too.
Ugh. You can do such things if you don't like the language, but in my opinion, you should use the language to its (and your) best advantage instead. For instance, does this make sense to you?
#define like { #define yknow } #define uh ; #define whenever for #define more ++ whenever (i=1 uh i < 5 uh more i) like cout << i << endl uh yknow
I thought not. Neither does any other gratuitous use of macros as syntactic sugar. Your "is_equal_to" took me two tries to type correctly, is 5.5 times longer then '==' and looks illegal to the trained programmer. I re-iterate: "Ugh!"
Better not look into iso646.h then, lol.
I'm not sure what your teacher wants but some C++ library functions/algorithms can be used to simplify your code. It may be worthwhile to check out a C++ reference before and during your implementation.
Hey couldn't some IPC simulate some multi-threading? I.e., spawn a few different processes as "threads".
Try writing some pseudo-code for an algorithm. When you run into trouble with your own implementation, let us know.
If you think it would help, another option would be defining the equality operator as a macro.
#define is_equal_to ==
Well you will probably have to download the DirectX 10 SDK before you can compile much DirectX code. You also may have to set some compiler/project options. If you are patient, I'm quite sure you can discover the source of your problems.
What compiler/IDE are you using?
I might suggest a polymorphic solution to getting your input, I think it will greatly simplify the process of reading from stdin/cin or a file.
void read(std::istream &in){
//Feel free to swap width/height if needed.
for(size_t i = 0; i < width; i++){
for(size_t j = 0; j < height; j++){
in >> data[i][j];
}
}
}
In your intArray constructor, I don't really know what you're doing with this: int size [height][width];
but I doubt it is what you want to do.
There is also a mysterious "weight" variable that appears in your code, which may or may not exist.
Interestingly the general consensus of most search results about multi-threading and primitive types is that they all require synchronization. Mutexes are mainly suggested. The reason I think I would have to use a mutex is because of the problem with reading from and writing to a variable at the same time, is this guaranteed to not happen on an x86 machine running Windows 7?
Hmm, I was told incorrect information a while back when I was reading about the "volatile" keyword. Thank you for clarifying, as always you are extremely helpful. The poster/website/blogger or whomever it may have been claimed it was used for inter-process communication and served no purpose in my code, and I had written an example very similar to that one.
I have a question about threading, with Visual Studio 2010 if this global bool isn't volatile, the program functions incorrectly. Do you think the compiler is applying some sort of optimization that causes this, or is it because of another reason?
#define NOMINMAX
#include <Windows.h>
#include <iostream>
#include <boost/thread/thread.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
volatile bool stopThread = false;//<-- if you make this non-volatile, it doesn't work.
void work(){
while(!stopThread){
//...
//Sleep(1000);
}
}
int main()
{
using namespace boost;
shared_ptr<thread> inc;
inc = shared_ptr<thread>(new thread(work));
Sleep(1000);
::stopThread = true;
if(inc != nullptr){
if(inc->joinable())
inc->join();
}
std::cout << "Thread is joined." << std::endl;
std::cin.get();
}
Excellent ideas, and I learned a new keyword too!
It always occurred to me I couldn't use a const member function to get a copy of my variable when protected by a mutex...
Perhaps my understanding of the C++ primitive types is flawed, I'm using this for the sensitivity values in a class to simulate mouse movement, it will be read-from quite often and I need to be able to change the sensitivity on-the-fly (asynchronously). Do I need to protect the variable?
I've found that often in my code I have a need for primitive variables protected with synchronization objects such as a boost::mutex, and I was wondering if the boost library provides a template similar to this one I'm considering, based on the C# property methods get/set:
template<typename var_type>
class ThreadSafeVariable{
boost::mutex mut;
var_type value;
public:
var_type get(){
boost::mutex::scoped_lock(mut);
return value;
}
void set(var_type newValue){
boost::mutex::scoped_lock(mut);
value = newValue;
}
};
I was thinking he thought dividing by zero would throw an exception as with C# and probably other .NET languages. It doesn't.
I'm just looking into this for fun. It seems difficult to acquire the knowledge to make something useful--I could create my own implementation of the perceptron/neural network, but I don't really know what it does. Basically, a learning resource that "dumbs it down" for the masses is probably what I'm looking for.
It's not a big deal, I'll be studying this sometime in the next couple years anyway, but it does interest me.
Do any of you (reading this) know of a good learning resource for implementing a neural network, instead of papers describing the theory?
Or perhaps someone can explain how one can apply the information on perceptrons given here.
I think you need to print a "report header" then the values of the 4 columns on each row, one row per year. It also tells you to use a function you wrote previously.
I can use a function in a DLL written in C with C#.
What would be a common strategy for using DLLs coded in native C++ in C#? I'm not really finding much good information about it, other than writing the DLL in C.
I'm not sure if this is your problem, but with some methods of getting input, stuff will be left in the input stream, or error bits will be set. You must clear the errors and ignore newlines. Personally I prefer to sync() the stream with the source of characters.
I would consider creating a DLL for commonly used functions.
MSDN says: http://msdn.microsoft.com/en-us/library/ms645489(v=vs.85).aspx
See under the "Initializing a Text Buffer" section here:
http://msdn.microsoft.com/en-us/library/bb775456(v=vs.85).aspx#text_buffer
Unfortunately without researching the HTTP RFC spec you may not be dealing with those things at a low level.
There are a number of free libraries available for using HTTP, it may be worth a google search.
Press "F5". Winrar!
Yes, but you'll have to reverse engineer their code to figure out where to insert your detour/trampoline function.
Hey that big block of NOOPs looks pretty good...
What do you need help with?
Personally I would opt to use a library for HTTP. I know libcurl is at least one option, there are probably hundreds more.
The reason I would use a library is because if the project requires using the HTTP specification extensively, it will save you a lot of work.
You can, of course, read the HTTP RFC here--but I personally would not go that route, unless for some reason there are no suitable libraries available that meet your needs.
how to use typedef with a function pointer:
typedef void (*FuncType)(void);
...
...
FuncType pointerToMyFunc = foo;
I'm not aware of any. I suppose you could hire a programmer.
Thanks for the feedback.
I do think C# requires less work for programmers when compared to C++, but of course 3+ years of C# is 3+ years of C# to someone in charge of hiring.
Typically you will get bad results if you call srand() too often. I've seen it used in a loop or a function right before every call to rand(). Try calling it once for the lifetime of the program.
This is a very pathetic question. The rules say you should give your post a descriptive name not "Need help".
For Screen capturing, it can easily be done in C#. For packet capturing data being transmitted across WIFI that contains remote desktop information, I'm not sure this is the right place to ask. Typically the latter will be considered at the minimum "unethical" and at the most, criminal and wrong.