|
If you have been looking forward to a way to combine WinForm controls within a Windows Presentation Foundation (WPF) client, Glen Block has announced the Windows Presentation Composite Client in his blog, My Technobabble. The WPF Composite Client is a project of the patterns & practices team. While the project is similar to Composite Application Block (CAB), the WPF Composite Client is a new set of libraries and guidance.
The team is incorporating lessons learned around patterns such as Modularity (composition), services, dependency injection, event brokering. and others.
The plan is to create a set of deliverables to be shipped piecemeal rather than just one giant “factory” release. Look for everything to ship before the end of 2008.
As for Acropolis, the team has announced the core Acropolis concepts will be rolled into future .NET Framework releases and into Silverlight. In her blog posting A new phase for the Acropolis project Kathy Kam advises:
If you have evaluated Acropolis and are unsure whether to adopt it for your project, or to use the existing CAB, or to wait for the new guidance, our guidance for this situation remains the same - if you are building a Windows Forms LOB (line of business) composite client (with maybe rich islands of WPF content) you should carefully evaluate the current CAB release. If you are specifically interesting in building composite applications on .NET 3.5, please get involved with the Patterns & Practices project and help us to deliver a guidance package that meets your requirements.
|
|
|
|
|
When you run a Console Application, in a console by pushing f5.
How do you get the console to pause, I would like to get to pause so I can look at my work.
You can cut this and play with it if you like. I just wont to pause it.
what should I Dim to pause or add to the end of the code?
This is a Application Domain.....Demo
Module Module1
Dim d As AppDomain = AppDomain.CreateDomain("NewDomain")
Sub Main()
Console.WriteLine("Host domain: " + AppDomain.CurrentDomain.FriendlyName)
Console.WriteLine("Child domain: " + d.FriendlyName)
End Sub
End Module
-- modified at 12:41 Tuesday 30th October, 2007
tim637
|
|
|
|
|
|
Thanks that was a good input.
tim637
|
|
|
|
|
Add a Console.ReadKey() before the End Sub . This tells the program to wait for input from the keyboard.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks that was a good in put.
tim637
|
|
|
|
|
I created a new web site project, and added a database to it. How do I setup a user id and password to access the specific database? I tried to "modify connection" but it said something about the username is not associated with a trusted SQL server connection.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Do you mean a username and password to access the SQL database through that rather than Windows Integrated Security (or whatever it's called), i.e. you specify the username and password to connect to the database?
If you're trying to connect through integrated security from ASP.NET chances are that that role has not been added to the permissions on the database. I.e. you need to create a user (server wide) for ASP.NET and then allow this user permission to read/write to the database in question.
A similar thing is required if you're using SQL Authentication rather than Integrated.
Of couse I may have misunderstood you completely.
|
|
|
|
|
The user Id/password that you use in the connection string relate to a user that is set up in the database. You would need to add a particular user to the database and set it up with the relevant permissions.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
What would cause SelectSingleNode to not retrieve the specified node?
I tried this:
XmlNode groupNode = root.SelectSingleNode("connectionStrings")
(root is "configuration").
I also tried this:
XmlNamespaceManager nm = new XmlNamespaceManager(doc.NameTable);
nm.AddNamespace("br", "C:\\web.config");
XmlNode groupNode = root.SelectSingleNode("//br:"+m_groupName, nm);
I always get a null response from SelectSingleNode, even though the section I'm looking for is really in the file.
Anyone?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Can you post the relevant snippet of your xml file?
|
|
|
|
|
It's a "typical" web.config file generated completely within the VS2005 IDE.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Ok, I think I might have got something working for you:
Xml File:
<?xml version="1.0"?>
<configuration xmlns:br="http://microsoft.com/schemas/VisualStudio/TeamTest/2006">
<br:connectionStrings>
<add name="SQL" connectionString="SQL" />
</br:connectionStrings>
<connectionStrings>
<add name="SQL2" connectionString="SQL2" />
</connectionStrings>
</configuration>
Code:
using System;
using System.Xml;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XmlDocument dom = new XmlDocument();
XmlNamespaceManager manager = new XmlNamespaceManager(dom.NameTable);
manager.AddNamespace("br", "http://microsoft.com/schemas/VisualStudio/TeamTest/2006");
dom.Load("Web.config");
XmlNode groupNode = dom.DocumentElement.SelectSingleNode("br:connectionStrings", manager);
if (groupNode == null)
Console.WriteLine("(null)");
else
Console.WriteLine(groupNode["add"].Attributes["name"].Value);
}
}
}
Basically you need to construct the XmlNamespaceManager like you did but pass it into the SelectSingleNode function so that the function can use that object to resolve the namespaces in the XPath query.
Hope that helps, MS probably have their reasons for implementing it this way but it does seem a bit backwards, surely the NameTable should be populated from the xml file if that's where you read it from.
|
|
|
|
|
Thanks, I'll look at that when I get to work.
I initially tested my app with a simple web.config file. This file has your typical configuration section with a appSettings, connectionStrings, and a web.config section. That was working pretty well, so I decided to try it with one of our production web.config files (significantly larger and more complex). This file has the same stuff as the other one, as well as a configOptions section. A significant difference between the two files is that the production one has comments.
I'm trying to use Alvaro Mendez's read/write XML article [^] as a stepping off point because I haven't found ANY class that can handle the entire web.config file (none of them can read the connectionStrings section). His article doesn't do the namespace thing (and doesn't read the connectionStrings section), and seems to work fine on my small file, but chokes/pukes on the "real" config file.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
What I'm wondering is if this is a "standard" web.config why do you need namespaces?
|
|
|
|
|
I tried namespaces because of the stuff I found on the web regarding SelectSingleNode returning null. That didn't work any better than not using them. :/
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hmm, I did have a problem with SelectSingleNode before now that you mention it, the work-around I had was to use the indexer of the collection and check whether it was null .
Perhaps there's a bug in the 2005 version, the code I supplied worked on VS2008 with 3.5 framework, I can retarget it to compile against the 2.0 framework if it's any help.
|
|
|
|
|
I think I found my answer (detailed in another reply).
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I figured out why it's not working. The web.config file in question has the following:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
It therefore has a problem finding any section contained within the configuration section. When I delete the xmlns attribute, my code works. Any idea how to ignore this programatically? .Net doesn't seem to have a problem parsing this web.config...
-- modified at 9:13 Tuesday 30th October, 2007
I have found references on google that claim the xmlns attribute isn't needed. I'm going to go ahead and delete the attribute and see if the associated web site still works.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Ok the problem seems to be that .NET 2.0 supports XPath 1.0 and XPath 1.0 does not support default namespaces. To get around this you can do the following (for some reason ):
Sample Xml File
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
<add name="SQL" connectionString="SQL" />
</connectionStrings>
</configuration>
Sample code:
using System;
using System.Xml;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
XmlDocument dom = new XmlDocument();
dom.Load("Web.config");
XmlNamespaceManager manager = new XmlNamespaceManager(dom.NameTable);
manager.AddNamespace("default", "http://schemas.microsoft.com/.NetConfiguration/v2.0");
XmlNode node = dom.DocumentElement.SelectSingleNode("default:connectionStrings", manager);
if (node == null)
Console.WriteLine("(null)");
else
Console.WriteLine(node.OuterXml);
}
}
}
Notice where I added the default namespace with a assigned name default , the documentation says that the default namespace should be string.Empty but this does not work, if you give it a namespace then it does.
Hopefully it'll support XPath 2.0 at some point.
|
|
|
|
|
Is there a way to create an application that can run under MACs?
|
|
|
|
|
Yeah - create the app on a PC, put your mac on the pc, and then run the app on the pc.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Take a look at the first google result for ".net mac osx"
|
|
|
|
|
Theoretically, MONO would work, but you would have to be careful with this because the MONO support for .NET is patchy in places.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have a project to do called Multithreading and in this lab I have to creat A console application and start two threads simultaneously.
1. I created a console appleation and called it System.ThreadingDemo.
2. I need to creat a new static method called Counting. I'm not so sure how to go about it? I need feedback here.
3. In the new class, I need to add a using statment or the import statement for VB
to the System.Threading namespace? I need a feedback here!
4. In the new method, I need to creat a for loop that counts from 1 to 10? How would you do this?
5. within the New for loop, write out the current count and the ManagedThreadID for the current thread. I need a example here.
6. after writing out to the console, I need to sleep the current thread for 10 milliseconds.
I could use some feed back here.
7. I need to go back to the main method, and create a new ThreadStart delegate that points to the Counting method. Like what? what do they mean point to?
8. Now at this point I need Two threads, each pointing to the counting method.
How woud you code two more threads here?
This is a CODE example of a school project.... it needs work
after all said and done I have to Start both threads and join both threads to ensure that the application doesn't comloete until the threads are done. My code should look something like this:
Imports System.Threading
Class Program
Public Overloads Shared Sub Main()
Dim start As ThreadStart = New ThreadStart(AddressOf Counting)
Dim first As Thread = New Thread(starter)
Dim second As Thread = New Thread(starter)
first.start()
second.start()
first.join()
second.join()
console.Read()
End Sub
Shared Sub Counting()
Dim i As Integer
For i = 1 to 10 step i = 1
Console.WriteLine("Count: {0} - Thread: {1}" , -
i,Thread.CurrentThread.ManagedThreadID)
Thread.Sleep(10)
Next
End Sub
End Class
'You can copy this and use work with it, just let me know what you think.
-- modified at 8:37 Tuesday 30th October, 2007
tim637
|
|
|
|