|
.net is not directly supported on Linux by Microsoft.
Take a look at the Mono project[^]. They are attempting to implement the CLR and large parts of the framework on Linux. Currently they have a lot of good support for .net 2.0, but some of the 3.5 stuff is still catching up. It depends on what your app uses.
Also see - http://en.wikipedia.org/wiki/Mono_(software)[^]
Simon
|
|
|
|
|
We have a software developed using DotNet 2.0. The problem we are facing is there are certain areas where customers require changes according to their business needs. These change in turn makes us to change the code and cater their requirements. Lets take an example of employee entrance at their office:
Client 1:
Activity 1. Employees swipe their card and enter.
Activity 2. Have tea/coffee.
Activity 3. Start work.
Client 2:
Activity 1. Employee enter their names and time-in manually.
Activity 2. Start Work.
Client 3:
Activity 1. Employees do not perform any check-in.
Activity 2. Have Breakfast.
Activity 3. Start Work.
My question is that if there is any approach where we can handle these changing requirements. The activities involved in these requirements like the example above do change for every customer. These activities can either increase/decrease in number or change entirely.
Thanks.
|
|
|
|
|
|
I'm somewhat hesitating about using nested try/catch blocks.
The situation which makes me think about is the following situation. Some sample code to illustrate:
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlTransaction trans = conn.BeginTransaction();
try
{
string query = "query goes here";
SqlCommand command = new SqlCommand(query, conn, trans);
command.ExecuteNonQuery();
trans.Commit();
}
catch
{
trans.Rollback();
}
finally
{
if(conn != null)
{
conn.Close();
conn.Dispose();
}
}
This block has 1 try/catch block but the problem resides in the "conn.Open();" line. When there is a network error the conn.Open() will throw an exception. Putting the conn.Open() in the try/catch block will invalidate the code which now resides in the catch/finally clauses.
So I can use 2 sequential try/catch blocks or a nexted construction. What do you people think?
The consumer isn't a moron; she is your wife.
|
|
|
|
|
It won't invalidate anything. You can just put an (if conn != null) type block at the start of the second try/catch, and then your finally block will work fine. Indeed, command.ExecuteNonQuery would just force the catch and finally, if conn was null. I'm also not sure why conn couldn't be in the existing try block, just declare trans outside it, and begin it, inside.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Ah yes, you're right. That would make it a viable solution indeed.
*reminds himself not to start coding too early in the morning*
The consumer isn't a moron; she is your wife.
|
|
|
|
|
Helfdane wrote: reminds himself not to start coding too early in the morning
The best time is after but before
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
That would mean my evening diner as I'm sitting next to the coffee machine
The consumer isn't a moron; she is your wife.
|
|
|
|
|
Christian Graus wrote: I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
Now I've seen everything!
Cheers,
Vikram. Recent activities:
TV series: Friends, season 8
Books: Freakonomics, by Steven Levitt and Stephen J Dubner. Carpe Diem.
|
|
|
|
|
Sequencial try/catches would be better. Something like:
SqlConnection conn;
SqlTransaction trans;
try {
conn = new SqlConnection(connectionString);
conn.Open();
SqlTransaction trans = conn.BeginTransaction();
}
catch (SomeTypeOfException ex) {
}
finally {
if (conn != null) {
conn.Close();
conn.Dispose();
}
}
if (trans != null) {
try {
string query = "query goes here";
SqlCommand command = new SqlCommand(query, conn, trans);
command.ExecuteNonQuery();
trans.Commit();
}
catch (SomeOtherException ex) {
trans.Rollback();
}
finally {
if (conn != null) {
conn.Close();
conn.Dispose();
}
}
}
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
For the situation above, Christian Graus gave a good hint on a potential solution, and so do you. But in general, why is sequential better than nested?
The consumer isn't a moron; she is your wife.
|
|
|
|
|
You put a try catch around the possible/probable points of failure and catch SPECIFIC errors. Catch and ignore is, generally, not a good idea. Ignoring a specific case can be okay so long as you impliment a valid recovery.
ps. as pointed out the first finally is cr@p.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
doesn't the first finally block close the connection resulting in exception when trying to execute a query in the second try block; and since the second catch block also uses Rollback , doesn't that throw another exception every time the function is called!
regards
|
|
|
|
|
I didn't say it was perfect.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Or both?
|
|
|
|
|
Hi
there are some images in my listview.when i click a particular image it should be displayed in the picture box. i am new in this field pls help me.
|
|
|
|
|
How did the images get into the listview ? What have you tried ? It should be pretty trivial, but it's hard to know, without knowing what form the images take, are they icons, or are they the actual items in a styled view ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
actually what i am trying to do is something like winexplorer.I can select a folder(contains image files)using treeview.then the images from that particular folder is displayed in the listview not as icons but as the image itself.I have placed a picture box and when I select(or click-want this in the mouse-click event)an image it should be displayed in the picture box.
|
|
|
|
|
Hi
I am Creating a windows application, in that i want to show the Employee performance
by Graph........
I don't know how to include Graph in my application..
Pls Help me
Thanks in Advance
|
|
|
|
|
|
Thank You
|
|
|
|
|
As the title has stated ?
is there a way to do that using C# ?
using iReport to create the template of the report and able to print out in different printers without letting the alignment run out and be in position.
|
|
|
|
|
Dear All,
I have developed C# application to import data from CSV to SQL Server
using sqlBulkCopy. However I am facing couple of problems listed below
1. whole transfer fails when one record has column width issue (source column width is 30 and destination is 20) so how could I eliminate this row? or is there any work around?
2. my destination table has insert trigger defined. How could I manage to execute it as sqlbulkcopy dumps the whole bunch of records and not one by one record?
3. One column in destination table is computed column and is not included in the transfer, but the dependent column is included in source file (based on this column, computed column fills it data, while normal insert) but how do I fill values in computed column while dumping whole bunch of records?
4. If CDC(change data capture) is enabled on my target table, how SQLBulkCopy can log the data changes in the same?
regards
Jeet
|
|
|
|
|
With all that crap on your destination table and also the wrong data structure you are not going to be able to use bulkcopy. Bulkcopy is designed to move data quickly, therefore it bypasses the bulk of the nice processing of a normal insert.
1 is a showstopper and immediatley tells me you cannot use this
2 same as 1 - triggers don't fire
3 same as 1 - all the cutesy processing is eliminated by BC
4 blah WHY are you using bulkcopy (for speed) and bitching about it avoiding all your speed bumps.
Suggestion - load your data into a staging table that will accept everything (varchar fields), this takes care of getting the data to the server with no possible interuptions or failures.
Now use a stored proc to insert the records into the target table, making sure the data conforms to the table design. You get some benifit from BC and a proc without haveing to insert each row from the UI.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In the msdn page [^]
it says "When a member of a class or struct is a property, field, method, event, or delegate, and that member either is a type or has a type as a parameter or return value, the accessibility of the member cannot be greater than the type. For example, you cannot have a public method M that returns a class C unless C is also public. Likewise, you cannot have a protected property of type A if A is declared as private. "
But in this code
class AccessSpecifier
{
private int wheels = 3;
protected internal int Wheels
{
get { return wheels; }
set { wheels = value; }
}
}
class Derieved : AccessSpecifier
{
public void fun()
{
Wheels = 90;
}
}
class main
{
public static void Main()
{
AccessSpecifier a = new AccessSpecifier();
a.Wheels = 4;
Console.WriteLine(a.Wheels);
Derieved d = new Derieved();
d.fun();
Console.WriteLine(d.Wheels);
d.Wheels = 99;
Console.WriteLine(d.Wheels);
Console.ReadKey();
}
}
How is this possible to access private members of a class jus becoz the property of the field is made protected internal ? And compiler is against the lines given in MSDN? Can u pls explain ?
|
|
|
|