|
|
Hi,
Do we need to make any changes or settings to use Signed DLLs in Windows Service? It is not working for me where as un-signed DLL is working fine.
Thanks in advance
|
|
|
|
|
try a simple test: ensure that there is no copy of your dll in the GAC, copy the fully signed dll and the exe into a new directory, then try to run the application.
Sathesh.
Blessed is the season which engages the whole world in a conspiracy of love.
|
|
|
|
|
public class clsRequestService
{
private static object _objArrayList =new object();
string _strUser;
string _strServiceRequested;
public object _ReqAL
{
get
{
return _objArrayList;
}
set
{
_objArrayList = value;
}
}
public string _User
{
get
{
return _strUser;
}
set
{
_strUser = value;
}
}
public string _ServiceRequested
{
get
{
return _strServiceRequested;
}
set
{
_strServiceRequested = value;
}
}
}
public static Collection<clsRequestService> ocRequestService = new Collection<clsRequestService>();
while (some thing)
{
oReqSer = new clsRequestService();
.....
oReqSer._ReqAL=ReqAL;
oReqSer._ServiceRequested = strReqServ;
oReqSer._User= strUser;
AppGlobalData.ocRequestService.Add(oReqSer);
}
Every thing works fine except the Array list, Latest array list values are duped in to
all the arraylist values in the collection.
How to make deep copy of array list
|
|
|
|
|
Hi,
what kind of object to you store within the arraylist? If it is a class of your own you have to implement the interface ICloneable. This will mark objects of this class as cloneable.
Then you have to implement sth to make a deep copy of your arraylist (Clone on ArrayList is not working since it only copies the reference of the contained objects). There you could have a look at this link
http://www.thomashapp.com/node/106[^]
Does this help you?
Regards
Sebastian
|
|
|
|
|
ptr_Electron wrote:
Every thing works fine except the Array list, Latest array list values are duped in to
all the arraylist values in the collection.
That's because clsRequestService is a reference type, so changing some values inside this class will be reflected in the second list. If you need a deep copy, then you must also provide a mechanism to clone objects of the clsRequestService type. There are various methods how to do this in .NET, you should take a look at this link[^] and some links inside this article.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
I have created a Windows Application that use Client Application Services for login purposes. Can someone please tell me how to deploy this service to a "Live" environment?
I have successfully packaged and deployed the Windows Application but obviously I cannot login as the web service is unavailable.
Thank you!
Illegal Operation
|
|
|
|
|
Hello,
I have 2 treeviews and one button. Ofter selecting a node in the first treeview and clicking the button, the selected node most be copied into the second treeview.
Bud how can i check first whether the second treeview already contains the selected node in treeview1?
Thanks,
Priya
|
|
|
|
|
Do you have a key or some kind of identifier that you're checking? Are you just checking the node text?
Generally speaking, you can use recursion to check each tree node with a boolean value for whether the node exists.
|
|
|
|
|
Just checking the node text
|
|
|
|
|
something like this
bool ContainsNode(string nodeText, Node treeNode){
if(treeNode.Text.Equals(nodeText){
return true;
}
bool contained = false;
foreach(Node node in treeNode.Children){
contained |= ContainsNode(nodeText, node);
}
return contained;
}
|
|
|
|
|
Create a List of the node text for second treeview. On button click, check if the list contains the text. If yes do not add. If no add the text to list and a node in treeview.
This will avoid looping through nodes for each and every time. However you will have to loop through for once to create the list.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
|
I have a table that is being dynamically generated based on selected fields from my form. However, after I have modified the table, I can't get it to display on the web page. What am I doing wrong or what else do I need to do to get the page to display correctly?
ASP place holder:
<asp:table id="tblBrowserOSTable" runat="server" enableviewstate="false" bordercolor="black" borderwidth="1" gridlines="Both" xmlns:asp="#unknown">
</asp:table>
(I have tried EnableViewState="false" too.)
C# code:
protected void MakeBrowserOSTable(DataTable dtContents)
{
int numRows = dtContents.Rows.Count;
int numCells = dtContents.Columns.Count;
Table newTable = new Table();
if ((numCells <= 0) || (numRows <= 0))
{
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Controls.Add(new LiteralControl("Please choose a platform"));
row.Cells.Add(cell);
newTable.Rows.Add(row);
}
else
{
foreach (DataRow r in dtContents.Rows)
{
TableRow row = new TableRow();
for (int c = 0; c < numCells; c++)
{
TableCell cell = new TableCell();
if (c == 0)
{
Label lbl = new Label();
lbl.Text = (string)r[c];
lbl.Text = lbl.Text.Trim();
cell.Controls.Add(lbl);
}
else
{
}
row.Cells.Add(cell);
}
newTable.Rows.Add(row);
}
}
tblBrowserOSTable = newTable;
}
|
|
|
|
|
What happens if you enable viewstate? let's start there.
|
|
|
|
|
I don't see any difference between the EnableViewState being set to "true" or "false". From reading the MSDN site, I think this needs to be "false" to update the view dynamically.
|
|
|
|
|
I finally figured this out. I wasn't approaching the problem correctly.
I had to change my ASP code to be an ASP:Placeholder:
<asp:placeholder id="tblBrowserOSTable" runat="server" xmlns:asp="#unknown" />
Then at the end of my code, instead of assigning the new table to the existing table (which is now gone), I replaced the placeholder control with the new table:
tblBrowserOSTable.Controls.Clear();
tblBrowserOSTable.Controls.Add(newTable);
|
|
|
|
|
Hi, Ive been trying to figure out how to go about doing this for a few hours, Was wondering if someone could offer some advice.
What i have is "List<string> Files = new .." containing a number of file paths in order of last opened. The list is LIMITED to only holding 10 items.
When a new file is opened, i want to shift all of the items in the list by +1 place.
So Files[1] goes to Files[2] ... and Files[2] goes to Files[3]
and so on.
So then i can keep adding new files, they will go to Files[1] and all of the others move up a position.
Anyone any advice? If what i said even makes the slightest of sense?
Thanks for reading my confusing stuff
|
|
|
|
|
Do a list.Insert to put the item in at the first place, and a list.Remove to remove the last item from the list.
|
|
|
|
|
I recently implemented something similar. The way I did it was to have a class that contained the 'friendly' filename, filepath and date. I used IComparable to sort them by date descending and used a generic list and it's Sort method. Then I just displayed the number of entries I was interested in by getting those just that many from the beginning of the List.
Doing it that way, you can automatically 'reverse fill' the list if you give the user the option to remove an entry - similar to the way visual studio does.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
What happens if you open a file that's already part of the collection? If it should only work for new files being opened, then a Queue[^] will do the job, otherwise could use a LinkedList[^].
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
for every potentially new file, you can remove it (which will fail silently if not present),
then insert it at the most-recently-used side.
When the remove failed (see return value), you may want to remove the one at the least-recently-used side instead.
|
|
|
|
|
This is what a Stack or Queue is used for...
Either that or just use List.Add, and then display them in reverse order
|
|
|
|
|
I have a form that gets a list of files for processing I am storing the path in an sting array then passing the array to a class that does the work on the files. the single thread approach takes about 30 mins to process 100 files and update an access DB (will be ported to SQL soon). Currently the single thread makes the form not responsive. I want to at a minimum move the processing to another thread, possibly setup a thread pool. from what I can tell the time consuming part is updating the DB. I have a few questions before I jump to conclusion of adding 1 thread or a thread pool.
1. will the thread pool solution run into locked file problems when writing to the DB from multiple threads? currently using Jet OLEDB to connect to the DB
2. What is the best way to handle passing the files to the class with threads?
Currently I am reading the directory and storing the files in a string array in the form
creating the object for the class
passing the array to the StoreArray method
call the Process method
the process method calls another method that handles the interaction with the array
I think the answer to my 2nd question with the least amount of rewriting code is to create the object of the class as a form variable, but I'm not sure that that is really the best solution.
I'm new to threads and not sure how I can get the data from the Form to the class.
below is two of the methods that should show how i am currently doing this (could have errors I didn't cut and paste)
## form1 ###
private void btnStart_Click(object sender, EventArgs e)
{
int count = 0;
string dirpath = this.txtxmldir.Text.ToString();
if (dirpath != "")
{
//new Dir Info object
DirectoryInfo di = new DirectoryInfo(dirpath);
//load files into array
FileInfo[] rgFiles = di.GetFiles("*.xml");
foreach (FileInfo fi in rgFiles)
{
file[count] = dirpath + "\\" + fi.Name;
count++;
}
}
RRRxml ProcessXml = new RRRxml();
ProcessXml.SetFiles(file, count);
ProcessXml.Process();
}
## RRRxml Class ###
public void Process()
{
while(Arraycounter > 0)
{
string FiletoProcess = ReadFiles(); //Read files is in charge of controlling the array counter and returns the file to load
xml.Load(FiletoProcess);
//Do work....
}
}
|
|
|
|
|
Hi Planker,
i will try to answer your question.
1. I don't know it exactly but it seems that there is only one connection to the db at one time (I think because it is file based). This issue will be solved if you move to a database supporting multiple connections at once. To use multiple threads with the access database you can think about using the producer-consumer pattern. The threads processing your files will produce data. This data will be stored in a single datastructure (attention: must be thread-safe!). If data is passed into this structure the thread containing the db connection will "consume" this data and store it within the db. (search for the producer-consumer-pattern to get an idea of it).
2. Here I would nearly do the same using the producer-consumer-pattern. Store the files in a thread-safe datastructure (single static instance, so that it can be accessed from everywhere in your application), the threads working with the files will "consume" the filenames stored within the datastructure.
The perfect datastructure for this is a Queue. For using the producer-consumer-pattern take a look here:
http://msdn.microsoft.com/en-us/library/yy12yx1f(VS.80).aspx[^][^].
Let me know if this helps you.
Regards
Sebastian
|
|
|
|