|
Unless you things byte by byte as you go.
|
|
|
|
|
So if the random byte you want to write matches the existing byte, select a different random byte? Oh there's a good use for clock cycles.
|
|
|
|
|
Meh, they never said anything about that!
|
|
|
|
|
They must have forgotten to. What if your random bytes just happen to all match the bytes to be wiped?
|
|
|
|
|
PIEBALDconsult wrote: What if your random bytes just happen to all match the bytes to be wiped?
I believe the error message would read "Woahhhh. Bummer dude."
|
|
|
|
|
I was going to said BSOD it but Pete's answer is much better.
|
|
|
|
|
Read back each byte [after you write it] to be sure it's the same as what you thought you wrote?
Seems fairly pointless to me; what do you do if it's not?
modified on Monday, January 07, 2008 4:05:57 PM
|
|
|
|
|
PIEBALDconsult wrote: what do you do if it's not?
As always, try a couple of times, and if it continues to fail, report the failure.
|
|
|
|
|
Keep trying different bytes until one matches?
|
|
|
|
|
Wow, this is why I like Codeproject, I go to sleep and when I wake up, theres all these suggestions to my question.
However I think this is the most logical answer...
|
|
|
|
|
Verify means to verify the data you wrote. Unfortunately, the way modern hard drives are designed the two algorithms are not effective at preventing physical scans of the drives as hard drives are recorded using an encoding scheme to maximize storage. Technically speaking an HDD can store less data as all 1's or all 0' than a random assortment.
The easiest method is to use a degausser that is Dod approved. If you were in the states I would name drop, www.data-assassins.com, which is one of my pet projects. We just degauss them using approved degaussers.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
And I suspect it would still only verify what's in the controller's cache, not what's actually on the platter.
|
|
|
|
|
Well that would be OS dependent, however, if you sent command directly to the controller I bet you could flush the cache? I bet you can even disable the cache on the HDD with a command. But again, thats why I say just degauss.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I try reading it but couldn't understand can somebody show me in basic manner how to use and where to use suspendedLayout function in C#.
|
|
|
|
|
Hi,
Some Controls show a collection of items (ListBox, ListView, TreeView, ...). If you add items
one by one then the Control has to update its content every time, since it never knows
whether your Add() is the last one; this may take a lot of time, and cause a lot of flicker.
To avoid these drawbacks, you can typically do two things:
- use AddRange() instead of Add() to group several additions, hence reducing the number
of redraws;
- use SuspendLayout() before, and ResumeLayout() after, the massive add operation.
The final result will be the same, the amount of time and screen disturbance will differ.
|
|
|
|
|
Thanks for answering, but this isn't same as invalidate(); or invalidate(true);
|
|
|
|
|
Hi,
you did not mention Invalidate() before. It has a completely different purpose: you
call it to tell GDI+ that something needs to be redrawn, e.g. because you have changed
the drawing parameters.
|
|
|
|
|
Sorry for not mentioning invalidate before. But the why should one call to invalidate rather than this.Refresh(); doesn't it redraw the control with the changed parameterize values
|
|
|
|
|
And now you start talking about Refresh; are you going to enumerate all the Control methods
one by one?
I have never used Refresh() and never felt the need to use it; I use Invalidate().
|
|
|
|
|
Hello Luc!
I also prefere using Invalidate(), mainly because of it's higher flexibility (additional parameters).
I think the only reason using Refresh(), which I can think of, would be if more than one GDI changing should be shown in one callstack.
Sometimes for that purpose, I see code where people use Invalidate() + DoEvents(), which I would count as bad practice. Here the usage of Refresh() would be much better.
All the best,
Martin
|
|
|
|
|
Hi Martin,
we agree on the subject of Refresh() and DoEvents().
I seldom use DoEvents, I mainly use it when a dialog gets closed before executing
a (short!) action in order to get the underlying form being redrawn as soon as possible
(so there is no risk of creating nested DoEvent calls).
PS: congrats on your diamond icon!
|
|
|
|
|
There are usually two stages to rendering controls on the form. The first is measurement and the second is rendering. When you add a control to the form it signals that the content has changed and it needs to recalculate everything. Once things have been measured the controls can be redrawn.
This has the downside that it's quite slow when adding lots of controls. What SuspendLayout and ResumeLayout offer is a way to halt re-calculating the layout of the form everytime a control is added, so if you know you're going to be adding a lot of controls you can half the recalculations and then only perform them once when you've finished adding the last one.
So:
this.SuspendLayout();
for (int i = 0; i < 1000; i++)
{
var textBox = new TextBox();
textBox.Size = new Size(120, 24);
textBox.Location = new Point(0, 24 * i);
this.Controls.Add(textBox);
}
this.ResumeLayout();
|
|
|
|
|
The following giving problems (I m using VC# express.) I get the MessageBox but after that, the application hangs up (on me). Can anyone help.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Drawing;
namespace Thread191
{
class Listing191AND192 : Form
{
Label lblInfo2 = new Label();
Button btStart = new Button();
public Listing191AND192()
{
Thread currThread = Thread.CurrentThread;
lblInfo2.Location = new Point(15, 10);
lblInfo2.Size = new Size(300, 100);
lblInfo2.Text = "Hi";
currThread.Name = "Main thread";
btStart.Location = new Point(300, 340);
btStart.Text = "Start";
btStart.Click += new EventHandler(this.StartIt);
this.Text = "Listing191";
this.Controls.Add(lblInfo2);
this.Controls.Add(btStart);
this.Size = new Size(800, 600);
}
void StartIt(object sender, EventArgs e)
{
lblInfo2.Text = "Thread 2 started from " + Thread.CurrentThread.Name + "...\n";
Thread thdTest = new Thread(new ThreadStart(DoIt));
thdTest.Name = "Thread 2";
thdTest.Start();
lblInfo2.Text += Thread.CurrentThread.Name + " sleepin....\n";
Thread.Sleep(2000);
lblInfo2.Text += Thread.CurrentThread.Name + " waking...\n";
thdTest.Join();
lblInfo2.Text += "Thread 2 ended...\n";
}
void DoIt()
{
Thread.Sleep(1000);
MessageBox.Show(Thread.CurrentThread.Name);
lblInfo2.Text += "Hello from " + Thread.CurrentThread.Name + "\n";
}
static void Main(string[] args)
{
Application.Run(new Listing191AND192());
}
}
}
|
|
|
|
|
You can't change UI controls on a thread other than the one that created it. Thus, setting the lblInfo2.Text inside DoIt() is what's causing the problem, since DoIt is being run on a thread other than the one that created the lblInfo2 control.
If you need to do background work and provide updates to the UI in response to some background work progress, have a look at the BackgroundWorker component.
|
|
|
|
|
but isn't thdTest.Join() supposed to make the currentThread wait until Thread 2 finishes with DoIt() method(including wrinting on lblInfo2).
|
|
|
|