|
Priya Prk wrote: Do you have some samples/links about this?
Yes[^].
/ravi
|
|
|
|
|
is there a way to read wav files and store the out put as binary in file?
and if there is a way after i edit it make the edited file wav again?
|
|
|
|
|
sanforjackass wrote: is there a way to read wav files and store the out put as binary in file?
A wav file is already (partially) binary. If you edit it you will need to know the internal format, as any changes which corrupt the internal structures will make it unplayable.
|
|
|
|
|
i want to add encoding date message to it then take the data from it and decoding it to get the real message
|
|
|
|
|
|
Dear Sir,
I've done this before (created wave file from scratch) in Visual Basic 6 (way long ago), and still have the code. It would demonstrate not only the format, but how to save (and therefore read) the format. Let me know if you want to see the example. Rarely do I get to say this in these forums for rather difficult things (because they're not actually difficult enough for others to have problems with them, and I do such quirky stuff, never database or anything...). I'm happy to help.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
Hi, when I retrieve a value from the database, e.g.
headerSix\\\
When I ToString this value it becomes headerSix\\\\\\.
I would like to replace \\ with \ if that makes sense.
In VB I would use Replace(chr(whatever))
What is the best way of doing this in C#?
Thanks in advance
Dan
|
|
|
|
|
Just worked out that if I take the backslashes out of the database field, the ToString() method does it properly, e.g.
headerSix">
becomes headerSix\">
Cool
|
|
|
|
|
Backslash is escape character. It means that String will hold a value that is represented by char that follows backslash
\' - single quote, needed for character literals
\" - double quote, needed for string literals
\\ - backslash
\0 - Unicode character 0
\a - Alert (character 7)
\b - Backspace (character 8)
\f - Form feed (character 12)
\n - New line (character 10)
\r - Carriage return (character 13)
\t - Horizontal tab (character 9)
\v - Vertical quote (character 11)
\uxxxx - Unicode escape sequence for character with hex value xxxx
\xn[n][n][n] - Unicode escape sequence for character with hex value nnnn (variable length version of \uxxxx)
\Uxxxxxxxx - Unicode escape sequence for character with hex value xxxxxxxx (for generating surrogates)
|
|
|
|
|
Is it possible to pass parameters from crystal report to windows form,
I'm developing C#.net windows application.
suppose, there is a "Text Object" on a report,
i want that whenever user clicks on that text object a messagebox to be displayed with the text from the text object,
pls help,
Regards,
Nitin Sawant
===========================
http://nitin646.wordpress.org
===========================
|
|
|
|
|
Good day every body, ineed to know how to coding of IPsec functionality using C#...
thanks for all.....
Regards
|
|
|
|
|
Hi,
I'm using Visual Studio 2008 and SQLExpress 2005.My OS system is win XP.I want to access my database from
"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Coupon Management.mdf" .I am confused that it attacg database from App_data.When i run my program it show error
CREATE DATABASE permission denied in database 'master'.
Cannot attach the file 'C:\Inetpub\wwwroot\WebSite2\App_Data\Coupon Management.mdf' as database 'Coupon Management'.
here is my connection string
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Coupon Management.mdf;Database=Coupon Management;
Trusted_Connection=Yes;Persist Security Info=True;Integrated Security=False
Plz help.
thnx in advance
|
|
|
|
|
"|DataDirectory|" is a substitution string that represents where the database file is stored.
To set where |DataDirectory| resolves to, you have to call the AppDomain.SetData method. If you don't set the DataDirectory property, |DataDirectory| will default to App_Data for a web application or the "Application Data" folder (I think) for a winforms app.
If you're having trouble getting your connection string working correctly, this website[^] can be quite useful.
Hope that helps.
|
|
|
|
|
I'm writing a control similar to visio to draw shapes and text, now I want to support rich text drawing into my control.
I searched the web and found what they call "windowless rich text control" but it does not have code for C#, below is what I tried to do but it is not work:
namespace WindowsFormsApplication1
{
[Guid("c5bdd8d0-d26e-11ce-a89d-00aa006cadc5")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITextHost
{
IntPtr TxGetDC();
IntPtr TxReleaseDC(IntPtr hdc);
}
public partial class Form1 : Form, ITextHost
{
[DllImport("riched20.dll")]
private static extern int CreateTextServices(
[MarshalAs(UnmanagedType.IUnknown)] object punkOuter,
ITextHost pITextHost,
[MarshalAs(UnmanagedType.IUnknown), Out] out object ppUnk);
public Form1()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
}
void Form1_Load(object sender, EventArgs e)
{
object ppUnk = null;
int result = CreateTextServices(null, this, out ppUnk);
}
#region ITextHost Members
public IntPtr TxGetDC()
{
return this.Handle;
}
public IntPtr TxReleaseDC(IntPtr hdc)
{
return IntPtr.Zero;
}
}
}
When run into the method CreateTextServices , it keeps saying that the memory is corrupted. I don't know what I did wrong in the code. And I stuck with it.
Please help me with that, thanks for your concern.
|
|
|
|
|
Have you seen the Graphics[^] class? If you handle the OnPaint event of a control you can use it to draw anything you want on it.
![Badger | [badger,badger,badger,badger...]](https://codeproject.freetls.fastly.net/script/Forums/Images/badger.gif)
|
|
|
|
|
Hi,
I am trying to encrypt data with TripleDES algorithm using given key and given iv in c#, so I can get (correct) results that Perl code provides, but unfortunately I am failing in my attemps. Does anyone know what I am doing wrong?
Thanks in advance,
D
Here are sources:
Encryption in C#
<br />
public void encrypt() {<br />
string keyS = "W-3lee7#AA345ll812345678";<br />
string ivS = "00000000";<br />
string testText = "20091217140739-1"<br />
<br />
byte[] key = new MD5CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes(keyS));<br />
byte[] iv = Encoding.UTF8.GetBytes(ivS);<br />
byte[] data = Encoding.UTF8.GetBytes(testText);<br />
byte[] enc = new byte[0];<br />
byte[] dec = new byte[0];<br />
TripleDES tdes = TripleDES.Create();<br />
tdes.IV = iv;<br />
tdes.Key = key;<br />
tdes.Mode = CipherMode.CBC;<br />
tdes.Padding = PaddingMode.PKCS7;<br />
ICryptoTransform ict = tdes.CreateEncryptor();<br />
enc = ict.TransformFinalBlock(data, 0, data.Length);<br />
return BytesToHex(enc);<br />
}<br />
public string BytesToHex(byte[] bytes)<br />
{<br />
StringBuilder hexString = new StringBuilder(bytes.Length);<br />
for (int i = 0; i < bytes.Length; i++)<br />
{<br />
hexString.Append(bytes[i].ToString("X2"));<br />
}<br />
return hexString.ToString();<br />
}<br />
Perl code:
<br />
#!/usr/bin/perl<br />
<br />
use strict;<br />
use warnings;<br />
use Crypt::CBC;<br />
<br />
my $key = "W-3lee7#AA345ll812345678";<br />
<br />
my $cbc = Crypt::CBC->new(<br />
-key => $key,<br />
-header => 'none',<br />
-iv => '00000000',<br />
-cipher => 'DES_EDE3',<br />
);<br />
<br />
<br />
my $plaintext = "20091217140739-1";<br />
print "plaintext: " . $plaintext . "\n\n";<br />
<br />
my $encrypted = join('',unpack('H*',$cbc->encrypt($plaintext)));<br />
print "encrypted: " . $encrypted . "\n\n";<br />
<br />
my $decrypted = $cbc->decrypt(pack'H*',$encrypted);<br />
print "decrypted: " . $decrypted . "\n\n";<br />
<br />
<br />
1;<br />
|
|
|
|
|
I see you've set C#
draskosaric wrote: tdes.Padding = PaddingMode.PKCS7;
what is Perl using for padding ?
I see at a very quick glance at Crypt::CBC
"
-padding The padding method, one of "standard" (default),
"space", "oneandzeroes", "rijndael_compat",
or "null" (default "standard"). "
Im not sure which of those equates to PKCS7, it would be the first thing I'd check
'g'
|
|
|
|
|
Hi Garth,
thank you for you quick reply.
I think I've sold it. Perl is using PKCS5 as its standard padding(default), which, according to some posts on the net, will not cause problems with PKCS7, so that wasn't the root of my problem. The solution lies in cofiguring perl script with extra parameter "literal_key" and now everything works fine.
D
|
|
|
|
|
I am just starting to learn C# so my question will likely seem stupid to most people looking at this. I am just getting to the part about creating classes and turning them in to objects. My questions have to do with the following code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace circle
{
class circle
{
int center_x;
int center_y;
double Radius;
public int x
{
get { return center_x;}
set { center_x = value;}
}
public int y
{
get { return center_y;}
set { center_y = value;}
}
public double radius
{
get { return Radius;}
set { Radius = value;}
}
}
class MyApp
{
public static void Main()
{
circle myCircle = new circle();
myCircle.x = 10;
myCircle.y = 10;
myCircle.radius = 8;
Console.WriteLine("Center: = {0},{1}", myCircle.x, myCircle.y);
Console.WriteLine("Radius: = {0}", myCircle.radius);
Console.WriteLine("Circumference: = {0}", (double)(2 * Math.PI * myCircle.radius));
}
}
}
My first question is with the variable Radius why is it that where it is declared as public double radius followed by the properties that you have to use a small r when all the other instances of Radius use a cap?
When you use a cap R it returns the error message "ambiguity between circle.circle.Radius and circle.circle.Radius"
How do you compare two things exactly the same?
Also why is this rule not true for the x and the y?
My other question (the big one) is what does any of the code down to class MyApp have to do with the code in class MyApp?
Obviously I'm not going to get far in C# if I can't understand the most important part of it.
Thanks for any help anyone can give me.
|
|
|
|
|
There are some conventions:
- public properties/methods: CamelCase
- protected/private data: pascalCase
hence "private int radius" and "public int Radius { get; set;}"
IMO you should buy and study a book to learn a new language and get the basics right; it is the one efficient way to get good results.
|
|
|
|
|
Thank you for your reply. I did use the code block to insert the code.
I am using a book - Sams Learn C# in 21 Days by Bradley Jones. It basically seems well written and I have managed fine to this point which isn't all that far.
At this point he has given me a listing and the analysis at the end says "Lines 14 - 22 create the property capabilities for the variables int center_x;, int center_y;"
What he hasn't bothered to explain is what these property capabilities are and how they apply to the variables after class MyApp. This brings up another point: the variables Mycircle.x =10 , etc. are assigned values but I can't see any where that this variable was declared.
Obviously I am in way over my head without some instruction. Again, thank you for your time.
Darrall 
|
|
|
|
|
1.
if that is code from a book, the book is no good and isn't worth spending many hours at.
2.
myCircle.x = 10; is how you set a new value to either a data member (that would be a "public int x;") or the set part of a property (which should start with a capital!).
I suggest you read the chapter on properties again; if that does not help, there's another reason to scrap that book.
3.
the PRE tags thingy is part of my sig, it gets added at the bottom to remind everyone about code formatting, it wasn't there as a reaction on your message.
|
|
|
|
|
Thanks Luc. I can see where the book I am using leaves something to be desired. The information you have given me helps immensely and I think I can wade through it now.
Thanks again 
|
|
|
|
|
I suggest that you read this CodeProject article[^] to get a grasp of object oriented programming.
(Wait until you find out that C# lets you define a a type and a property with exactly the same. That'll fry your brain.)
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Thanks for your reply John. The article you directed me to is great!
Thanks again 
|
|
|
|