Quote:> You mentioned C# as a programming language. That is mostly for .NET
> developers. I am not aware of it being available for Linux
> development. What tools exist that allow you to program in C# for
> Linux?
The "Mono" project (Google will have no trouble pointing you to it)
provides a tool set to this end.
It works; this sorta does something...
using System;
using System.Data;
using Mono.Data.PostgreSqlClient;
public class Temperatures {
public const int Freezing = 0;
public const int Boiling = 100;
const int FCdiff = 32;
const int FCmfactor = 9;
const int FCdfactor = 4;
public static int celcius_to_fahrenheit (int cvalue) {
return ((cvalue * FCmfactor) / FCdfactor) + FCdiff;
}
public static int fahrenheit_to_celcius (int fvalue) {
return ((fvalue - FCdiff) * FCdfactor) / FCmfactor;
}
Quote:}
public class SQL {
public static void run_query () {
string commandString = "select description, amount from gncsummary where accountname = 'Rent'";
string connectString =
"Server=chvatal;" +
"User ID=cbbrowne;" +
"Database=gnucash";
System.Data.IDbConnection dbcon;
Console.WriteLine("Attach based on: " + connectString);
dbcon = new PgSqlConnection(connectString);
Console.WriteLine("created connection");
dbcon.Open();
Console.WriteLine("opened connection");
System.Data.IDbCommand dbcmd = dbcon.CreateCommand();
Console.WriteLine("set up command");
dbcmd.CommandText = commandString;
Console.WriteLine("assigned command");
IDataReader reader = dbcmd.ExecuteReader();
while (reader.Read()) {
Console.WriteLine("Description: " + reader["description"]);
Console.WriteLine("Amount: " + reader["amount"]);
}
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
Quote:}
class HelloWorld {
const float Pi = 3.1415926;
static void Main() {
// foo();
adjust();
ptemps ();
SQL.run_query ();
}
static void ptemps () {
Console.Write("-40F = what in C? ");
Console.WriteLine(Temperatures.fahrenheit_to_celcius(-40));
Console.Write("-40C = what in F? ");
Console.WriteLine(Temperatures.celcius_to_fahrenheit(-40));
Console.Write("Boiling in F?");
Console.WriteLine(Temperatures.celcius_to_fahrenheit(Temperatures.Boiling))
;
Console.Write("Freezing in F?");
Console.WriteLine(Temperatures.celcius_to_fahrenheit(Temperatures.Freezing));
}
static void adjust () {
int AnInteger = 7;
Console.Write("Initialize AnInteger to ");
Console.WriteLine(AnInteger);
AnInteger = 5;
Console.Write("Adjusted AnInteger to ");
Console.WriteLine(AnInteger);
}
static void foo () {
int i, j;
j = 0;
for (i = 0; i < 1000; i++) {
j++;
Console.Write(i);
Console.Write(" ");
if (j > 8) {
Console.WriteLine();
j = 0;
}
}
Console.WriteLine();
System.Console.WriteLine("Hello, world!");
}
Quote:}
Boy, that looks like Java...
Mono has _some_ merit over Java insofar as the "Java world" tempts you
into all sorts of highly proprietary extensions that potentially
require expensive licenses for extended versions of Java from
IBM/Sun/.... In contrast, Mono is available as free software, as are
any extensions thereof.
Quote:> Between PHP and Java, which of the two is more commonly used? I
> personally believe Java. Is that correct?
Hard to say.
PHP requires somewhat less esoteric sets of web server add-ins than
Java. There are probably more low-end web servers that run Apache +
(Python/Perl/PHP) than there are with Java.
Quote:> You didn't mention IBM's WebSphere for doing development work. Isn't
> that a popular development environment for Linux?
Very expensive stuff if you want to use it for _real_ work, so the
answer is "probably not."
It's very big, very resource-hungry, very "administrator-hungry," and
is Not Cheap. Draw your own conclusions from that. In contrast, PHP
and Perl and Python are unambiguously Free Software.
--
http://www3.sympatico.ca/cbbrowne/java.html
Long computations which yield zero are probably all for naught.