|
What is the value of fullUserFilePath? Surely that will determine the name of the zip file Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
yes that is the name of the zip file, but it names the file within it like that, whereas i want to name it differently.
so at the line:
using (GZipStream stream = new GZipStream(outfile, CompressionMode.Compress))
it would be ideal if i could do something like:
using (GZipStream stream = new GZipStream(outfile,"myfileName.xml", CompressionMode.Compress))
but that's not possible ...
|
|
|
|
|
I see what you mean, what if you rename the zipped file? you can use System.IO.File.Move(...) for that. Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
the problem is that after compression, i want to rename the zipped file(within the zip file...)
the name of the zip file is correct...
|
|
|
|
|
So do it the other way around, make the name of the gzipped file correct and change the filename of the result
|
|
|
|
|
Like harold says, do it the other way around.
You may want to consider creating a 'temp' zip file named the same as you want the internal file to be called. Then you the File.Move function to move that 'temp' file to that specified in fullUserFilePath
Just remember to be careful where you create temp files, Application.Startup (or similar) can cause write issues with certain user restrictions. Maybe 'ApplicationData' or something like that would be fine. Your choice thouLife goes very fast. Tomorrow, today is already yesterday.
modified on Monday, February 8, 2010 1:20 PM
|
|
|
|
|
Or you could use SharpZipLib[^], it's free and places no restrictions on your license if you link with the binary. The compression ratio is better and it allows you to properly handle and create zip files (the problem you have does not occur with SharpZipLib)
|
|
|
|
|
Friends,
I hope you can help me. I am developing a new project and this project I have several screens. Well, I would like to create a screen through her name and that name is the same class name of the screen.
Example:
I create a new screen, and put her name as formCadastro. Now, in my base form, I would go to a function the string value "formCadastro" function and open the screen with the same name.
Is it possible? I tried to work a little with the System.Windows.Forms.Form class but I could not ... Thank you for your help.
Success for All
|
|
|
|
|
Like this[^] ?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Friend, it would be nearly so. But I wanted something simpler. There is to create a container of the screens?
I am studying the example. Thanks
|
|
|
|
|
Have you tried a switch statement?
switch(inputname){
case "Screen1": Screen1 s1 = new Screen1();
s1.ShowDialog();
break;
case "Screen2": Screen2 s2 = new Screen2();
s2.ShowDialog();
break;
default:
break;
} V.
|
|
|
|
|
Friend, this will not work.
There are many screens, and would like to develop a generic method.
Thanks!
|
|
|
|
|
I would use something like this...
private void CreateScreen(string FullName, params object[] args)
{
Type t ;
Form f;
t = Type.GetType(FullName);
if (t != null) {
f = Activator.CreateInstance(t, args) as Form;
if (f != null) {
f.Show();
}
}
}
This would also allow you to pass arguments to the constructor. You may also have to pass the Full name of the Form including the Namespace. I don't remember how Type.GetType() works.
Edit: Sorry, forgot I was in C#.modified on Monday, February 8, 2010 11:02 AM
|
|
|
|
|
Perfect! Thanks Brother
Sucess!
|
|
|
|
|
Hi,
I have got a serious problem. I have connect a table with the windows form. The table looks like
Id name age place country
1 sss 11 ttt qqq
2 ww 12 eee qqq
Now I'm able to display all of them in a richtextbox in the following format whose country = qqq
1.
Id ="1"
Name = "sss"
age =11
place = "ttt"
country = "qqq"
2.
Id ="2"
Name = "ww"
age =12
place = "eee"
country = "qqq"
now i add a linklabel control to the textbox. the text of the linklabel wiill be the result of Name column when on click it is linked to a webpage.
here my problem is it is not scrolling along with text.
this is how my code looks :
public void button3_Click(object sender, EventArgs e)
{
OdbcCommand bcC2 = new OdbcCommand();
bcC2.CommandText = "select * from C_RefCitation where c_id like ('" + textBox5.Text + "')";
bcC2.Connection = OdbcCon;
DataSet q3 = new DataSet();
OdbcDataAdapter db1A2 = new OdbcDataAdapter(bcC2);
db1A2.Fill(q3);
dataGridView1.DataSource = q3.Tables[0];
richTextBox2.Visible = true;
richTextBox2.Clear();
for (int x = 0; x < dataGridView1.Rows.Count - 1; x++)
{
richTextBox2.AppendText((x + 1).ToString() + ". ");
for (int y = 0; y < dataGridView1.Columns.Count; y++)
{
richTextBox2.AppendText("\n");
richTextBox2.AppendText(dataGridView1.Columns[y].HeaderText);
richTextBox2.AppendText(" : ");
if (dataGridView1.Columns[y].HeaderText.ToString() == "c_CitationDOI")
{
this.richTextBox2.SelectionStart = this.richTextBox2.TextLength;
int index = richTextBox2.Text.Length;
Point position = richTextBox2.GetPositionFromCharIndex(index);
LinkLabel label = new System.Windows.Forms.LinkLabel();
RichTextBox sri = new System.Windows.Forms.RichTextBox();
label.Text = dataGridView1.Rows[x].Cells[y].Value.ToString();
label.AutoSize = true;
label.Location = new Point(0,position.Y);
label.LinkBehavior = LinkBehavior.NeverUnderline;
richTextBox2.Controls.Add(label);
richTextBox2.AppendText(label.Text);
label.Links.Add(1, 7, dataGridView1.Rows[x].Cells[y].Value.ToString());
label.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.label_LinkClicked);
}
else
{
richTextBox2.AppendText(dataGridView1.Rows[x].Cells[y].Value.ToString());
}
if (y != dataGridView1.Columns.Count - 1)
{
richTextBox2.AppendText(", ");
}
}
richTextBox2.AppendText("\n\n\n ");
}
}
please help me in modifying this code so that the controls scroll along with text box.
Thank you very much
|
|
|
|
|
Hello all.
I have an ASP.Net application that scans input then collects other data from SQL 2005 DB. This data is then required to be sent to a server application that "Captures" the information into an ERP application. The "Capturing" app takes +- 30 seconds to run for each transaction. The Scanning App should be virtually insantaneous so we cannot wait for the Server app to run. The problem is that there are 25 clients scanning about 20000 transactions per day. This means that I need 166 hours to process all transactions or run eight server applications. Does Anyone know what the best method would be to handle these transactions?
Thanks in Advance for your Assistance.
|
|
|
|
|
Without understanding your the architecture very well, the thing that jumps out for me is this:
Bob Steel-Smith wrote: I have an ASP.Net application that scans input then collects other data from SQL 2005 DB. This data is then required to be sent to a server application that "Captures" the information into an ERP application. The "Capturing" app takes +- 30 seconds to run for each transaction.
The thing that is probably hammering you is the collection of supplementary data from the SQL server. Can any of this be cached (ie is it Lookup style data), if so you should. It might also be better to take the load of this from the client to the server (and just send up the input).
The system seems slow, given that only 20000 transactions are being processed. As a comparison we receieve an XML file containing ~.5GB data consisting of millions of records, which we run through in ~ 15 mins, and we aren't exactly running on a beofwulf cluster.Antoine de Saint-Exupery: Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
|
|
|
|
Hi, The Server app is the slow one where it is actually typing in the data into the ERP application through the ERP client. (I hope thats not too confusing) What I have done in the past is to scan the input directly into a table which is the end of the users input so this is extremly quick. From there I scheduled three similar applications (each selecting unique data) running on the server every three minutes. The amount of rows selected from the "Source" table was limited so the server apps would stop and start during the day. For the system to process all the data I would need 8 of these applications. What I am trying to do is have one server application that can run eight instances at the same time. I hope this serves to clarify my problem further, Thanks.
|
|
|
|
|
So as I understand it, the real problem is this:
Bob Steel-Smith wrote: The Server app is the slow one where it is actually typing in the data into the ERP application through the ERP client
We have a similar "Screen Scraper" running against telnet and our "big iron" server. Such tecnology is terrible, slow and flaky (at least in my experience). The best solution is, as you suggest, to by pass the client altogether and access the database directly. This will was orders of magnitude quicker for us.
Where this is not an option I can suggest the following (apologies if I'm stating the obivous, but hopefully, my suggestions will help/ give food for thought):
- The screen scraper probably has a typing rate: increase this! - Simple but doubling the rate ~halves the time...
- Multi-thread the server so it can deal with more than one client (assuming it isn't already).
- Is it possible to call the ERP server though the same mechanism as the ERP client (e.g. are there service calls available?)
- Is it possible to expose the methods on the ERP service as web services. I know some of the IBM Mainfames now allow you to install websphere, which can be utilised by a .net client and can expose functions on the server automagicallly
- If you are not on a mainframe and you have a propriatary ERP systems, do they provide an API you can use to communicate with the server?
Antoine de Saint-Exupery: Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
|
|
|
|
Hi, We try to avoid direct writes to the database due to upgrades of the software etc.
1. Even if the automation took 15 seconds this would be too long for the capture screren to wait.
2. Multi threading, I know nothing about so will have to research it.
3. Service Calls are available
4. Web Services may be used. I have created a web service but the scanning web page sends an xml string to the web services and then waits untill the web service is complete before refreshing the page ready for the next scan. If the Web page sent the xml string and then refresed the page straight away whilst the web serviced ran in the background tha would probably be the solution to my problem. Is it possible to do this?
5. The API's for the ERP System were developed by a third party that new how to develop but did not know the original software. They have a lot of bugs and are extremely difficult to correct.
Thanks, I have an idea of where I need to go with this.
|
|
|
|
|
Bob Steel-Smith wrote: 4. Web Services may be used. I have created a web service but the scanning web page sends an xml string to the web services and then waits untill the web service is complete before refreshing the page ready for the next scan. If the Web page sent the xml string and then refresed the page straight away whilst the web serviced ran in the background tha would probably be the solution to my problem. Is it possible to do this?
Yes, this can be done asynchronously.
Bob Steel-Smith wrote: 5. The API's for the ERP System were developed by a third party that new how to develop but did not know the original software. They have a lot of bugs and are extremely difficult to correct.
Pity, this would really have sorted it out, 30s per transaction is far too much.Antoine de Saint-Exupery: Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
|
|
|
|
Right. I appreciate your assistance. I am self taught and write most of the code from examples so will do the same here. Thanks very much for your direction.
|
|
|
|
|
I was in your position a while ago, so I feel your pain.
I assumed you were working as part of a dev team, and further assumed (as a consequence) that there was a reason why your aspx pages were communicating directly with the ERP system. As this isn't the case another thing you really should consider is a 3-tier architecture. This is where the website talks to a Web/WCF service, and the service talks to the ERP and Database systems.
The main advantages of a 3-tier architecture are
a) Each layer can be made to deal with its own stuff, and only its own cleanly, which will improve code quality and maintainability
b) If you need to write something else (e.g. a Winforms app, automatic service) to interact with the ERP system you can call the service directly.
c) You can replace any given layer in the stack more readily.
d) Scalability
e) [Most useful for your immediate problem] The user can interact with the ASP site, the site fires the update to the server (which returns and continues to process in the background). Which is the requirement you need right now.
Googling for the term 3-tier architecture or n-Tier architecture should provide more guidance.
Good luck, should be fun!Antoine de Saint-Exupery: Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
|
|
|
|
i am using sql server 2000. i have two database and have same schema now i want to develop a c# apps which will take two parameter source server and destination server and sync all the table data from source server to destination server. please help me with industry standard logic.
thankstbhattacharjee
|
|
|
|
|
There is no "industry standard logic" for this. Disable any appropriate constraints, copy data, re-enable constraints. Pretty simple on the surface. There are plenty of tools available that already do this. I know the language. I've read a book. - _Madmatt
|
|
|
|