|
Well it would be impossible to "show all of it on screen at once"... there would have to be some way to page through the text (like a scroll bar). Searching is another example of how to page through the data (you only jump to lines you are interested in).
Luc Pattyn wrote: you can and must do better than just dump hundreds of megabytes of text in the user's face and leave him at a loss
Just because the user wants to display the text in a text box does not mean that is all he/she wants to do. There could be additional features (such as search).
|
|
|
|
|
with 300MB of text, you get some 5M lines; when the screen is 1000 pixels high, one scrollbar pixel corresponds to 5000 lines. Are you ever going to touch the elevator and get to see what you are hoping for?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
So you have 2 vertical scrollbars. One which scrolls the full height, one which scrolls 5000 lines at a time. Or you have a scrollbar and a slider so the user can control the amount the scrollbar scrolls. Or you let the user use page up/page down. Or you assume they will probably be using the search function. Or you take the horizontal position of the mouse into account when scrolling vertically... more to the right and you scroll more and more to the left means you scroll smaller increments. Or you allow the user to jump to a specific line or jump a certain number of lines down/up. Could even have a textbox (or slider) that controls the number of lines a page down/page up will jump. There are many ways this could be solved. No reason to put an artificial limit on the size file that can be viewed.
|
|
|
|
|
Luc Pattyn wrote: Dengbo wrote:
reading and displaying a huge text file (>=300MB) in a textbox.
that sounds like extreme non-sense; who in his right mind is going to read one huge page of text like that?
you know, some routing reported files (shop order, job cost, etc) in ERP can be very huge...---------------------------------
Believe what you saw!
|
|
|
|
|
Dengbo wrote: some routing reported files (shop order, job cost, etc) in ERP can be very huge...
I know, but that does not mean I want to see all their content, I want the app to present a decent user interface, not a truck load of data.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
If it is a log file, I suggest saving it with xml node info. This can then be hooked to some database (file to xml) technique to enable search features. Also, it will be more organized data.
If this log file is not created by you, then it sounds like a daunting task.
Dengbo wrote: So you have 2 vertical scrollbars. One which scrolls the full height, one which scrolls 5000 lines at a time
This gives me an idea. What you can do is not to have text in the textbox. Show only the info that the user wants.
Instead of adding ScrollBars, add buttons to scroll page up or down. This will enable a paging possibility and it will be easier to handle too.
|
|
|
|
|
FYI, you misattributed that quote... I wrote that.
Som Shekhar wrote: add buttons to scroll page up or down
That is what the PAGE UP/PAGE DOWN buttons would do. It would be, however, quite slow when paging 5,000 lines or so.
Som Shekhar wrote: Instead of adding ScrollBars
Why not have both ScrollBars and PAGE UP/PAGE DOWN functionality?
|
|
|
|
|
Well, I was thinking of having 5+ string builder objects.
1 for current text in textbox
1 for next page
1 for previous page
1 for 5000 lines ahead page
1 for 5000 lines behind page
you can add more if you wish in the same way.
You need to maintain few indexes in your program to read only those blocks using StringBuilder.ReadBlock method.
Searching is something I am not sure of.
|
|
|
|
|
The problem is not the buffer... the speed issue is from the user... it will take many pages before they traverse 5,000 lines of text. The text can be loaded from the file on-demand without the user noticing. The trick is to reduce the amount the user must interact with the UI.
|
|
|
|
|
Now, this confuses me. What exactly is your question then?
Reading your question, it sounded like displaying it in Textbox is the problem.
Are you talking about Search? or some other thing?
|
|
|
|
|
I am not the one with the question. Look at my username. I was merely correcting you.
|
|
|
|
|
HA HA HA... This was funny... I am so sorry!!!!! HA HA HA...
Now I see, I misquoted you, Misunderstood you and everything... just because you replied me first... Sorry Buddy.
|
|
|
|
|
aspdotnetdev wrote: The trick is to reduce the amount the user must interact with the UI.
this is where we agree.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
hiwave is a external .exe, and it has a Component Object Model (COM) interface.
I add a COM reference of hiwave library in my C#.
When use "HiwaveLib.Hiwave aaa = new HiwaveLib.HiwaveClass();", I can get a new instance of hiwave and control it.
But I want to realize below function:
first, user run the hiwave, and then my C# connects to this existent hiwave instance through COM interface and control it.
What should I do?
Thanks
|
|
|
|
|
You haven't provided enough details to narrow down an answer.
Has this existing instance been created inside your own app, or was it created in another app? Did you write this other app or is it a "off-the-shelf" piece of software? Does the object you're trying to use have built in singleton support?
|
|
|
|
|
The existing instance is created in another app. My own app want to control the existing instance.
This other app is a "off-the-shelf" software.
|
|
|
|
|
Then you're very limited in what you can do.
If the COM object that app creates is a singleton AND is exposed to the rest of the system, then you can probably use the Activator.GetObject() method to get at the instance of the COM object (you still need to import the COM object in your project references.) If not, you're pretty much SOL.
|
|
|
|
|
I received the following error (see line *********error***********) when trying to transfer data from excel to sql using the code below. The sql table is in the database and columns all match the store procedure, does anyone have any idea what creates this problem.
Thanks in advance, Michael
Failed to obtain column collation information for the destination table. If the table is not in the current database the name must be qualified using the database name (e.g. [mydb]..[mytable](e.g. [mydb]..[mytable]); this also applies to temporary-tables (e.g. #mytable would be specified as tempdb..#mytable).
void ExcelToSqlBulkCopy(String strPath, String strFile, String strTableName)
{
strExcelStoredProcedure = "SELECT ID,City,State FROM [Cities$]";
String excelConnectionString = y;
String sqlConnectionString = z;
// Create Connection to Excel Workbook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand(strExcelStoredProcedure, connection);
connection.Open();
// Create DbDataReader to Data Worksheet
using (DbDataReader dr = command.ExecuteReader())
{
// Bulk Copy to SQL Server
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "[MyDatabase].[dbo].[" + strTableName + "]";
bulkCopy.WriteToServer(dr); *********error***********
}
}
connection.Close();
}
}
|
|
|
|
|
I never use a data reader so how do you inspect the contents of a datareader to check that the info in it is correct before you try to bulk copy.
I would change the datareader to a datatable and inspect the contents before the bulkcopy statement comparing the columns and the datatypes, excel is a crappy data source! Collation makes me suspect unicode or suspect characters in the data.Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I am into a 3D simulation project where I need to subtract a 3D model from another (repeatedly fast). I am using OpenGL and STL-files. Can anyone give me a suggestion of what to use? My dream is to find something that I could use call from C#. Or maybe can help me code it? I am a student so I cant afford to buy anything fancy, so if there is anything free I would love to hear about it.
|
|
|
|
|
I'm not sure what you mean by "subtract a 3D model from another (repeatedly fast)", but XNA is pretty much the standard for doing 3D type work with C# (usually relating to video games).
|
|
|
|
|
Thanks. It is for a machine simulator where I need to run a mill (a cylinder with flat or ball edge at the bottom) through a workpiece. Each time the mill moves it needs to erase the material that it touches, making a track in the material. So I more or less need to say subtract(myWorkPiece, myMill). That is called 3D boolean operations, do you know if XNA can do that?
|
|
|
|
|
That is more like a feature you'd find in a fully functional 3D design program, not in XNA. You'd have to build that feature yourself, but XNA could help I'm sure.
|
|
|
|
|
This is not a simple problem. There are some open-source packages for doing solid modeling, but they require a lot of work and you will have to link to these non-managed code libraries (written in C, not dot-net) in order to use them in C#. The most well known is http://www.opencascade.org/ but there are others. Search for "solid modeling" and "free library" or "open source" to find them. I wish you a lot of luck.
|
|
|
|
|
Thank you! I suspected it was going to be hard, I dont even dare to think of figuring out myself. I will check out your suggestions, still hoping I will be able to find a solution.
|
|
|
|