|
Expert Coming wrote: I am opening about 70 web pages and pulling about 1000 strings from each. My arrays tend to be 60,000 to 100,000 string arrays.
Do you open all the web pages and pull the strings out before you start processing the data? If so you may wish to start processing before you have got all the data. That way you can clear out some of the data before processing the next batch which keeps memory requirements down which means you don't have to keep requesting more from the OS which can take time.
So, if you can process one page at a time at 1000 strings, rather than all 70 pages at 70,000 strings you might find that your process runs a bit quicker.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Please provide code for convertion of tif image file to binary format using C#
parthiban
|
|
|
|
|
Search google and codeproject. You will find plenty of articles on how to do this.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
I have created a windows service application.
Now i need to create a .msi file to be delivered to the client.
|
|
|
|
|
Hi there,
I've got an URGENT need to get hold of a bit of coding to programmatically add directory security, while creating directories through a software which I am working on.
It could be to hide or restrict access. That doesn't matter as long as access is controlled.It's better if a toggle security functionality is also there. But, however, let's focus on getting the security par first.
Got any codings or references (relevant for C#)?
Regards,
A
|
|
|
|
|
|
I'm a novice in c# programing,I wanna to devolop a windows application implement communication between many clients and one server,and I don't know how to do it first.
|
|
|
|
|
liucaihua wrote: a windows application implement communication between many clients and one server,
That's a pretty vague description. See this[^] for several examples. I highly recommend using WCF[^].
/ravi
|
|
|
|
|
hi
i want using thread in my app to show Waiting form, then my app load it's data,i close Waiting form by threadObj.Abort() method, in my computer, app work correctly, but when i copy my app on another machine and run it, the ThreadAbortException has occured (sometimes occured and sometimes not occured), i was used try-catch block to catch this exception but was not successful, here is my code :
private void Frm_Land_Load(object sender, EventArgs e)<br />
{<br />
System.Threading.Thread th = new System.Threading.Thread(gu.Show_WaitingForm);<br />
th.Start("Loading Data ...");<br />
Application.DoEvents();<br />
<br />
this.Initialize_Data();<br />
this.txt_date.Text = this.sh.Show_Hijri_System();<br />
this.toolStripStatusLabel1.Text = "Ready";<br />
<br />
Application.DoEvents();<br />
th.Abort();
how to solve my problem ?
|
|
|
|
|
hdv212 wrote: how to solve my problem ?
Don't use the Abort method.
You could use the BackgroundWorker[^] class instead for loading your app's data. It can report the progress to your user as it loads data, you can use a progress bar on a dialog box or just display the results in tool strip.
|
|
|
|
|
Why would you want to abort the thread? Why not make it exit normally using some event signalling mechanism?
That apart, what exactly does the thread do? If all it does is show a form, you're much better off doing it in the UI thread (the thread that Frm_Land_Load runs on) and doing this.Initialize_Data on a different thread. Something like
private void Frm_Land_Load(object sender, EventArgs e)
{
Thread th = new Thread(DoWork);
th.Start();
gu.Show_WaitingForm();
}
private void DoWork()
{
this.Initialize_Data();
this.BeginInvoke(new MethodInvoker(CloseWaitingForm), null);
}
private void CloseWaitingForm()
{
gu.Hide_WaitingForm();
}
This way, when Initialize_Data completes, CloseWaitingForm will be called on the main UI thread, which will hide the waiting form.
This solution assumes that Initialize_Data does not access any controls in the form. If it does, then you'll have to run the waiting form on a different thread. Something like
private void Frm_Land_Load(object sender, EventArgs e)
{
Thread th = new Thread(gu.Show_WaitingForm);
th.Start();
this.Initialize_Data();
gu.Hide_WaitingForm();
}
class GU
{
Form f;
void Show_WaitingForm()
{
f = new Form();
f.ShowDialog();
}
void Hide_WaitingForm()
{
if (this.InvokeRequired)
{
f.BeginInvoke(new MethodInvoker(Hide_WaitingForm), null);
}
else
{
f.Close();
}
}
}
Hope this helps.
|
|
|
|
|
Dear All,
I am clueless about how to create more graphically rich menus such as the ones that are used in Microsoft Office Application.
Thank you!
M. Nauman Yousuf
"Mess with the Best, Die like the rest"
|
|
|
|
|
Google around. You should actually do a search here at CP and I think there are a few graphically rich controls...Sorry, too lazy to search for you
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
if you want to design graphically rich menus like offce 2007, you are better buying a third party control instead of designing it that's just my opinion. Look up www.divelements.co.uk if you want office 2007 style menus.
|
|
|
|
|
Hello,
I have created a setup project and added some dialog boxes to the user interface.
I have added the dialog with 4 text boxes. Then using Orca I have modified this and added a radio button group with 2 radio buttons (A and B).
What I am trying to do is when the user selects A then all text boxes will be enabled. And when the user selects B then only 2 text boxes will be enabled.
This is my first time in using Orca, and anyone explain how to add this condition for selecting the radio buttons.
Many thanks advance,
Steve
|
|
|
|
|
Hello,
I load dynamically an external class library compiled as a .dll file, using this kind of code:
Assembly classLibrary1 = null;
using (FileStream fs = File.Open(path, FileMode.Open))
{
using (MemoryStream ms = new MemoryStream())
{
//... (Read file byte per byte and store it to memorystream)
classLibrary1 = Assembly.Load(ms.ToArray());
}
}
foreach (Type type in classLibrary1.GetExportedTypes())
{
if (type.GetInterface("IPClass") != null)
return Activator.CreateInstance(type) as IPClass;
}
I would like these objects (created from an external assembly) to have access to a single instance of an object I previously created (in the project that loads external classes).
For example:
The static class 'Hello' in my main project has to be accessed by the loaded classes. But only to the 'Hello' instance of the main projet (what I can't apparently do when using class from external assemblies)
Somebody knows how to deal with this issue?
Thank you,
Thomas
|
|
|
|
|
thg971 wrote: The static class 'Hello' in my main project has to be accessed by the loaded classes. But only to the 'Hello' instance of the main projet (what I can't apparently do when using class from external assemblies)
Why doesn't it work? AFAIK, singletons remain single within an AppDomain, so as long as the external assemblies are also loaded in the same AppDomain as your Hello class, they should be accessing the same instance.
If not, then you would have to derive your singleton from MarshalByRef and modify the code in the external assemblies to explicitly accept an instance of your singleton (as a property setter, for example) and then use that instance.
|
|
|
|
|
how can i get index of specified item in multidimension array ?
|
|
|
|
|
By using nested for loops to step through and checking for when the element is equal to your value.
valueSearch = "Value to search for";
for (int x = 0; x < array.GetLength(0); x++)
{
for (int y = 0; y < array.GetLength(1); y++)
{
for (int z = 0; z < array.GetLength(2); z++)
{
if (array[x][y][z] == valueSearch)
{
}
}
}
}
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
I would say that if you need to be searching, arrays aren't the way to go.
But if you must use arrays, the only tip I would add to the above is a break statement jump out of the nested for loops when you actually find the value (no need in running through the rest of the items).
J
Make the logo bigger
|
|
|
|
|
True that
There are 10 types of people in the world, those who understand binary and those who dont.
|
|
|
|
|
Hi im new to Both C# and sql and exept from that my problem is:
I´ve managed to connect to a mssql database (express edition) from my C# program and I have the sqldata reader to read my question to listboxes in my windowsForm. Ive understood from "Beginners guide to accessing SQL Server through C#" that once you got your connection running and the reader has read the table in the database You can rephrase your question without reading directly to the database.
If that is correct, Is it possible to establish a connection to the sql database in "program.cs" and get your reader to read the whole table and then let different windowsForms make sql questions to that reader? Im hoping to gain less questions to the DB and its supposed to get the table every five minutes or something.
I would be very happy if anyone could help me in this matter
Here is an example of code in my Form:
public partial class BinMonitor : Form<br />
{<br />
private SqlConnection conn;<br />
private SqlCommand cmd;<br />
private SqlDataReader reader;<br />
string Sql;<br />
<br />
public BinMonitor()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
private void timer1_Tick(object sender, EventArgs e)<br />
{<br />
textBox1.Text = DateTime.Now.ToLongTimeString();<br />
<br />
}<br />
private void timer2_Tick(object sender, EventArgs e)<br />
{<br />
<br />
listBox1.Items.Clear();<br />
listBox2.Items.Clear();<br />
listBox3.Items.Clear();<br />
string connStr = "server=DBserver; user id=user; password=pwd; database=flights;Trusted_Connection=yes;";<br />
SqlConnection conn = new SqlConnection(connStr);<br />
conn.Open();<br />
reader = null;<br />
cmd = new SqlCommand("SELECT * FROM BinMonitor Where Departure !<" + "'" + textBox1.Text + "'" + "order by Departure ASC", conn);<br />
reader = cmd.ExecuteReader();<br />
reader.Read();<br />
<br />
while (reader.Read())<br />
{<br />
listBox1.Items.Add(reader.GetString(0));<br />
listBox2.Items.Add(reader.GetString(1));<br />
listBox3.Items.Add(reader.GetString(2));<br />
}<br />
}<br />
<br />
<br />
<br />
}<br />
}
Lost in space
|
|
|
|
|
I am very happy to help you, I would not know that you want to express the link MYSQL or other intention.
I hope you can more simple expression of what you mean.
MSN : chenqi1000y@163.com
|
|
|
|
|
Thank you for helping!
I was hoping to get an answer if its possible to make the sqlreader work for several Forms at the same time, and if so how?
|
|
|
|
|
erikhjerpe wrote: If that is correct, Is it possible to establish a connection to the sql database in "program.cs" and get your reader to read the whole table and then let different windowsForms make sql questions to that reader?
No. A reader is a one-time-forward-only view of the data that is being retrieved from the database. Once a row has been read from the reader you cannot go back and read it again.
You may wish to look into DataAdapters in order to Fill a DataSet with the data which you can store in a central location and allow the forms to access.
erikhjerpe wrote: Here is an example of code in my Form
It is unwise to access data dirctly from a form.
erikhjerpe wrote: cmd = new SqlCommand("SELECT * FROM BinMonitor Where Departure !<" + "'" + textBox1.Text + "'" + "order by Departure ASC", conn);
reader
This code is susceptable to SQL Injection Attacks. Please read up on SQL Injection Attacks and Tips on How to Prevent Them[^]
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|