|
A non C# solution - you might want to try and use Comet notifications[^].
|
|
|
|
|
Hi all, I am trying to create a method that allows users to convert a Word document to other kinds of files like PDFs, text files, etc., and that means using Word library and Word components. These need the Office Interop Word Assembly to work and I heard that hosting companies won't install it for you because of the licensing fee and they won't let you install it on their web server unless you sign up for a dedicated server. Are there open source alternatives out there that I can use? Thanks in advance.
modified 17-Sep-12 11:17am.
|
|
|
|
|
Yes, you can use the OpenOffice API for .NET to manipulate Office docs programmatically. I've used it before, and it works.
However, if you do decide to use it, be warned: it's not easy, and it's very poorly documented, not to mention intuitive. But if you do get it working, it's a wonder.
Good luck!
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Sounds like something that would be well worth reading as an article.
|
|
|
|
|
I would actually post it, if I'd remember how to do it. I may be able to dig the source though. Nice idea though, I was actually thinking about an article on automating some stuff, although not Office files. Thanks for the idea!
Full-fledged Java/.NET lover, full-fledged PHP hater.
Full-fledged Google/Microsoft lover, full-fledged Apple hater.
Full-fledged Skype lover, full-fledged YM hater.
|
|
|
|
|
Hello friends
I am practicing C# by solving the Problems in projecteuler.net. Now I am working on 20th one.
I create a project and here it is my code:
const int number = 100;
double fact = Library.Math.Fact(number);
BigInteger bigInteger = new BigInteger(fact);
int sum = 0;
while (bigInteger > 0)
{
sum += (int)(bigInteger % 10);
bigInteger /= 10;
}
Console.WriteLine("Sum of the digits int the number {0}! is {1}", number, sum);
static double Fact(int number)
{
return number == 1 ? 1 : number * Fact(number - 1);
}
It is absolutely fine, isn't it?
I have tried the small number that I can calculate manually and the result given was correct. But when I give to the site the rsult of my code it doesn't accept the answer.
What's wrong with my code?
modified 18-Sep-12 9:40am.
|
|
|
|
|
Meysam Tolouee wrote: It is absolutely fine, isn't it?
Depends on how you define "fine".
Well first, your recursive alogorithms could be an iterative one, that would be even finer.
Next: for large number you round, because the precision of double may be not good enough. So there are rounding error for large numbers.
By the way, I didn't downvote you and I wonder why someone did.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
I just changed the output of method Fact() from double to BigInteger.
Now it really works fine.
Fine means it gives me true result.
|
|
|
|
|
Meysam Tolouee wrote: Now it really works fine.
Fine means it gives me true result.
Ok, if it's fine for you, it's fine for me, too
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
ihoecken wrote: By the way, I didn't downvote you and I wonder why someone did.
I've just counter-voted, but I have a suspicion as to why he was univoted.
|
|
|
|
|
I'd disapprove it because it uses recursion where none is necessary. But that's just me.
|
|
|
|
|
Well, that's the effect of how we're taught recursion in schools and colleges - using examples where recursion is unnecessary (e.g. finding the factorial of a number).
|
|
|
|
|
I know. I know.
And were I teaching it I'd have to do the same, but I'd then show the iterative alternative.
"Recursion is a very powerful programming technique that is best avoided whenever possible."
|
|
|
|
|
I still it funny that when recursion is taught in school they may just touch on the the effect this has on the stack, or even what the stack is!
Then all the noobs are scratching their heads when they see "Stack Overflow" errors.
|
|
|
|
|
if you are trying to determine the number of digits, this will not work;
sum += (int)(bigInteger % 10);
What you need is:
sum++;
What you had was the sum of the digits, not the number of digits. I cannot understand why somebody wants the sum of digits, really does not tell you anything usefull. The number of digits does.
|
|
|
|
|
Actually I didn't want to count the digits. I wanted to sum the digits and I did.
As I said that website is full of Problems that their purpose is practicing.
They doesn't need to make sense.
|
|
|
|
|
Two thread concurrently
but in a certain state of thread A need to wait the process result from thread B
how can i do it???
|
|
|
|
|
You can call the Join method family which you'll find here[^]. This means of course that thread A, the thread that wants to wait for thread B, must have access to the thread B instance, so it can call the Join() method on it.
Regards,
— Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Thanks a lot Manfred R.Bihy
|
|
|
|
|
I am creating a List of structure like:
List<MyNS.Graph.XY_AXIS> Axis = new List<MyNS.Graph.XY_AXIS>(); but I need to create array of such object dynamically.
I am new to C# so got stuck.Please guide .
|
|
|
|
|
How dynamic do you want it?
List<MyNS.Graph.XY_AXIS> Axis = new List<MyNS.Graph.XY_AXIS>();
Axis.Add(X,Y);
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks but I need array of Axis. I need to create an array of List say 10, each List element will be object of class. How to do that?
|
|
|
|
|
Use the ToArray() method of the list after you added all the items.
|
|
|
|
|
john5632 wrote: I need to create array of such object
You question is ambiguous. An array of the list or an array out of the list?
If you want to create an array of the list, you can probably use a List of List like this:
List<List<MyNS.Graph.XY_AXIS>> Axis = new List<List<MyNS.Graph.XY_AXIS>>();
If you wish to create an array out of the list, then use:
MyNS.Graph.XY_AXIS[] axisArray = Axis.ToArray();
|
|
|
|
|
Hello CP,
I've run into a problem while working on an interface for the result of raw SQL.
The user inputs the raw SQL code and the form renders a result, it's an educational piece of software so nothing too fancy.
Now, the problem I have is that after putting the result into a DataTable, it crashes when I pass it as a DataSource for the DataGridView.
The database I'm querying is an MSAccess (2003, mdb) database.
Oddly enough, it doesn't misbehave (crash) when I'm using an SQLite database.
I would like some help since the stacktrace isn't making sense to me.
Quote: A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll
System.Transactions Critical: 0 : <tracerecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" severity="Critical"><traceidentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled<description>Unhandled exception<appdomain>SimpelQL.Net.vshost.exe<exception><exceptiontype>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089<message>Parameter is not valid.<stacktrace> at System.Drawing.Font.GetHeight(Graphics graphics)
at System.Drawing.Font.GetHeight()
at System.Drawing.Font.get_Height()
at System.Windows.Forms.DataGridViewRow..ctor()
at System.Windows.Forms.DataGridView.get_RowTemplateClone()
at System.Windows.Forms.DataGridView.RefreshRows(Boolean scrollIntoView)
at System.Windows.Forms.DataGridView.RefreshColumnsAndRows()
at System.Windows.Forms.DataGridView.OnDataSourceChanged(EventArgs e)
at System.Windows.Forms.DataGridView.set_DataSource(Object value)
at Proj.Net.MainForm.evt_Exec(Object sender, EventArgs e) in L:\Dev\Proj.Net\MainForm.cs:line 139
The first rule of CListCtrl is you do not talk about CListCtrl - kornman
|
|
|
|