|
You cannot use an unsigned as an index, it must be signed. And you cannot compare a bit with the integer value zero. A bit can only be true or false . Change the loop code to
for (int count = 0; count < bits.Length; count++)
{
if (bits[count])
Console.Write(bits[count] ? "1" : "0");
}
|
|
|
|
|
I only need to evaluate if whether or not a "0" exist in the BitArray string. I dont care about the "1".
|
|
|
|
|
Then just test for false ; the BitArray[item] is a boolean value.
|
|
|
|
|
Should it be:
bool a = false;
a=bits[count];
if (a)
{
}
is this correct?
|
|
|
|
|
No, you should just be testing the specific bit:
if (!bits[count])
if (bits[count] == false)
However, having looked more closely at your code I am at a loss to understand what the program is supposed to do. In particular why you are reading those files and why you are writing new copies of them, or what any of that has to do with your for loops.
|
|
|
|
|
<pre>
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Applica
{
class Program
{
static void Main(string[] args)
{
DirectoryInfo da = new DirectoryInfo("C:\\Folder9");
FileInfo[] Arr = da.GetFiles();
if (Arr.Length == 0)
{
throw new InvalidOperationException("No files found.");
}
FileInfo ap = Arr[Arr.Length - 1];
long Totbyte = ap.Length;
string filePath = ap.FullName;
Console.WriteLine("Total Bytes = {0} bytes", Totbyte);
string temPath = Path.GetTempFileName();
byte[] data = File.ReadAllBytes(filePath);
File.WriteAllBytes(temPath, data);
byte[] dataB = new byte[1];
BitArray bits = new BitArray(dataB);
Console.WriteLine("length= {0}",bits.Length);
for (long counter = 0; counter < Totbyte; counter++)
{
dataB[0] = data[counter];
Console.WriteLine("{0}", dataB[0]);
for (int count = 0; count < bits.Length; count++)
{
if (bits[count] == true)
Console.WriteLine("{0}", bits[count]);
if (bits[count] == false)
Console.WriteLine("{0}", bits[count]);
}
}
}
}
}
|
|
|
|
|
computerpublic wrote: When I run 101 thru the BitArray, it evaluates all bits as false which is NOT CORRECT But the problem is that you do not run that value through it. Your code is:
byte[] dataB = new byte[1];
BitArray bits = new BitArray(dataB);
Console.WriteLine("length= {0}",bits.Length);
for (long counter = 0; counter < Totbyte; counter++)
{
dataB[0] = data[counter];
Console.WriteLine("{0}", dataB[0]);
for (int count = 0; count < bits.Length; count++)
{
if (bits[count] == true)
Console.WriteLine("{0}", bits[count]);
if (bits[count] == false)
Console.WriteLine("{0}", bits[count]);
}
}
It should be
byte[] dataB = new byte[1];
for (long counter = 0; counter < Totbyte; counter++)
{
dataB[0] = data[counter];
BitArray bits = new BitArray(dataB);
Console.WriteLine("length= {0}",bits.Length);
Console.WriteLine("{0}", dataB[0]);
for (int count = 0; count < bits.Length; count++)
{
Console.Write(bits[count] ? "1" : "0");
}
Console.WriteLine("");
}
|
|
|
|
|
I am noticing that the programs default operation is to evaluate the Most Significant Bit First and it evaluates the Least Significant Bit Last. I was not expecting this behavior. This this always the case the default case? Can I change the default operation to do LSB to MSB?
|
|
|
|
|
|
hi,
a couple of days ago I was browsing the net looking for appicons and I accidently came across to alink of 700 app icons that worth 194MB download. but suddenly I exit the browser and couldn't find the link afterwards.
I was wondering is any one here knows this link worth of 700Icons ( I believe its open source level icons but Im not sure) or any link which gives me a direct download of icons
im particularly looking for 16x16, 24 x 24, 32 x 32, 64 x 64 ...
thanks
|
|
|
|
|
What has this got to do with C#? Why not just look through your browser history?
|
|
|
|
|
Pete O'Hanlon wrote: What has this got to do with C#?
It's a custom built browser written in C# and history feature is not working.
|
|
|
|
|
|
|
Hi.
I want to redirect URLs entered in the browser to a page On PC?
for example when I enter "http://microsoft.com",it redirect to 127.0.0.1:5000/webpage.html and show this page. I want to do this for all website entered.
|
|
|
|
|
Do not post the same question in two places. It wastes effort and annoys people.
You have posted this in QA, leave it there.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
OriginalGriff wrote: It wastes effort and annoys me.
FTFY
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Edit your hosts[^] file.
/ravi
|
|
|
|
|
Will not work for "every" site, as the hosts file doesn't accept wildcards.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
aminsoltani wrote: I want to redirect URLs entered in the browser to a page On PC? Install a proxy, and use only that proxy to connect to the outside world.
It's either that or writing your own firewall; A proxy will only be usefull if you own the network, and a virusscanner only if you own the clients. And yes, it might break a lot of websites using SSL, as should be.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I should to solve next task:
RECOGNITION OF EMOTIONAL EXPRESSIONS ON HUMAN FACES
IN DIGITAL IMAGES
1. Results
1.1 Limitations of implementation
1.2. Training (learning) set (in the case of the learning based method)
1.3. Testing set and corresponding visual results of recognition
1.4. Analysis (correctness of recognition, problems, speed – is it fast enough for real time interactive foreign language learning)
How could I solve this task?
Is backpropagation learning algorithm good approach for this?
How to start preprocessing and so on.
|
|
|
|
|
Google for "image recognition", there are many resources around to guide you.
|
|
|
|
|
Member 9538830 wrote: How could I solve this task? You won't get that "answer" in a forum, as there is no answer. It's a complete topic.
Member 9538830 wrote: Is backpropagation learning algorithm good approach for this? There's a lot more out there[^].
Member 9538830 wrote: speed – is it fast enough for real time interactive foreign language learning) No, it's not.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am doing a project on retrieving similar face images from a folder by giving a query face image and but the results are not satisfactory. I taught if I crop the images to its face and then search the results might be better. but I am having trouble in cropping multiple images since a folder might contain multiple images. I need help on that.....?
|
|
|
|
|