|
Well, that seems straightforward enough. The only real issue you have to worry about is whether or not to make the algorithm run in parallel.
|
|
|
|
|
There are 7,958,661,109,946,400,884,391,936 (3616) of these permutations. Are you sure you want them all?
|
|
|
|
|
BobJanova wrote: There are 7,958,661,109,946,400,884,391,936 (3616) of these permutations combinations (with repetitions). Are you sure you want them all?
FTFY. There are 7,307,872,110 permutations.
Greetings - Jacek
|
|
|
|
|
Good point. But that's what the OP actually asked for, I got confused by his mistaken use of the word.
I still get 152,901,072,685,905,223,680,000 for permutations, though (36×35×...22×21).
|
|
|
|
|
Uhhh...what are you doing with this?? You can't store the list because there isn't a hard drive in existance that you can put in your machine that's THAT big. You're talking about a list (not including CRLF characters) of 7.9 trillion trillion bytes!
|
|
|
|
|
jojoba2011 wrote: what I want to do is I want to list every possible...
No you don't.
What you want to do is examine why you think you need that and re-evaluate that need. (The other answers should make it clear that it impossible.)
|
|
|
|
|
"Sarcasm is not welcome" in this forum, so I won't put any sarcasm here.
Greetings - Jacek
|
|
|
|
|
OK, seriously. I have a nasty feature: I like programming at 1 AM. Here is an enumerator which interates through all these combinations:
static void Main(string[] args)
{
foreach (string sperm in new PermutationEnumerator(2))
Console.WriteLine(sperm);
Console.ReadLine();
}
public class PermutationEnumerator : IEnumerator<string>, IEnumerable<string>
{
int stringLength;
char[] table;
char[] chars;
bool go = true;
public PermutationEnumerator(int stringLength)
{
chars = new char[36];
this.stringLength = stringLength;
for (char c = '0'; c <= '9'; c++)
chars[c - '0'] = c;
for (char c = 'A'; c <= 'Z'; c++)
chars[c - 'A' + 10] = c;
Reset();
}
public string Current
{
get
{
if (table == null || !go) return null;
return new string(table);
}
}
bool PlusOne(ref char c)
{
bool overflow = false;
if (c >= '0' && c < '9')
c = (char)(c + 1);
else if (c == '9')
c = 'A';
else if (c >= 'A' && c < 'Z')
c = (char)(c + 1);
else
{
c = '0';
overflow = true;
}
return overflow;
}
public void Dispose()
{
}
object System.Collections.IEnumerator.Current
{
get { return Current; }
}
public bool MoveNext()
{
if (table == null)
{
Init();
return table.Length > 0;
}
int i;
for (i = table.Length - 1; i >= 0; i--)
{
if (!PlusOne(ref table[i]))
break;
}
go = i >= 0;
return go;
}
public void Reset()
{
table = null;
}
void Init()
{
table = new char[stringLength];
for (int i = 0; i < stringLength; i++)
{
table[i] = chars[0];
}
}
void AddOne()
{
for (int i = table.Length - 1; i >= 0; i--)
{
if (!PlusOne(ref table[i]))
break;
}
}
public IEnumerator<string> GetEnumerator()
{
return this;
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
Greetings - Jacek
modified 23-Apr-12 18:41pm.
|
|
|
|
|
I created treeview and webbrowser control.When webbrowser control load website,treeview will buil DOM tree with checkbox node.So,I want press ctrl+mouse click to highlight one element(ex. div, span,...) on webbrowser,then node at treeview will be checked respectively. How can I do handle ctrl+mouse click on webbrowser control??
|
|
|
|
|
|
|
You're welcome.
Thank you for the response.
If you feel that the answer is helpful then you may consider to vote the answer.
|
|
|
|
|
By the way, I have one question.
I want to get data in tag when I ctrl+mouse click on webbrowser, for example
<div>abc...</div>. Then when I press ctrl+mouse click on webbrowser I will get abc...,
so how can I do that?
thanks!
|
|
|
|
|
Hi CodeProject, I'm looking for a C# class to create a GS-1 Databar, but that only ones I have found so far cost $300-1000! I am looking for an open source class which creates one, or a dll which doesn't cost $ and isn't just a limited time trial, since I'm broke.
I have no idea why it's so hard to find one of these, I'll even settle for a tutorial on how to code one myself but not even that I can find.
Please help and don't flame I've tried very hard to find one myself but couldn't.
|
|
|
|
|
No idea - but perhaps this article[^], along with the GS1 spec, will enable you to code one yourself?
|
|
|
|
|
thanks but they're are completely different. I coded my own UPC generator, but it is nothing compared to databars. I'll keep on the look out for learning how to code one myself but it doesn't look promising so far
|
|
|
|
|
I want to know how to open a .sln file from a c#.net application and to use it to count the lines of codes in the given program.
input - .sln file
out put - line count of the given file
|
|
|
|
|
.sln files are text (XML) files controlling solutions, they do not contain lines of code. However they do point to project files, which, in turn, point to source files which do contain code. Use a simple text file editor to look at the content of these files in order to figure out what you need to do.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Project files are XML, Solution files are not.
|
|
|
|
|
Quite right, I should have re-checked first. However, since they are still text files it's not too difficult to write a parser for them.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
|
If you have a VS 2010 then you can generate code metrics under an "Analyse" menu.
If not, you can download a free MS cmd line tool with exact the same functionality (Visual Studio Code Metrics PowerTool 10.0[^])
Greetings - Jacek
|
|
|
|
|
I want to retrieve the name of the database from a text box (datasource = txtdatabase.text), but the connection does not work.
the connection is made with the direct assignment of name database directly
cnx = new OleDbConnection ("Provider = Microsoft.Jet.OLEDB.4.0; Data Source = D: \ \ mabase.mdb");
class Connexion
{
static public OleDbConnection cnx;
static bool ok;
static public Boolean getConnexion()
{
if (cnx == null)
{
cnx = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+datasource);
try
{
cnx.Open();
ok = true;
}
catch (OleDbException)
{
ok = false;
}
}
return ok;
}
}
|
|
|
|
|
MemberDotNetting wrote: the connection does not work.
And you know that it does not work because....?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|