|
kumar.bs wrote: if we synchronize the whole method, how other thread can make calls between Count and RemoveAt?
They can't (as long as they use the lock), and that's the whole point. because between "Count" and "RemoveAt" noone may modify the list.
Keep in mind that querying Count is usually very fast, so lock acquisition and RemoveAt will take the majority of execution time anyway.
kumar.bs wrote: lock(mylist.syncRoot) can't we specify lock(mylist)?
Two problems:
First, "List Proxies". The synchronization works correct only if all threads accessing the list use the same object to lock on. However, the List interface might not hold the data itself, but expose the interface for some underlying data. If one thread lokcs on the list proxy, and another thread locks on the underlying data, we have the concurrent access we need to avoid.
Second, Lock Order.
There is a problem wiht locking on publicly visible symbols. When you have two locking objects A and B, one thread might lock in the order A, B the other in order B,A. This leads to a deadlock situation that cannot be solved.
That's why locking on public objects is almost always a bad idea. You need to be very clear which lock objects exsit in your code (and the code you call!), and give them a definite order. SyncRoot helps here a little bit since it is a dedicated object used for locking, that is provided by the underlying data.
helped?
|
|
|
|
|
Thanks Peter, could able to understand better.
|
|
|
|
|
Hi frenz,
In my application im changing formats of images...so while the process is going on i want to show the names of the images being processed in the status bar...for that i have the code...but the prob is...the for is not getting refreshed...i mean the names are not getting updated in the status bar...only the firat image's wis shown in the bar and if any messagebox pops up in between then the status bar gets updated with the latest images name...
i want to make the form get refreshed evry time the name is changed so tht the status bar gets updated with the name...
Plz help in this...
P.S writing code in C# 2005
|
|
|
|
|
You should move the process to another thread, so your UI updates. Application.DoEvents() is the cheats way to try and avoid writing threaded code, you can try that first, perhaps
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
thank u for the quick reply...can u tell me in a bit detail way how to go about that...
thanx in advance...
Inder..
|
|
|
|
|
The right way ? You need to read up on the BackgroundWorker class, have it do whatever your app is doing, and use the progress notifications to communicate with your main thread and update your UI.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to check whether the text entered in a control, say a text box is of double or not.
How can I do it? Thanks.
Keshav Kamat
India
|
|
|
|
|
Use double.TryParse(text) .
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I want to store more than one doc file, pdf file ,ppt file
,other file using single id.
|
|
|
|
|
I have no idea what your question is
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Do you need to convert a file into all these types that you mention?
You are being very vague and/or not making much sense.
|
|
|
|
|
Hi !
i want to develop a software that must be have Math Equation.
if possible use from Math Equation of word, or no How to i have a one on my software?
beacuse i want create an editor that must be have math formula.
Thanks.
|
|
|
|
|
Search the articles on this site, there are a few that detail what you are trying to do from what I can tell.
_____________________________________________________________________
Our developers never release
code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
Visit Me at GISDevCafe
|
|
|
|
|
I need visual studio2005 bootstrapper
|
|
|
|
|
I'm sure you do....
What do you mean by bootstrapper ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I dont know about .net bootstrapper.
Bootsrap loader is a program used to start up an operating system such as Windows which loads the required services and the process in the memory.
But what is .net bootstrapper.
Do you mean the installation file or something?
Keshav Kamat
India
|
|
|
|
|
I suspect he wants a way to distribute a .NET app so running it installs the framework, or the framework is not required.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
initially my xml file is
<?xml version="1.0" ?>
<lasers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="laserProp.xsd">
<laser LaserName="Laser1" ModelName="Nufern v1.0" SerialNo="1" ManufacturerName="Nufern v1.0" Maximumpower="200w">
<properties>
<image>CW-Waveform.jpg</image>
<WaveTypes>
<WaveType Name="CW Waveform" url="CWwaveform.html" isavailable="true" />
<WaveType Name="Relaxation Oscillation Envelope" url="RelaxOscillation.html"
isavailable="true" />
</WaveTypes>
<tabular>
<property id="300" name="System active" currval="0" prgbar="false" selected="false" min="0"
max="100" pwd="true" units="C" gauge="true" thresholdval="10"/>
<property id="301" name="Enable laser" currval="0" prgbar="true" selected="false" min="0"
max="100" pwd="true" units="C" gauge="true" thresholdval="10"/>
</tabular>
</properties>
</laser>
</lasers>
And my xsd is
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="lasers">
<xs:complexType>
<xs:sequence>
<xs:element name="laser">
<xs:complexType>
<xs:sequence>
<xs:element name="properties">
<xs:complexType>
<xs:sequence>
<xs:element name="image" type="xs:string" />
<xs:element name="WaveTypes">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="WaveType">
<xs:complexType>
<xs:attribute name="Name" type="xs:string" use="required" />
<xs:attribute name="url" type="xs:string" use="required" />
<xs:attribute name="isavailable" type="xs:boolean" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="tabular">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="property">
<xs:complexType>
<xs:attribute name="id" type="xs:integer" use="required" />
<xs:attribute name="name" type="xs:string" use="required" />
<xs:attribute name="currval" type="xs:integer" use="required" />
<xs:attribute name="prgbar" type="xs:boolean" use="required" />
<xs:attribute name="selected" type="xs:boolean" use="required" />
<xs:attribute name="min" type="xs:integer" use="required" />
<xs:attribute name="max" type="xs:integer" use="required" />
<xs:attribute name="pwd" type="xs:boolean" use="required" />
<xs:attribute name="units" type="xs:string" use="required" />
<xs:attribute name="gauge" type="xs:boolean" use="required" />
<xs:attribute name="thresholdval" type="xs:integer" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="LaserName" type="xs:string" use="required" />
<xs:attribute name="ModelName" type="xs:string" use="required" />
<xs:attribute name="SerialNo" type="xs:integer" use="required" />
<xs:attribute name="ManufacturerName" type="xs:string" use="required" />
<xs:attribute name="Maximumpower" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
now it is working fine, but when xml file has more than one laser(laser is child node of lasers) then it is giving validation error like
"The element lasers has invalid child element laser"
Help me on this
Thanks in advance
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="lasers">
<xs:complexType>
<xs:sequence>
<xs:element name="laser" maxOccurs="Unbounded">
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks very much
praveenkumar Palla
|
|
|
|
|
initially my xml file is
<lasers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nonamespaceschemalocation="laserProp.xsd">
<laser lasername="Laser1" modelname="Nufern v1.0" serialno="1" manufacturername="Nufern v1.0" maximumpower="200w">
<properties>
CW-Waveform.jpg
<wavetypes>
<wavetype name="CW Waveform" url="CWwaveform.html" isavailable="true">
<wavetype name="Relaxation Oscillation Envelope" url="RelaxOscillation.html"
isavailable="true">
<tabular>
<property id="300" name="System active" currval="0" prgbar="false" selected="false" min="0"
max="100" pwd="true" units="C" gauge="true" thresholdval="10">
<property id="301" name="Enable laser" currval="0" prgbar="true" selected="false" min="0"
max="100" pwd="true" units="C" gauge="true" thresholdval="10">
And my xsd is
<xs:schema attributeformdefault="unqualified" elementformdefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="lasers">
<xs:complextype>
<xs:sequence>
<xs:element name="laser">
<xs:complextype>
<xs:sequence>
<xs:element name="properties">
<xs:complextype>
<xs:sequence>
<xs:element name="image" type="xs:string">
<xs:element name="WaveTypes">
<xs:complextype>
<xs:sequence>
<xs:element maxoccurs="unbounded" name="WaveType">
<xs:complextype>
<xs:attribute name="Name" type="xs:string" use="required">
<xs:attribute name="url" type="xs:string" use="required">
<xs:attribute name="isavailable" type="xs:boolean" use="required">
<xs:element name="tabular">
<xs:complextype>
<xs:sequence>
<xs:element maxoccurs="unbounded" name="property">
<xs:complextype>
<xs:attribute name="id" type="xs:integer" use="required">
<xs:attribute name="name" type="xs:string" use="required">
<xs:attribute name="currval" type="xs:integer" use="required">
<xs:attribute name="prgbar" type="xs:boolean" use="required">
<xs:attribute name="selected" type="xs:boolean" use="required">
<xs:attribute name="min" type="xs:integer" use="required">
<xs:attribute name="max" type="xs:integer" use="required">
<xs:attribute name="pwd" type="xs:boolean" use="required">
<xs:attribute name="units" type="xs:string" use="required">
<xs:attribute name="gauge" type="xs:boolean" use="required">
<xs:attribute name="thresholdval" type="xs:integer" use="required">
<xs:attribute name="LaserName" type="xs:string" use="required">
<xs:attribute name="ModelName" type="xs:string" use="required">
<xs:attribute name="SerialNo" type="xs:integer" use="required">
<xs:attribute name="ManufacturerName" type="xs:string" use="required">
<xs:attribute name="Maximumpower" type="xs:string" use="required">
now it is working fine, but when xml file has more than one laser(laser is child node of lasers) then it is giving validation error like
"The element lasers has invalid child element laser"
Help me on this
Thanks in advance
PraveenKumar Palla
|
|
|
|
|
Dear all,
As per the need in my application i need to convert doucment to pdf.Can any body can help from this situation please send the code or guidance so that i can complete the task
thanks and regards,
Balasubramanyeswar.A
|
|
|
|
|
ASP.NET is irrelevant, it has nothing to do with your task.
There are commercial libraries for PDF generation. There are free ones too, but not sure if they do doc->pdf.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
1. You must setup Adobe Acrobat 7.0 Professional,postscript.exe,gs811w32.exe
2. ConvertDoc2PDF.js
var files = WScript.Arguments;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var word = new ActiveXObject("Word.Application");
var PDF = new ActiveXObject("PDFDistiller.PDFDistiller.1");
word.ActivePrinter = "MS Publisher Color Printer";
//files(0) document file name
//files(1) PDF file path
var docfile = files(0);
var psfile = files(1) + fso.GetBaseName(files(0)) + ".ps";
var pdffile = files(1) + fso.GetBaseName(files(0)) + ".pdf";
var logfile = files(1) + fso.GetBaseName(files(0)) + ".log";
try{
var doc = word.Documents.Open(docfile);
//Convert WORD to PS;
word.PrintOut(false, false, 0, psfile);
doc.Close(0);
//Convert PS to PDF;
PDF.FileToPDF(psfile,pdffile,"");
// Delete PS
fso.GetFile(psfile).Delete();
// Delete Log
fso.GetFile(logfile).Delete();
word.Quit();
WScript.Echo("isuccess");
WScript.Quit(0);
}
catch(x)
{
word.Quit();
WScript.Echo("isfail");
WScript.Quit(0);
}
3.C#
using System;
using System.Diagnostics;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public void StartConvertPDF()
{
Process proc = new Process();
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.WorkingDirectory = @"c:\";
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardInput = true;
proc.Start();
proc.StandardInput.WriteLine(@"cscript //nologo c:\ConvertDoc2PDF.js c:\test.doc c:\");
proc.StandardInput.WriteLine("exit");
proc.WaitForExit();
}
private void button1_Click(object sender, System.EventArgs e)
{
Thread thConvert = new Thread(new ThreadStart(StartConvertData));
thConvert.Start();
}
PS:
Download Adobe Acrobat 7.0 Professional,postscript.exe,gs811w32.exe
web : itbaby.jss.cn
email : zerodj@163.com,javasuki@itbaby.jss.cn
|
|
|
|
|
there is a error when i run my prog. it says "A namespace does not directly contain members such as fields or methods" the error is with "writeID" can anyone help?? thanks
private void cmdWrite_Click(object sender, EventArgs e);
}
writeID(txtTxmID0.Text.ToUpper(),txtTxmID1.Text.ToUpper(),txtTxmID2.Text.ToUpper(), txtTxmID3.Text.ToUpper(), txtTxmID4.Text.ToUpper(),txtTxmID5.Text.ToUpper());
}
|
|
|
|