|
I don't think there is a direct way to do this, from the brief research I did it looks like the Iran System is obsolete, though that doesn't help your problem.
My advices is to create a Map which maps the numeric value of the Iranian System to the numeric equivalent in Unicode and vice versa. This isn't a huge problem but:
- There isn't a map type in .net, which is a pity. You can fudge it a few ways, I've done it via dictionary (it is close with key/value instead of "key"/"key"), there is a discussion here[^]
- Entering the numberic values by hand in code or config or somesuchis error prone.
This[^] should help as there is a [almost] copy and paste value mapping
Internationized text is a real pain (as I'm learning to my cost), it is even worse for right-to-left languages such as Farsi.
|
|
|
|
|
Hello everyone!
What i want to do is to make an animation of a female character that appears on SCREEN and does everything it was supposed to do during animation.
The MAIN problem that i have no idea how to do this on the screen, without any borders of audio/video player. Closest EXAMPLE is VHGD aka VirtuaGirl player - girls walk on your screen without any border of the player (my version is NOT porn, it is rather gift).
Animation will be done by myself, all i ask is how to make it look like a VHGD.
How can i perform this using C# or any 3rd party libraries/ect?
modified 23-Oct-11 3:51am.
|
|
|
|
|
...That pretty much says it all:
private void SetValue(object instance, PropertyInfo property, object data)
{
if(property.PropertyType.IsAssignableFrom(data.GetType()))
property.SetValue(instance, data, null);
else
{
if(data is int)
{
int? unboxed = (int?)data;
property.SetValue(instance, unboxed, null);
}
else
property.SetValue(instance, Convert.ChangeType(data.ToString(), property.PropertyType), null);
}
I have an object that has a property of type long? and the value "1" cannot be pushed into it.
The failure is inside the "if(data is int)" branch.
"Object of type 'System.Int32' cannot be converted to type 'System.Nullable '1[System.Int64]'
How do I go about getting a System.Int32 into a System.Nullable [System.Int64] ??
"I need build Skynet. Plz send code"
|
|
|
|
|
omg...the int? is still boxed, isn't it
"I need build Skynet. Plz send code"
|
|
|
|
|
if((property.PropertyType ==(typeof(long))) || ((property.PropertyType == (typeof(long?)))))
{
long converted;
if(Int64.TryParse(data.ToString(), out converted))
property.SetValue(instance, converted, null);
}
Money
"I need build Skynet. Plz send code"
|
|
|
|
|
I have a static class that requires a delegate. A delegate should not be static and cant be fine. However a static class requires the variable and methods be static; There for how do I declare a delegate within the class?
e.g.
public delegate void currentBalance(int value);
public static DoSomething()
{
do something...
balance = 10;
currentBalance(balance);
}
Any Help more than welcome.
Thanks
dotman1
|
|
|
|
|
ok worked it out forgot to pass the delegate to the method.
dotman1
|
|
|
|
|
My application experiences the problem where occasionally, two packets appear to arrive out of order. Since I'm using TCP, this must be impossible at the protocol level, so I think the problem must lie with my implementation of the async model.
The pseudo code of my implementation is below. Are there any general pointers someone can mention that might be wrong with my model?
Is there anything wrong with issuing subsequent reads directly from the read-completion handler?
Begin Read
Issue asynchronous read
if Read completes synchronously, directly call Read Completion function
Read Complete Function
call EndRead to determine number of bytes read
write receive buffer to my stream
process stream
call Begin Read to issue another read
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Post a simplification of the actual implementation; pseudo-code is almost always correct and useless in debugging-attempts.
Bastard Programmer from Hell
|
|
|
|
|
I don't see anything wrong with your basic implementation.
Richard Andrew x64 wrote: Is there anything wrong with issuing subsequent reads directly from the read-completion handler? Hmmm... I don't think so, but you might consider signaling an event or posting an async operation: http://msdn.microsoft.com/en-us/library/system.componentmodel.asyncoperation.post.aspx[^]
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun
|
|
|
|
|
How exactly are you determining that they are "out of order"?
|
|
|
|
|
To be more precise, instead of saying the packets are out of order, I'll say that the receives are completing out of order.
I'm using a log file to record each packet as it is processed by the completion routine.
I have a receive buffer of 1024 bytes, and the full message is about 7200 bytes. When one of the receives is processed out of order, the message becomes corrupted and the deserialization fails.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Some possibilities.
You are ignoring the read count.
You are not reading the entire set of data.
What is arriving is 'incorrect' (thus the sender is the problem.)
You don't have an actual size so you are hoping that 'about 7200' can be figured out via deserialization and that isn't a good idea.
|
|
|
|
|
Thanks for your thoughts. I was able to solve the issue for now by using a variable-length receive buffer.
I calculate how many bytes are left in the message, and adjust the buffer to be big enough to handle it in one go. That way, there is no chance for anything to get out of order.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hello all,
While working on a project that emails files with international filenames, I've come across an unusual issue. if I attach with a US-ASCII filename only, I can get better than 200 characters long without errors.
If I include an extended character, it encodes in UTF-8 and the length before it gets funky is very small (< 40 characters). To define funky.. here's an example filename after it goes bad:
=utf-8BSU5GT1JNw4FUSUNBX0ltcGFjdF9Bc3Nl
it looks like UTF8 encoded string with a UTF-8 decoding instruction or a mime boundary... not sure which.
Has anyone seen this before -- and what are the rules / limitations of filenames -- I tried emailing the file by hand through outlook and it handles it, so I don't think it is a MIME specific limitation.
Sample code:
class Program
{
private const string DOMAIN = "foobar.com";
private const string SMTPHOST = "mail." + DOMAIN;
private const string FROM = "chadwick.posey@" + DOMAIN;
private const string TO = FROM;
static void Main(string[] args)
{
MailMessage msg = new MailMessage(FROM, TO, "Subject", "Body");
string path = Path.GetTempPath();
string name = "AAAAAA_AAAAAAAAAAAA_AAAAAAA_AAAA - IIIIIII CCCCCCCCCC DD IIIIIIÁIIII_20111018_091327.pptx";
File.WriteAllText(path + "\\" + name, "blah");
Attachment att = new Attachment(path + "\\" + name, new ContentType("application/vnd.openxmlformats-officedocument.presentationml.presentation"));
msg.Attachments.Add(att);
SmtpClient client = new SmtpClient(SMTPHOST, 25);
client.Send(msg);
}
}
I've tried (so far) -- setting the encoding for the attachment.NameEncoding to UTF8 and UTF32, neither worked. Setting the ContentDisposition.FileName on the attachment fails because it is not using US-ASCII characters only.
Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?
Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
|
|
|
|
|
Chadwick Posey wrote: and what are the rules / limitations of filenames
Long filenames under Windows can be upto 255 UTF16 characters. (Source[^])
Lots of older apps (and drivers) will still be using the MAX_PATH value and coding everything in ASCII, cutting back your effective storage-space.
Chadwick Posey wrote: Any suggestions on how to get it to include the full filename with the accent / extended characters in tact?
Is it an option to archive the files in a ZIP-file and to attach that? I'm not sure whether it would work, but it'd be the first alternative that I'd go for.
Bastard Programmer from Hell
|
|
|
|
|
I will definitely look into that... optimally I'd like to send the bare file with the name intact, but this will be my last resort option I think.
I figured even if the filename length was 255 with single byte characters, that it would support 128 or so with double byte characters, but it is significantly less... I think at 36 characters (72 bytes) it starts exhibiting the strange behavior... I'm wondering if the whole MIME-wrapping thing (I think the mime source is limited to 75 characters wide or something) is throwing something off if it is in UTF-8.
Thanks
Chadwick
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
|
|
|
|
|
For posterity, I'm including my findings here -- I believe it to be a bug with .NET, and have submitted as such to connect here:
Microsoft Connect[^]
It appears to stem from the way encoded headers are wrapped. if the filename length exceeds a certain number of bytes when encoded, the system double-encodes the filename for some reason... Odd...
Hope they fix it... if anyone can please test the sample code I uploaded to Microsoft and verify it fails, I would greatly appreciate the help.
=================================================
Update: We worked around the issue by zipping the file using ASCII characters. It has been patched in a .NET 4 Framework Hotfix available here:
Microsoft Connect Download[^]
=============================
I'm a developer, he's a developer, she's a developer, Wouldn't ya like to be a developer too?
modified 21-Feb-12 15:12pm.
|
|
|
|
|
hi, I'm sending text+numbers from a wcf client to a wcf server in a multidimensional array. The data arrives but if I'm sending eg. "4 Drinks" it arrives as "1 Drinks" (what ever the number is, it arrives as 1) This happens frequently and sometimes it arrives without any change.
I tried a special class instead of array but it's the same. So I think WCF has a problem.
The question is:
-Do I need to use message security to solve it? Or your recommendation?
- if yes, does mes.security have bad impact on performance?
Thanks for reading, would appreciate if answered
|
|
|
|
|
teknolog123 wrote: I tried a special class instead of array but it's the same. So I think WCF has a problem.
Doubtful.
I suggest that you look at your code - at both ends - and see what is happening. I seriously doubt that a bug that severe would still be unnoticed (let alone unfixed) after this long.
Without the relevant code fragments, we can really do no more...
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
3 out of 4 drinks disappearing? on a Friday? is he using a British carrier? Have the regular "so long suckers" messages popped up in the Lounge yet?
|
|
|
|
|
I'll have you know Nagy is Hungarian!
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
sounds like a loose network conntection... check the floor behind the computer and I bet you will spilled drinks all over the place.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
|
Use a tool like Fiddler to look at the web service request and response.
It should give you a fair idea where your problem lies.
|
|
|
|