|
Nemanja Trifunovic wrote: No. His encoding is Shift_JIS (CP 932) an
No. Her* encoding is...
*Deepa = female
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I should know you're only interested in female's questions.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Wait... Weren't you the same guy who accused me of having a general hatred towards women?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Yes.
Your memory is too strong, pal.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Your memory is too strong, pal.
Mr. Nic Rowan shares his opinion[^] with you.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Uh?!... What opinion?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Are you sure the locale was successfully set?
Try
cout << cout.rdbuf()->getloc().name();
after the imbue and see what it prints out.
|
|
|
|
|
As you said i tried printing the stream locale is shows "Japanese_Japan.932".
One thing observed is that if setlocale(LC_ALL ,"") call is commented then the message is printed correctly.
Any idea why ?
|
|
|
|
|
Deepa Bellary wrote: setlocale(LC_ALL ,"")
What is the User default ANSI code page of your operating system? If that is the same as the code page of what you're trying to print, I don't see why it should fail.
From the docs ^:
setlocale( LC_ALL, "" );
Sets the locale to the default, which is the user-default ANSI code page obtained from the operating system.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
If you are using std::wstring's, you need std::wcout.
std::cout works *only* with std::strings.
Since there is no _tcout, I like to use _tprintf (and _T macro) when printing Unicode stuff in console.
Take this code for example:
std::wstring test1 = _T("test1");
std::cout << test1.c_str() << endl; // prints junk "0012DE10"
std::wcout << test1.c_str() << endl; // prints "test1"
But to do it "properly", something like this is needed:
std::basic_string<TCHAR> test1 = _T("test1");
_tprintf(_T("Testing string is: %s"), test1.c_str());
I hope that helps.
Best regards,
loreia
modified on Saturday, January 17, 2009 12:55 PM
|
|
|
|
|
|
use wprintf() instead of printf(). likely use wide char version of cout(wcout) instead of cout
|
|
|
|
|
hi
how to simple crypt and encrypt string in Visual C++ ?
|
|
|
|
|
Depends on what kind of encryption you want. Have a look at Cryptography and Security[^] section of codeproject.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
http://en.wikipedia.org/wiki/Tiny_Encryption_Algorithm#Reference_code[^]
this is a very simple algorithm and just a few lines of code, but don't expect it to be very secure. if you're looking for an uncrackable algorithm then don't use this one
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Ok How can i use this code for a String?
|
|
|
|
|
What you do is to read both of your replies.
The wikipedia link described a nice algorithm called TEA.
The other person pointed you to http://www.codeproject.com/KB/security/[^]
Reading that list of articles, I came across http://www.codeproject.com/KB/security/TEA.aspx[^]
That has a picture of a demo project, and that has a "encrypt cstring" button, and a "decrypt cstring".
Then you think: "Hmm, maybe I'll read the code and find out how this person has done"...
Not having done any real encryption, I'll wish you luck.
But I'd also repeat the warning that TEA is encryption-lite. I have no idea if this is true though. It depends on the strength you need.
Again, good luck, and good learning,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
|
|
Dear all,
I don't know if this the best place for posting my message, but I'll try...
I am trying to figure out which the best approach for the implementation of a class of a (VERY LARGE, LARGE = 1e6 - 1e7) arrays of 2-by-2 matrices. My contraints are the following:
- I have to perform a number of mathematical operations on this matrices, like C = A * B * D avoiding the creation of temporaries (due to size of these objects). Overoloading operators is not a problem, but I DO need a good starting point
- the execution speed of this operations must be as high as possible, since I have to perform a large number of operations.
I've been googling for the last 3-4 days and I've found a number of different approaches for the soultion of this problem (downloadable libraires, expression templates, block-copy techinques), but I haven't found a well performing solution for my problem yet.
Can anybody help me, please?
|
|
|
|
|
As I understand your problem I would suggest reference counting smart pointers.
Have a look here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
misterMF wrote: I have to perform a number of mathematical operations on this matrices, like C = A * B * D avoiding the creation of temporaries
Specialised functions are probably the easiest way to control exactly what happens, e.g.
void Mult3(Matrix const & A, Matrix const & B, Matrix const & D, Matrix& C)
{
}
Expression templates are the way I'd think if I were doing something more involved - I believe Blitz++[^] is meant to be quite good - certainly, this section[^] promises what you're needing - whether it can deliver is another matter...
|
|
|
|
|
Hi,
having an array with millions of matrices, your app's performance probably will be memory-bandwidth limited, i.e. the amount of data you will want to read from/write to memory (or CPU cache) will be the limiting factor.
So the organization of the work will be of utmost importance; try to work locally, i.e. do all that needs to be done on a subset (say a few 100KB) of the data, then move on to the next subset.
If you want more suggestions or help, you should tell us more about the application, and the data types involved.
|
|
|
|
|
One thing that will kill performance in this quantity is allocating and deleting objects. This is where you want to use some form of fixed memory allocation--that is preallocating blocks of objects.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thank you very much for your precious suggestions . I'll start with the implementation to see where the bottlenecks are.
I'll start declaring my class more or less like this:
template< typename T >
class TTransferMatrix < std::valarray<t>> : public TTransferMatrix_base < std::valarray<t>>
{
private:
const size_t N_ELEMENTS;
size_t arraySize;
std::valarray< T > m00;
std::valarray< T > m01;
std::valarray< T > m10;
std::valarray< T > m11;
public:
}
</t></t>
In the template, <t> can be any basic type. In my application, I'll need to work complex numbers.
Do you think that STD::VALARRAY is a good choice as the basic container?
I know that the STD::VALARRAY class is not really optimized for numerics (as they would like us to believe...), but I performed some tests long time ago and I noticed that filling/reading a STD::VALARRAY was faster than using STD::VECTOR.
|
|
|
|