 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid..
cheers, Chris Maunder
The Code Project Co-founder Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 4.44/5 (63 votes) |
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers, Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 3.95/5 (342 votes) |
|
|
|
 |
|
 |
I noticed that at times I was getting the wrong tag information after loading an image into memory using Bitmap object. What I found is that when tags 256, 257 are stored as type short,(3) microsoft reads them as type long. This throughs everything off. I stepped through the tags myself via hex editor, then verified tags were read properly via LeadTools Tiff Tag editor.
I really hoping to use Bitmap.ProperyItems.
Can some one tell me if I am out of my mind ?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, Is anyone can tell me how to write a xml file that can return me a result look like this: <?xml version="1.0"?> <Items> <Appointment Start="07/12/2008 11:05:00" End="07/12/2008 14:30:00" .../> <Appointment Start="07/14/2008 08:15:00" End="07/16/2008 16:40:00" .../> </Items> Above is my expected look of my xml file. These data <Appointment start=".... /> are set EXACTLY THE SAME into a dataset and the table name is "xmldata" And before it is generated I try to loop this dataset and hope to generate a xml look like above. but i alway fail to get a correct format. its comes like this: <?xml version="1.0" standalone="yes"?> <Items> <xmldata> <Data>Appointment Start='07/12/2008 11:05:00' End='07/12/2008 14:30:00' Description='Rent this car ' Label='2' Location='city' ResourceId='1' Status='3' Subject='Mr.Brown' </Data> </xmldata> <xmldata> <Data>Appointment Start='07/14/2008 08:15:00' End='07/16/2008 16:40:00' Description='Scheduled repair of this car' Label='4' Location='Service Center' ResourceId='1' Status='2' Subject='Repair' </Data> </xmldata> </Items> XML above by using: ldt_ds.Tables["xmldata"].WriteXml(sourcePath2, false); Hope someone can help on this. Thank you. by CS Tan
modified on Saturday, November 7, 2009 12:06 PM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello everyone,
I've searched around but I've not found anything. I want my user to buy or register the software in my app itself. So I don't want to go to a URL or something like that. I'm searching for a safe and free licensing method, that can check if the user has paid his serial. Any ideas?
Thanks in advance!
Madmatt.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
_Madmatt wrote: safe and free
For the most part, in this context, these terms are mutually exclusive.
Given your previous postings, what could you have possible written that anyone would want to purchase?
I know the language. I've read a book. - _Madmatt
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
Mark Nischalke wrote: what could you have possible written that anyone would want to purchase?
Don't worry about that. Example: web-based AD Management. You say it's exclusive but it's possible... I can write it myself too but then I need a little tutorial with complete examples.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
 |
Hello to everyone, I want to develop Speech recognition application for vista and xp too, like if i say "Open Notepad", notepad should be open. For that i have use system.speech.recognition, but when i run my application, default speech recognition gets opened. My code is:
SpeechRecognizer rec = new SpeechRecognizer(); private void Form1_Load(object sender, EventArgs e) { Choices c = new Choices(); c.Add("Close"); c.Add("Pause"); c.Add("Stop"); var gb=new GrammarBuilder(c); var g=new Grammar(gb); rec.SpeechRecognized +=new EventHandler<SpeechRecognizedEventArgs>(rec_SpeechRecognized); rec.LoadGrammar(g); rec.Enabled=true; } private void rec_SpeechRecognized(Object sender, SpeechRecognizedEventArgs e) { MessageBox.Show(e.Result.ToString()); }
I am developing this application in vista, but i want this should be run also in xp. Please help me for this, Thank you in advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
The problem is that you aren't loading the right grammar files. Instead of your own grammar file, try loading a new instance of the DictationGrammar class. Then invoke rec.RecogniseAsync(RecognitionMode.Multiple). I'm not certain about this, but I think that rec should actually be a SpeechRecognitionEngine instance instead of a SpeechRecogniser.
If all that fails, then perhaps you could try calling SetInputToDefaultAudioDevice before you invoke RecogniseAsync.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi everybody! I have a DirectoryTreeView app to display all images in the selected directory, including: A TreeView include drives and directories. All images have put into a FlowLayoutPanel. When i click an image within it, this image will be display in a PictureBox. My key matter is that when click an image in FlowLayoutPanel (called from FolderTreeViewAfterSelect method to pic_Click method by using EventHandler) i also want to gain filename of this image to do more something in pic_Click method. How could i get it? Please help me! Thank you so much! Here's my code.
using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; using System.IO;
namespace DirectoryTreeView { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } void FolderTreeViewBeforeExpand(object sender, TreeViewCancelEventArgs e) { MainForm.ActiveForm.Cursor = System.Windows.Forms.Cursors.WaitCursor; TreeNode currentnode= e.Node; if (currentnode.Nodes.Count==1) currentnode.Nodes[0].Remove(); if (currentnode.Nodes.Count==0) { int step = 0; DirectoryInfo di = new DirectoryInfo(currentnode.FullPath); DirectoryInfo[] dirs = null; try { dirs = di.GetDirectories(); } catch(Exception ex) { } foreach (DirectoryInfo dir in dirs) { currentnode.Nodes.Add(dir.Name); DirectoryInfo[] subfolder; try { subfolder = dir.GetDirectories(); } catch (Exception ex) { continue; } if (subfolder.Length > 0) { currentnode.Nodes[step].Nodes.Add(""); } step++; } } MainForm.ActiveForm.Cursor = System.Windows.Forms.Cursors.Default; } void MainFormLoad(object sender, EventArgs e) { int step = 0; foreach(string str in Directory.GetLogicalDrives()) { folderTreeView.Nodes.Add(str); folderTreeView.Nodes[step].Nodes.Add(""); step++; } } void FolderTreeViewBeforeSelect(object sender, TreeViewCancelEventArgs e) { MainForm.ActiveForm.Text = e.Node.FullPath; } void FolderTreeViewAfterSelect(object sender, TreeViewEventArgs e) { MainForm.ActiveForm.Cursor=System.Windows.Forms.Cursors.WaitCursor; thumbnailsFLP.Controls.Clear(); displayPictureBox.Image = null; string[] Files = Directory.GetFiles(e.Node.FullPath); thumbnailsFLP.Controls.Clear(); foreach (String fn in Files) { PictureBox pic = new PictureBox(); pic.SizeMode = PictureBoxSizeMode.StretchImage; if (fn.ToLower().EndsWith(".jpg") || fn.ToLower().EndsWith(".GIF") || fn.ToLower().EndsWith(".png") || fn.ToLower().EndsWith(".bmp") || fn.ToLower().EndsWith(".jpeg")) { pic.Image = Image.FromFile(fn); pic.Height = 100; pic.Width = 100; pic.Cursor = Cursors.Hand; thumbnailsFLP.Controls.Add(pic); pic.Click += new EventHandler(pic_Click); } } MainForm.ActiveForm.Cursor=System.Windows.Forms.Cursors.Default; } void pic_Click(object sender, EventArgs e) { PictureBox pic = (PictureBox)sender; displayPictureBox.SizeMode=PictureBoxSizeMode.StretchImage; displayPictureBox.Image = pic.Image; } } }
Code link: http://www.fileden.com/files/2007/12/28/1667604/DirectoryTreeView.rar
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
If I correctly understood your problem, you could store the filename in pic.Tag
Some comments:
1. there is a bug: GIF files won't work (typo)
2. you should never catch an unspecified exception and then ignore it; at the minimum log its ToString() result somewhere, maybe in a log file. The only ones that are fine to ignore, are very specific ones about which you don't care (such as not getting access to some folder, in your app).
3. isn't your app terribly slow on directories that contain lots of images?
4. you should call Dispose() on all the images and all the PictureBoxes you no longer need. This applies to thumbnailsFLP.Controls.Clear(); (of which you have 2!).
5. pic.Image = Image.FromFile(fn); locks the file, so you can't delete the image file while the PB is present on your Form. The solution is to use Image.FromStream().
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Thanks so much for your help! I've got it! I will try to correct my code more properly according to your guide. Thank you so much for another time! Have a nice day! 
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi, I have been thinking... Let's assume that I have a server application and lots of clients all over the world connect to my server by using TCP protocol. When a client sends me a connection request, my server application creates a thread for the client and do the rest of the communication in that thread. As far as I know, after some number of threads, operating system starts to get mad and refuses to create more threads. This causes my application to deny to service.
How is this problem solved? Am I missing a point?
Thanks in advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Use asynchronous methods instead of synchronous ones (i.e. use BeginReceive instead of Receive). This allows you to not have to explicitly create/destroy a thread for each connected client; instead, the async callbacks are executed on Thread Pool threads which are managed by the runtime.
The code required to implement an async client/server can be more complex than the alternative but it solves this specific problem. Once you spend some time and really get familiar with the async way of doing things the complexity will cease to be a factor and you won't know how you lived without it .
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi
I have the code to make the backup of the MySql database like this..
try { DateTime backupTime = DateTime.Now; int year = backupTime.Year; int month = backupTime.Month; int day = backupTime.Day; int hour = backupTime.Hour; int minute = backupTime.Minute; int second = backupTime.Second; int ms = backupTime.Millisecond;
String tmestr = backupTime.ToString(); tmestr = "C:\\" + year + "-" + month + "-" + day + "-" + hour + "-" + minute + ".sql"; StreamWriter file = new StreamWriter(tmestr); ProcessStartInfo proc = new ProcessStartInfo(); string cmd = string.Format(@"-u{0} -p{1} -h{2} {3} > {4};", "root", "password", "localhost", "dbfile", "backup.sql"); proc.FileName = "mysqldump"; proc.RedirectStandardInput = false; proc.RedirectStandardOutput = true; proc.Arguments = cmd;//"-u root -p smartdb > testdb.sql"; proc.UseShellExecute = false; Process p = Process.Start(proc); string res; res = p.StandardOutput.ReadToEnd(); file.WriteLine(res); p.WaitForExit(); file.Close();
}
catch (IOException ex) { MessageBox.Show("Disk full or other IO error , unable to backup!"); } }
while executing the program it is showing an error like "The system cannot find the file specified" with caption "Win32Exception was unhandled "...
can anyone help in this.....
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hello all
i want to know how to get DateTime array through DataReader and set it as bolded Dates on MonthCalender
i have the following code ..
SqlCommand GetDates = new SqlCommand(); GetDates.Connection = new SqlConnection(ConS); GetDates.CommandType = CommandType.Text; GetDates.CommandText = "select Reserve_Date from reservations where Done = 0";
GetDates.Connection.Open(); SqlDataReader rd = GetDates.ExecuteReader(); while (rd.Read()) { DateTime ReservDays = (DateTime)rd["Reserve_Date"]; monthCalendar1.AnnuallyBoldedDates = new DateTime[] { ReservDays }; } rd.Close(); GetDates.Connection.Close();
the reader works fine but the result is the last row only
i want to get all rows and set it as AnnuallyBoldedDates on monthCalender
thanks in Advance
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Mr.Kode wrote: the reader works fine but the result is the last row only
Because you are overwriting the variable in each iteration. You need to get everything into an array and finally set to monthCalendar1.AnnuallyBoldedDates. Since you don't know the number of items, it is easy to use a List.var list = new List<DateTime>(); while (rd.Read()) { DateTime ReservDays = (DateTime)rd["Reserve_Date"]; list.Add(ReservDays); } monthCalendar1.AnnuallyBoldedDates = list.ToArray(); Your code can be improved further by calling Dispose() on SqlConnection, command and reader.
Best wishes, Navaneeth
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Your statement "monthCalendar1.AnnuallyBoldedDates = new DateTime[] { ReservDays };" recreates the array on each iteration.
And also, the statement "DateTime ReservDays = (DateTime)rd["Reserve_Date"];" is needless.
I also recommend using a try/finally, with the rd.Close() in the finally. And a using statement for the connection.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
how do i call a c# funcation in html code, on link's onclick? i have already called a function onclick, i need to call another function.
kindly help me out....
Thanks Saurabh
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Assuming I understand your question you just need to name the second function as something else, e.g. OnClickTwo().
btw please do not use bold font for your question.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Firstly, try such questions in the ASP.NET forum - you are more likely to get usefull replies.
I assume you are trying to call a C# function in the code behind (server code)? In which case just make the link runat="server" and the onclick event should pick up C# code.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
As someone else said, we have an ASP.NET forum. I hate to say this, because it's a library overused by all sorts of clueless people, but AJAX may be what you're looking for. The alternative is simply to have a server control call a code behind method and do a postback.,
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |