|
If you really want #90 raised to the 18th. power, you are going to need to use a "big integer:"
1. assuming you are using .NET >= 4.0
2. add a reference to your project to the System.Numerics library.
using System.Numerics;
public BigInteger ToBigPower(BigInteger value, int power)
{
return BigInteger.Pow(value, power);
}
BigInteger x = ToBigPower(9*10, 18); If you inspect the value of 'x above in the Command window of Visual Studio:
> ? x
{150094635296999121000000000000000000}
IsEven: true
IsOne: false
IsPowerOfTwo: false
IsZero: false
Sign: 1
If you are using .NET < 4.0, see this for links to alternate strategies: [^]
“Use the word 'cybernetics,' Norbert, because nobody knows what it means. This will always put you at an advantage in arguments.” Claude Shannon (Information Theory scientist): letter to Norbert Weiner of M.I.T., circa 1940
|
|
|
|
|
BillWoodruff wrote: If you really want #90 raised to the 18th. power, I think he wants 9 × (10<sup>18</sup>) , not (9 × 10)<sup>18</sup> .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am looking for a zip compression library that supports pausing/aborting the compression and then resuming the compression. I know this is a bit unorthodox when it comes to zip compression but currently I have an issue with my software especially when compressing large files > 100GB in size. I am not sure if it is possible at all to implement this kind of functionality taking into account the archive checksum and all.
Currently I am using DotNetZip and it does not support this functionality.
Actually I don't mind switching from Zip format to some other format if it supports aborting/resuming compression.
EDIT:
Just to be clear what I meant by pausing is that the application is terminated and once it is restarted it continues the compression operation from where it left off or from the last successfully compressed index.
|
|
|
|
|
I don't know of a single library that allows for "pausing" the operation.
I think the only way you're going to get that is if you implemented such a compression scheme yourself.
|
|
|
|
|
REDSERPENT7 wrote: the application is terminated Voluntarily (with a chance to make some kind of "save point") or abruptly?
|
|
|
|
|
|
The ability to resume after abrupt termination is also quite sought-after though
But ok, that simplifies things. All you have to do is save enough of the state of the compressor so that you can load it again - basically, dump the data structures it's using in a file (or wherever you want to leave it). While the compression libraries I know up don't immediately support that, it should be possible to modify them (the ones that come with source, anyway) so that they do.
What you'd actually have to save depends on the compressor, but it might include:
- the index you were at (for input and output)
- the current block type (stored, dynamic tree, static tree), not all of the following will exist for stored blocks
- a chained hash table, used to find back-references (saving is optional, skipping it means worse compression ratio's if you pause/resume)
- a small buffer used to write bits to an underlying system that deals in bytes. May contain more than 7 bits, depends on the implementation
- a table of symbol lengths and symbol patterns, something like 286 entries or so. Doesn't necessarily exist all the time (for example at the start of a block when the compressor doesn't know enough about the symbol frequencies yet)
- misc stuff, and things I've forgotten to mention. And anyway, this covers just the Deflate end of the business, for full ZIP there's more to worry about.
|
|
|
|
|
Theoretically, the naive solution would be to use a library that supports adding to an existing zip. You can do this[^] with SharpZipLib[^].
|
|
|
|
|
REDSERPENT7 wrote: EDIT:
Just to be clear what I meant by pausing is that the application is terminated and once it is restarted it continues the compression operation from where it left off or from the last successfully compressed index.
Imagine you closing your app, and one of the libraries deciding to run on it's own after the PC restarts.
..so, no go. When you write a byte to your stream, increase a counter, write that counter to a file. When restarting, fast-forward the stream to the last known position.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
i want to remove specific row from datatable means every row has a remove button.. through click i want to remove that row.. Datatable record is yet not saved to database.....??
plz help........?
modified 2-Apr-14 4:04am.
|
|
|
|
|
|
I think he's looking for some help on one of them weird ASP.NET grids; not the datatable itself.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I agree, but like so many people here these days, he/she does not seem to know what control he is actually using to start with.
|
|
|
|
|
i want to shutdown a computer on Lan using C#
plzzzz help me...
|
|
|
|
|
shutdown /s /m \\computername That's the commandline for doing so; if you need to do it from C#, call it via System.Diagnostics.Process.Start() .
|
|
|
|
|
But in window form, button Shutdown, Reboot in server are not shutdown,reboot client.
|
|
|
|
|
What are you talking about?? The shutdown command line works the same whether the target it a server or a workstation.
|
|
|
|
|
Hi Friends,
I am in situation to develop a custom plugin that communicate to the windows application from web application. Also, that developed plugin need to install automatically, when I view the web application.
I have implemented the desktop application to communicate the dictaphone device. Also, I have implemented the web application in MVC4.
I want to communicate some data from web application to desktop application. Whenever a button pressed in web application, some data needs to pass to the desktop application.
I have tried to do the same by using the database and it works fine but it slows the performance.
Could you please let me know if you have any thoughts or solutions to achieve this?
|
|
|
|
|
Here is what i did so far. The problem is if a conjunction appears twice in the sentence the code doesnt work for the 2nd appearance of the conjunction. plz if any expert can help ?
private void SplitSentence_Click(object sender, EventArgs e)
{
richTextBox2.Text = "";
richTextBox3.Text = "";
string[] keywords = { " or ", " and ", " hence", "so that", "however", " because" };
string[] sentences = SentenceTokenizer(richTextBox1.Text);
string remSentence;
foreach (string sentence in sentences)
{
remSentence = sentence;
richTextBox3.Text = remSentence;
for (int i =0; i < keywords.Length; i++)
{
if ((remSentence.Contains(keywords[i])))// || (remSentence.IndexOf(keywords[i]) > 0))
{
richTextBox2.Text += remSentence.Substring(0, remSentence.IndexOf(keywords[i])) + '\n' + keywords[i] + '\n';
remSentence = remSentence.Substring(remSentence.IndexOf(keywords[i]) + keywords[i].Length);
}
}
richTextBox2.Text += remSentence;
}
}
public static string[] SentenceTokenizer(string text)
{
char[] sentdelimiters = new char[] { '.', '?', '۔', '؟', '\r', ':', '-' }; // '{ ',' }', '( ', ' )', ' [', ']', '>', '<','-', '_', '= ', '+','|', '\\', ':', ';', ' ', '\'', ',', '.', '/', '?', '~', '!','@', '#', '$', '%', '^', '&', '*', ' ', '\r', '\n', '\t'};
// text.Remove('\n');
return text.Split(sentdelimiters, StringSplitOptions.RemoveEmptyEntries);
}
|
|
|
|
|
|
here is what i did using regex. it works well. But doing this way, Splitting with regex, i lost the control over the word "and" for further processing. I have a lexicon of 20 words that normally appears before the "and (اور)" in urdu language. In next step I want to have a way to check the word before "and" against the lexicon and if found the sentence is broken else display the complete sentence.
private void button1_Click(object sender, EventArgs e)
{
{
richTextBox2.Text = "";
richTextBox3.Text = "";
string[] sentences = SentenceTokenizer(richTextBox1.Text);
string remSentence;
// these are urdu conjunctions. i am actually working on urdu language.
Regex r = new Regex("(کہ |اور | تاکہ| مگر | تاہم | کیونکہ | لیکن )");
foreach (string sentence in sentences)
{
remSentence = sentence;
remSentence = r.Replace(remSentence, "|");
string[] phrases = remSentence.Split('|');
for (int i = 0; i < phrases.Length; i++)
{
richTextBox2.Text += phrases[i] + '\n';
}
}
}
}
|
|
|
|
|
if ((remSentence.Contains(keywords[i]))) That's the position your trouble starts: you execute it once only regardless of the number of occurrences. You'll better use a function to split the sentence, and apply that function recursively on the resulting sub-sentences.
And yes: Regular Expressions are preferred.
|
|
|
|
|
here is what i did using regex. it works well. But doing this way, Splitting with regex, i lost the control over the word "and" for further processing. I have a lexicon of 20 words that normally appears before the "and (اور)" in urdu language. In next step I want to have a way to check the word before "and" against the lexicon and if found the sentence is broken else display the complete sentence.
private void button1_Click(object sender, EventArgs e)
{
{
richTextBox2.Text = "";
richTextBox3.Text = "";
string[] sentences = SentenceTokenizer(richTextBox1.Text);
string remSentence;
// these are urdu conjunctions. i am actually working on urdu language.
Regex r = new Regex("(کہ |اور | تاکہ| مگر | تاہم | کیونکہ | لیکن )");
foreach (string sentence in sentences)
{
remSentence = sentence;
remSentence = r.Replace(remSentence, "|");
string[] phrases = remSentence.Split('|');
for (int i = 0; i < phrases.Length; i++)
{
richTextBox2.Text += phrases[i] + '\n';
}
}
}
}
|
|
|
|
|
would you plz share some coded modification?
-- modified 2-Apr-14 5:26am.
|
|
|
|
|
I am not Bernhard Hiller.
All the label says is that this stuff contains chemicals "... known to the State of California to cause cancer in rats and low-income test subjects." Roger Wright http://www.codeproject.com/lounge.asp?select=965687&exp=5&fr=1#xx965687xx
|
|
|
|
|