|
Smalltalk (as the author references) requires that all objects inherit from another object, and new objects are added to the tree. Based on my experiences (surface only) with Smalltalk part of the weakness comes in where a problem in one object causes a cascading failure throughout all objects in the tree. So, for example, you have a message object that contains a collection of messages. If you add a new message but do not explicitely tell that message object it has a new object, it will fail and the object it inherited from fails, and the one that inherited from it fails, etc. There is no way to gracefully handle a failure like that.
C++ does not require that you inherit from anything....however you also need either a header file or write your own for everything you want to do.
C# provides inheritance where it starts by inheriting from Object. However you also have a framework that supports the ability to handle a graceful failure in the heirarchy.
This actually sounds like an old article explaining why Smalltalk is bad. There was a time when that language was the only OO language in existance. But future languages improve upon the basics to provide a richer environment and better behaviour.
|
|
|
|
|
Hey all!
I have implemented a forms designer, with a toolbar and propertygrid etc. It all works well and I have move, resize and add controls to the designer host. I am constructing sort of a monitoring application with graphs and gauges etc. My plan for this application was to let the user enter "design mode" where he/she can choose what controls to show and customize them using the forms designer. When satisfied, the user should be able to switch back to "run mode" where all the designer-related behavior/properties is hidden and the controls acts like normal controls (not in DesignMode).
How do I achieve this? Anyone has some tips of how to do this? Simply, I have a bunch of controls in DesignMode, I want to be able to toggle them between designmode and run-mode.
Any help would be very appreciated!
Best regards,
Peter
|
|
|
|
|
Reading the elements you describe, it seems that what you need is a runtime environment that is interpretive rather than compiled. The runtime manageer would contain the forms and expose a an element for switching between execution mode and design mode.
The runtime manager would then change the containing class as it moves between runmode and designmode. The containing class would be like an MDI container with the toolbox and property grid as decorators in the designmode view of the container.
The hard part will be coming up with a way to represent this stuff and interpret it and then display it in a reasonable level of response time.
-- modified at 15:20 Friday 28th July, 2006
|
|
|
|
|
What can I use instead of struct to store little info? I want create instances, put them in a dictionary, iterate and modify elements in the dictionary. I know every addition will involve a boxing operation, and every modification will involve an unboxing followed by a boxing operation. What is the best thing to do?
|
|
|
|
|
Use .NET 2.0 with generics to allieviate the boxing involved. If you don't have .NET 2.0 ask yourself just how many elements you will be boxing an unboxing. In business apps the difference between 1ms and 3ms is very small. If you are modifying extremely large sets maybe C# is the wrong language. Also, consider your dictionary as a source of problems. If you are iterating a dictionary may be the wrong structure since lists are efficient in this respect.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Could you please explain what you mean by this - "Use .NET 2.0 with generics". What generics are you talking about?
|
|
|
|
|
Instead of defining a struct you should define a class.
public class MySpecialData
{
private bool isDataDirty;
public bool IsDataDirty { get{ return isDataDirty; } }
private string someValue;
public string SomeValue
{
get { return someValue; }
set { someValue = value; }
}
public int GetHashcode(){}
}
Now it was a known issue that collections of data (even strong typed collections) bring in boxing and downcasting/upcasting issues. Visual Studio 2005 and the 2.0 .NET Framework solve that by using what is called Generics. This moves your collection definition from runtime to compile time. As such your collection is now fully strong typed and no boxing occurs.
public class MySpecialDataCollection : Dictionary< int, MySpecialData> {}
The statement above uses generics....and that is all you need define for a fully functional collection. When you compile your program, the dictionary expects a key of type int and data of type MySpecialData. So at execute time, you do not have any boxing or downcasting occuring at all!!!
Then to use it, it is as any other dictionary:
MySpecialDataCollection list = new MySpecialDataCollection();
foreach (Twizzle element in MyTwizzleCollection )
{
list.Add( element.SpecialObject.GetHashcode(), element.SpecialObject);
}
|
|
|
|
|
I've created an application using VS2005 Express using SQLServer 2005 express. Now the fun bit. How do I create an installation program that installs the SQLServer Express runtime, my application SQLServer express database on a server and update my client connection strings to the database???
Regards,
|
|
|
|
|
Hello,
what i have is this
foreach( FileInfo f in di.GetFiles("*.txt"))
{
//do something
}
foreach( FileInfo f in di.GetFiles("*.log"))
{
//do the same thing
}
what i wan't is this
foreach( FileInfo f in di.GetFiles("*.txt, *.log"))
{
//do something
}
but di.GetFiles("*.txt, *.log") returns nothing.
can i put in a RegEx or something?
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
Nope, you're pretty limited in this regard. Maybe an alternative is to pair up the collections:
List<FileInfo> lst = new List<FileInfo>();
lst.AddRange(di.GetFiles("*.txt"));
lst.AddRange(di.GetFiles("*.log"));
foreach (FileInfo fi in lst) { ... }</FileInfo></FileInfo>
If you want them to be in a particular order, then you can just call Sort() .
Logifusion[^]
|
|
|
|
|
Setteled on this
foreach( string f in Directory.GetFiles(_ControleFileBucket))
{
if( f.EndsWith("*." + CDoc.EmailCF) || f.EndsWith("*." + CDoc.FaxCF)||f.EndsWith("*." + CDoc.GMailCF))
{ ...
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
Hello,
I am trying to do logging to SQL Server 2000 database by using Database Trace Listener. The problem I have is very strange:
Scenario1:
I have SQLExpress installed on my machine and I was able to achive logging in database in this scenario where I was using integrated security I I got all the desired value in tables; such as Log, Category etc.
Scenario2:
I furtured my experiment by doing logging on SQL Server 2000 which is installed on a seperate machine but within the domain where my machine is registered as well. After I got done creating tables and stored procedure in already made database. When ever I tried to do logging in the database nothing happens, no data get populated in Data tables such as Category, Log etc. I tried using integrated security after impersonating my application to an administrator accout, I tried by making connection string by using "sa" account. Nothing is working..
Can somebody give me any clue?
Thanks in advance
|
|
|
|
|
Hi
My app has a Wizard like interface that has 4 pages.
I have created a phone class in this app. On the second page, depending on user's selection I have to instantiate either a digital phone class or normal phone class(Both inherite from parent phone class)
I instantiate the appropirate class and set all the properties in the "Leave" event of second page, and I use the "Enter" event of third page to use these values.
The problem is how can I tell the third page,which class to instantiate and how can I transfer these values(class properties on second page) to third page.
I am thinking may be the phone class has to be a singleton so that whenever it is instantiated I get the first instance each and everytime.
Is there a better way of communicating data between pages?
Thanks,
|
|
|
|
|
jerrymei wrote: Is there a better way of communicating data between pages?
MVC design[^]
|
|
|
|
|
string translationText = "";
if(dicText.TryGetValue(translation[r].EntryCode, out translationText))
{
dicText.Add(translation[r].EntryCode, translationText);
}
I don't get this method. As far as I understand it, it should do one lookup and if found then assign the related value of "translation[r].EntryCode" to translationText. Is this correct?
|
|
|
|
|
TTFCAFO or RTFM or STFW or ...
Just type the code and time it and see what works best. Thats what we do when we don't know the answer.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
honeyman_can wrote: Is this correct?
If you mean TryGetValue(..), yes.
You should continue your original thread on a topic rather than starting new ones every few hours.
|
|
|
|
|
Im trying to create an access database with ADOX. It is to contain 3 tables,
each with a primary and foreign key and a one-to-one relationship between
each table.
I have no problem creating and populating the tables, no problem adding indexes to each table (one index is also a primary key). When I try to add primary keys
to any tables that do not already have one, it bombs out.
I've scoured everything I can find on ADOX (most of its VB) and nothing helps and
some examples I found were bad or confusing.
I'm also not sure if simply creating the primary/foreign keys will create a relationship of if there is something else I must do.
I've posted my code below with comments on the problem areas, I appreciate
any help (while I still have hair left) !
-------------------------------------------------------------------------------
<br />
public static void CreateDb(string fileName)<br />
{<br />
<br />
ADOX.CatalogClass cat = new ADOX.CatalogClass();<br />
ADOX.Table tblNew = new ADOX.Table();<br />
ADOX.Index tblIdx = new ADOX.Index();<br />
ADOX.Key tblKey = new ADOX.Key();<br />
<br />
try<br />
{<br />
cat.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Jet OLEDB:Engine Type=5");<br />
tblNew.Name = "Customers";<br />
tblNew.ParentCatalog = cat;<br />
tblNew.Columns.Append("CustomerID", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("MachineType", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("Name", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("Address", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("City", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("State", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("Zip", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("Country", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("Status", ADOX.DataTypeEnum.adWChar, 50);<br />
cat.Tables.Append(tblNew);<br />
tblNew = null;<br />
<br />
tblNew = new ADOX.Table();<br />
tblNew.Name = "Drawings";<br />
tblNew.ParentCatalog = cat;<br />
tblNew.Columns.Append("CustomerID", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("DrawingNumber", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("DrawingTitle", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("DrawingDate", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("FileName", ADOX.DataTypeEnum.adWChar, 255);<br />
cat.Tables.Append(tblNew);<br />
tblNew = null;<br />
<br />
tblNew = new ADOX.Table();<br />
tblNew.Name = "Revisions";<br />
tblNew.ParentCatalog = cat;<br />
tblNew.Columns.Append("DrawingNumber", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("RevisionLetter", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("RevisionDate", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("RevisionNote", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("RevBy", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("CheckBy", ADOX.DataTypeEnum.adWChar, 50);<br />
tblNew.Columns.Append("Key", ADOX.DataTypeEnum.adWChar, 50);<br />
cat.Tables.Append(tblNew);<br />
tblNew = null;<br />
}<br />
catch (Exception ex)<br />
{<br />
Utilities.InfoMessageBox(ex.Message);<br />
}<br />
<br />
try<br />
{<br />
tblNew = cat.Tables["Customers"];<br />
tblIdx.Name = "CustomerIndex";<br />
tblIdx.Unique = true;<br />
tblIdx.PrimaryKey = true;<br />
tblIdx.Columns.Append("CustomerID", tblNew.Columns["CustomerID"].Type, tblNew.Columns["CustomerID"].DefinedSize);<br />
tblNew.Indexes.Append((object)tblIdx, null);<br />
tblIdx = null;<br />
tblNew = null;<br />
tblIdx = new ADOX.Index();<br />
<br />
tblNew = cat.Tables["Drawings"];<br />
tblIdx.Name = "DrawingsIndex";<br />
tblIdx.Unique = true;<br />
tblIdx.Columns.Append("DrawingNumber", tblNew.Columns["DrawingNumber"].Type, tblNew.Columns["DrawingNumber"].DefinedSize);<br />
tblNew.Indexes.Append((object)tblIdx, null);<br />
tblIdx = null;<br />
tblNew = null;<br />
tblIdx = new ADOX.Index();<br />
<br />
tblNew = cat.Tables["Revisions"];<br />
tblIdx.Name = "RevisionsIndex";<br />
tblIdx.Unique = true;<br />
tblIdx.Columns.Append("Key", tblNew.Columns["Key"].Type, tblNew.Columns["Key"].DefinedSize);<br />
tblNew.Indexes.Append((object)tblIdx, null);<br />
tblIdx = null;<br />
tblNew = null;<br />
}<br />
catch (Exception ex)<br />
{<br />
Utilities.InfoMessageBox(ex.Message);<br />
}<br />
<br />
<br />
try<br />
{<br />
tblNew = cat.Tables["Drawings"];<br />
tblKey = new ADOX.Key();<br />
tblKey.Name = "2nd";<br />
tblKey.Type = KeyTypeEnum.adKeyForeign;<br />
tblKey.RelatedTable = "Customers";<br />
tblKey.DeleteRule = RuleEnum.adRINone;<br />
tblKey.UpdateRule = RuleEnum.adRINone;<br />
tblKey.Columns.Append("CustomerID", tblNew.Columns["CustomerID"].Type, tblNew.Columns["CustomerID"].DefinedSize);<br />
tblKey.Columns["CustomerID"].RelatedColumn = "CustomerID";<br />
tblKey = null;<br />
tblNew = null;<br />
}<br />
catch (Exception ex)<br />
{<br />
Utilities.InfoMessageBox(ex.Message);<br />
}<br />
<br />
try<br />
{<br />
tblNew = cat.Tables["Drawings"];<br />
tblKey = new ADOX.Key();<br />
tblKey.Name = "1st";<br />
tblKey.Type = KeyTypeEnum.adKeyPrimary;<br />
tblKey.Columns.Append("CustomerID", tblNew.Columns["CustomerID"].Type, tblNew.Columns["CustomerID"].DefinedSize);<br />
tblNew.Keys.Append((object)tblKey, ADOX.KeyTypeEnum.adKeyPrimary, (object)tblNew.Columns["CustomerID"], "Drawings", "CustomerID");<br />
tblKey = null;<br />
tblNew = null;<br />
}<br />
catch (Exception ex)<br />
{<br />
Utilities.InfoMessageBox(ex.Message);<br />
}<br />
<br />
if (tblIdx != null)<br />
tblIdx = null;<br />
if (tblKey != null)<br />
tblKey = null;<br />
if (tblNew != null)<br />
tblNew = null;<br />
if (cat != null)<br />
cat = null;<br />
}
|
|
|
|
|
We have a checkbox column in our DataGridView. If it is checked and then you move out of the row, we get the EndEditEvent. But is there another, earlier, event we can bind to that will let us respond to the checking of the checkbox immediately?
Thanks.
|
|
|
|
|
How about CellValueChanged?
|
|
|
|
|
Hi,
I have developed an application that i want user to download from my web site. Now the problem is that when user comes to my site, then is there any way that i could determine whether .Net 2.0 is installed on his system or not? I know it is possibe because Microsoft has implemented same feature on there SQL Express edition download page. If you go there, if you have .Net 2.0 installed, they tell you that you have .Net 2.0 installed. I want to know how it is possible? Please guide me in this regard.
Regards,
Wasif Ehsan.
|
|
|
|
|
How do I set the build properties so I can build a 2003 (v1.1) managed-code class library from VS2005 ? Thx.
|
|
|
|
|
|
Thx. I use NUnit all the time, do you like FXcop???
|
|
|
|
|
Any Regex guru's in the house?
I have a string coming from a database. This string represents some name/value pairs that are input by a Lotus Notes database and are delimited by two characters: '-' and ';'. The problem is the second part of the string allows both of the delimiters in the value field, so I can't use a Split(). What I need to do is first split the string to get the name/value pairs and then split it again to get the name and the value.
The string coming from the database looks something like this:
1234 - asdf-is a sample;2456 - eqwrt;7890 - ujk;l;097 - uio
And the array results should be something like so:
(I added the pipe symbol to make it easier to read)
1234 | asdf-is a sample
2456 | eqwrt
7890 | ujk;l;097 - uio
I can't figure out the syntax to split using a lookahead from the first '-' and the last ';' found before the next '-'.
|
|
|
|
|