.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Slow BinaryReader Position Change Time

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :.NET Framework

Hello, I have a question about basically a laggy position change time with a large file (actually, in this case I'm using a 20GB or so disk drive).  Basically what I'm doing is writing my own class that uses the CreateFile function to read raw data from a local disk drive, and then have an extract file class that allows me to seek to blocks (the file system is FAT) that the file occupies, then read the data, piece it together, etc.  I noticed though, that when extracting an 800KB file, it took about 10 seconds to do the process, and the main cause was that changing my reader's position took anywhere from 250 milliseconds to one complete second.

The short version: When extracting a file using my own classes, it took way longer than it should have, and the cause is changing the IO's position.


The code is exactly as you'd probably imagine:

for (int i = 0; i < f.BlocksOccupied.Length - 1; i++)
          br.BaseStream.Position = m.GetBlockOffset(f.BlocksOccupied[i], f.PartInfo);
So what I am asking is if there is any way to speed up the process of moving my posit

View Complete Post

More Related Resource Links

SqlDataSource how to change the stored procedures at run time



Is it possible to change the select, insert and update stored procedure of an SqlDataSource at run time. I don't mean to change the definition of the stored procedure, but I mean to change the assignment, i.e. To change the select stored procedure from "selectSP1" to "selectSP2" at run time. Is it possible?



Slow page load during a list query one time during the day


We have a monitoring tool set to check to see if the home pages for our 3 web apps load in under 60 seconds every 10 minutes.  All 3 web apps load in under 3 seconds on every 10 minute check except for one exception.  One check every day one of the web app's home page takes longer than 60 seconds to load.  This happens at 11:45PM when there is very little user usage on the environment.  The characteristics of this page are as follows: The only thing on the page is a list view web part which was added by the browser.  The page has not been customized with SPD or code at all.  The list that it pulls is a simple links list that has 281 items on it.  The view pulls all 281 items and displays them in sets of 100.  I cannot find any associated event in the server events and/or SharePoint ULS logs nor are there any daily sharepoint timer jobs running at that time.  Our full index happens at midnight with incremental happening hourly.  Our enviroment is 2 WFEs, 1 App/indexer and we have a separate SQL cluster backend.  

Could someone lead me possibly in the direction I should take next in my troubleshooting?   

Why does .NET Framework 4 client profile slow down boot time network creation?

I've been running a Windows XP sp3 KVM virtual machine for a long time now, and some recent update made the initial network startup go from a few seconds at boot time to around 90 seconds. Using Add/Remove program to uninstall recent updates points the finger at .NET Framework 4 client profile. With it installed, if I right click on network and ask for properties right after booting, there is a 90 second delay before the network dialog with the list of network interfaces finally appears. In addition, the network drive I have automounted at login is not accessible for the same 90 seconds. As an experiment, I tried going into the device manager and deleting the network interface, and if I reboot after that it takes 90 seconds for the new hardware wizard to appear. All these 90 second delays vanish if I remove this .NET update. The network comes up as soon as the system boots.

Slow load time of custom assembly on x64 compared to x86.

I am developing an application that automatically generates assemblies using the CSharpCodeProvider (.Net Framework 3.5).  These assemblies contain a single class with a very large number of local variables and methods.  After compilation I create an instance of this class (using Activator.CreateInstance) to be used elsewhere in the application.  When the application is deployed on a 32-bit system (tested on Win 7 Prof 32-bit and on Win XP) the CreateInstance method returns after 1 or 2 seconds, i.e. it first JITs the assembly before creating the instance.  However, on a 64-bit system (tested on Win 7 Home 64-bit, Win Server 2003 64-bit and Win Server 2008 64-bit) CreateInstance takes up to 5 minutes to return. Is there any reason why it would be that much slower on a 64-bit machine? I have tried many different options when compiling, such as setting the platform to x64, using the /optimize flag, etc, but none of these have made a difference. I also tried calling PrepareMethod on all the method in the class.  When I do this in the 32-bit environment, it takes approximately 10 seconds.  In the 64-bit environment it takes more than 3 minutes. As a last resort I tried ngen before constructing the object, but this made no difference in the execution time.

how to change dynamically [Bbrowsable] attribute for a property at design time c#

hi,   how to change dynamically  [Browsable] attribute for a property  at design time c#

Should time date stamp on .Asmx file change when project is rebuilt?

I have a web service project. The web service is named Recalc.asmx and it has a code behind file namedRecalc.asmx.vb Now if I make a change to my web service .vb code and then recompile the project, should my Recalc.asmx filebe updated as well? In windows explorer I see that the time date stamp of my Racalc.asmx.vb file changes to the date of the last change.But the time date stamp of the Recalc.asmx file does not change? Why is that? My original thinking was that I would simply need to copy the Recalc.asmx file to the test server. But the date stillshows it's original creation date of 7/1/2010 and not the date of the last rebuild as I was hoping it would do?

OnWorkflowItemChanged fired more than one time for each change

I have a state machine workflow that runs without problem in SharePoint 2007. I wanted to have this in SharePoint 2010. I have created the same workflow using Visual Studio 2010, State Machine Workflow for SharePoint 2010 template. It runs ok, except that the OnWorkflowItemChanged is firing more than one time for each change. It is the same funtionality... same definition.  The only difference is the workflow is for SharePoint 2010. I created another state machine workflow, a simple one with two or more states that contain an EventDriven( with OnWorkflowItemChanged) and setState activities. No other activities are defined.  No tasks are created. I have associated this workflow to a Custom List that I created for this test. The workflow starts when an item is created (or manually), then I modify the item from the list and the OnWorkflowItemChanged is firing more than one time. The same situation ... the same problem. I realized that the event is triggered so many times the OnWorkflowItemChanged activity is defined in the workflow. i.e. If the workflow has defined three OnWorkflowItemChanged, the OnWorkflowItemChanged will be fired three times when an item is modified. Anyone have an idea how can I fix this problem? I would appreciate any suggestions to resolve this.  

Change value of particular cell in Grid view at run time.



I need to know that how i can edit the particular cell value in grid view at run time just by clicking it(value) then it shows text box and after enter any value, it then save in database.

Waiting for response.

Thanks in advance.

DBType change from compile time to run time. I am not using a view, it is against the oracle db I do


The OLE DB provider "OraOLEDB.Oracle" for linked server "SOMESERVER" supplied inconsistent metadata for a column. The column "ACTIONITEMID" (compile-time ordinal 1) of object ""SOMESERVER_Action"."AI_ACTIONITEM"" was reported to have a "DBTYPE" of 130 at compile time and 131 at run time.

change sub menu position dynamically using jquery



I have created horizontal menu like below...

<!--<ul id="topnav">
    <li><a href="#">Link 1</a></li>
    <li><a href="#">Link 2</a></li>
        <a href="#">Link 4</a>
            <a href="#">Subnav Link</a> |
            <a href="#">Subnav Link</a> |
            <a href="#">Subnav Link</a>
    <li><a href="#">Link 3</a></li>

problem is in my css i assigned margin-left:0px  for span.so all my sub navs align to left.but i want to align sub nav under the mail nav.means i need to change align-left property of css dynamically using jquery.

means first sub nav link should be below 'link4' not under 'link1'

so i added fol

Still about slow initialization time in WCF



A few days ago I was having problems with client WCF initialization time. I though I had solved the problem by removing the automatic proxy detection option but it seems like there are still some computers where the 1st call takes way to much time (and in those cases, the proxy configuration options are ok). So, I've profiled the application and I've noticed that it takes most of the time on the RealProxy.PrivateInvoke method:


42,92% Authenticate - 8113 ms - 1 call - Mercados.WinForms.Security.MercadosUserManager.Authenticate(String, String)   (from Mercados.WinForms.Security.IUserManager)
  18,39% PrivateInvoke - 3477 ms - 1 call - System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData &, Int32)
  13,80% ChannelFactory<TChannel>..ctor - 2608 ms - 1 call - System.ServiceModel.ChannelFactory<TChannel>..ctor(String)
  10,19% CreateChannel - 1926 ms - 1 call - System.ServiceModel.ChannelFactory<TChannel>.CreateChannel()
  0,39% Dispose - 74 ms - 1 call - System.ServiceModel.ChannelFactory.Dispose()   (from System.IDisposable)
  0,00% ObtemRoles - 0 ms - 1 call - Mercados.WinForms.Security.MercadosUserManager.ObtemRoles(TipoUtilizador)
  0,00% get_Credentials - 0 ms - 2 calls - System.ServiceModel.ChannelFactory.get_Credentials()

SSRS 2008 Time min change to hour


Hi there

I've got a problem in my report.


I have 2 colums "Expense" "Entity"


Expense has an issue 300 and entity min.

what i'd like is, that it change to 5 hours.

but it should issue min if expense is below an hour.


Any ideas?

One who can read, have a clear advantage!

Slow on data retrieval for the every 1st time


Hi all,

I had developed a POS system which connected to a local database (MS SQL SERVER EXPRESS 2005).

I'm facing an issue whereby after the cashier key in barcode, the description, price per unit will be displayed very slow for the every FIRST time. The susequent items will be very fast.

This happen when the system is idle for sometime. If continuous use, will not have this issue.

Any advise or setting i can do to improve this performance issue?




How can no-flicked listview change the highlight position quickly


I build a listview which can add and clear items quickly without flicked effect. I filter the EraseBackground message to acheive this purpose.I want to keep the selected item highlighted until I select another item.using the following code, I can acheive the result but having defects.

int selectedindex=-1;

private void ListViewNF_MouseClick(object sender, MouseEventArgs e)
            if (selectedindex != -1)
                cancelSelectedListitem = this.Items[selectedindex];
                if (selectedindex % 2 == 0)
                    cancelSelectedListitem.BackColor = Color.White;

Active X Control slow to load first time



I have an Active X control, which when first called or loaded in my asp.net application, is really slow to load. However, after the first load, it is really quick!!

My question is this, "How do I make my Active X control, when first called, load much faster? Is there away to preload the active x to the page so when it is used or called, it doesn't take so long to load?"

I have checked to see whether my active x is being called correctly by my javascript code, and it does. All my Active X does is to make a call to Outlook and to set some user properties. Not much.

Please help, but it has been doing my head in for days.

Scripting a change to Backup time



I have a backup plan defined in SQL Server that runs every night at 8PM. However sometimes I need to change this time to 5PM to allow a reboot of the server due to Windows updates. Some other tasks get rescheduled as well. I want to script this time change so that I do not need to manually change the backup time.

Is there a command line tool that will let me change the configuration of SQL Server? and specifically let me reschedule the time of the backup?

The scripts are written in Ruby not C#, this is fine as long as there is a command line tool.



.we each have more potential than we might ever presume to guess. (Blog: http://dsmyth.blogspot.com/)

SSAS Time Dimension (academic years, quarters) change over time


Apologies if I don't state teh question properly or am overlooking obvious answers - just started working with SSAS and barely beginner level.

I'm working on a cube to show student enrollments in different subject areas over time - for this purpose I'm only concerned about academic years and semesters.  In the underlying dimension table I have data like

1 2006          SUMMER  SUMMER 2006
2 2006          FALL  FALL 2006
3 2006          SPRING  SPRING 2007 (note that spring 2007 is part of the 2006 academic year)
4 2007          SUMMER  SUMMER 2007
5 2007          FALL  FALL 2007
6 2007          SPRING  SPRING 2008
and so on

I've set up a simple hierarchy with only two levels - ACAD YEAR->DESCR

For the cube I have one measure: 'Enrollments' which shows the sum of students who have enrolled

What I'd like to be able to do is show the f

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend