Friday, September 12, 2008
How to set GRUB to boot Windows by default :)
1. open a terminal window and type:
gksu gedit /boot/grub/menu.lst
2. Then scroll to the bottom, and move the windows entry above the ubuntu entry, then simply save and exit.
Tuesday, April 22, 2008
Power commands for Visual Studio 2008
For a list of features look here.
If this is for you you can download it here.
Friday, March 28, 2008
From MCT to DPE !!
If ever you've heard the term above and wondered what exactly it's all about, here is a quick run down.
Mission:
- Engaging the broad community of Developers in Academia and the public and private sectors,
- Driving excitement around Microsoft's software developer related technologies,
- To interact through events, specialist training workshops, community engagement, relationship marketing and the growth of an exciting solutions portfolio.
More details to follow as I find out more about the role!!!
Wednesday, March 26, 2008
Domain specific language - Primer
What is it?
Well firstly it is not a GPL, a general purpose language like VB.NET,C# or any other programming language that lets you code using a specific language to suite a diverse set of tasks. It’s actually the other way round, it’s useful for a specific task to fix a problem within that domain. Using it allows you to build a modeling tool or define a modeling language for that task. It also makes implementing the solution to that problem a lot easier, however it does shift a lot of the work up front. i.e developing the tool is hard work, but once it’s built it’s a lot easier to solve problems using it!!! Domain-specific languages focus on doing one kind of task well. It’s kinda like UML, but without the U. http://en.wikipedia.org/wiki/Domain-specific_programming_language
What can you do with it?
For example, you can create a specialized language that describes a user interface, a business process, a database, or the flow of information, and then you can generate code from those descriptions. The DSL does not have to fit just IT or programming tasks, you may wish to model other things like solar systems. By using Domain-Specific Language Tools, you can create a custom graphical designer that uses your Domain-specific diagram notation. You can then create custom text templates that use models that are created in your designer to generate source code and other files.
What tools are there out there?
What does the VS2008 DSL tool consist of ?
· A project wizard that creates a fully configured solution. In this solution, you can define a domain model that consists of a designer and a text output generator. If you run a completed solution from inside Visual Studio, a test solution opens in a separate instance of Visual Studio so that you can test the designer and the text output generator.
· A graphical designer for defining and editing domain models.
· Designer definitions in XML. The code for implementing designers is generated from these definitions so that you can define a graphical designer hosted in Visual Studio without manually writing any code.
· A set of code generators, which take a domain model definition and a designer definition as input and produce code that implements both of the components as output. The code generators also validate the domain model and the designer definition, and they raise errors and warnings accordingly.
· A framework for defining text output generators. These template-based generators take data (models) that use a domain model as input and generate text output that is based on the template. Parameters in the template are substituted by using the results of running a Visual C# script that is embedded in the template.
What VS editions support DSL
For creating a DSL you will need any of the following:
· Visual Studio 2008 Professional Edition
· Visual Studio 2008 Team Edition for Software Architects
· Visual Studio 2008 Team Edition for Software Developers
· Visual Studio 2008 Team Edition for Software Testers
· Visual Studio 2008 Team Suite
In order to use the DSL you create you will need on of the following VS IDE’s@
· Visual Studio 2008 Standard Edition
· Visual Studio 2008 Professional Edition
· Visual Studio 2008 Team Edition for Software Architects
· Visual Studio 2008 Team Edition for Software Developers
· Visual Studio 2008 Team Edition for Software Testers
· Visual Studio 2008 Team Suite
OK so not much choice, you can’t use VS2005 or 2003 I’m afraid.
OK enough already! How do I create a DSL? That will be the topic of my next post!!
Thursday, March 20, 2008
New Visual Studio 2008 Certifications
The following core exam is required for all six certifications.
Exam 70-536: TS: Microsoft .NET Framework 2.0 – Application Development Foundation
The actual certifications can be divided into two, ones which are the .NET Framework 3.5 versions of the previous tracks, and those wich are brand new technologies.
Similar to the previous ones are:
- MCTS: .NET Framework 3.5, Windows Forms Applications, Exam
- MCTS: .NET Framework 3.5, ADO.NET Applications, Exam 70-561
- MCTS: .NET Framework 3.5, ASP.NET Applications, Exam 70-562
Brand new technologies are:
- MCTS: .NET Framework 3.5, Windows Presentation Foundation Applications, Exam 70-502
- MCTS: .NET Framework 3.5, Windows Communication Foundation Applications, Exam 70-503
- MCTS: .NET Framework 3.5, Windows Workflow Foundation Applications, Exam 70-504
Most of these exams have not yet been released but should be available this month or next
Monday, March 17, 2008
My new Gadget I forgot to blog about
Anyway was was the gadget, well its a Solar powered charger that is so versatile!! It's made by a company called PowerGuy. They do loads of battery stuff but this is great. It can be charged from the mains, the USB on a PC or by the sun, which here in Malta is abundant!!! Once fully charged it can discharge into any device, loads of phone models, including my HTC touch!!! Here are some picks:
Sunday, March 16, 2008
Low audio volume on HP 6820s laptop
Thursday, March 13, 2008
Really Simple .NET Remoting Tutorial with VB.NET
So I've seen lots of examples of remoting on the net, this is not a new topic, but for some it can be a tough subject. Add to this the fact that many choose C# and some just want a good old VB sample so here goes for my longest post to date!!!
So what is remoting anyway
It lets you call objects located in different processes and on different machines just as though they were within the same application, much like when you call a .dll referenced by your app.
So you may say we can do this with WebServices, true, but here the requirement is that both client and server MUST reside on the .NET framework. So with the interoperability gone we get much better performance with a little more complexity.
How to go about it: Server side
First thing we have to do is make our class remoteable by inheriting from MarshalByRefObject.
Public Class clsRemoteObject
Inherits MarshalByRefObject
Public Function getRemoteString() As String
Return Now.ToString()
End Function
End Class
Make sure you put this code in a new class library project and call it: RemotingClassLib
This can then be hosted in any of the following:
- Console (Must be started manually, but simple to administer)
- Windows App (Must be started manually, but simple to administer)
- ASP.NET Web App (Limited to HTTP, but you have session state, start up automatically etc)
- Windows Service (Use Fast TCP comms, Start automatically but can e complex)
The host must then register a channel to accept incoming requests on. This is important! Most problems arise because of mis-configurations between client and server settings.
Now create another project in the same solution called ConsoleHost and chose the console Application type. Type any of these 3 in the Sub Main.
Create and register a TCP channel: Dim tcpChannel As IChannel
tcpChannel = New TcpServerChannel("8085")
ChannelServices.RegisterChannel(tcpChannel, False)
Same for an HTTP and now, new to .NET 2.0, IPC Dim httpChannel As IChannel
httpChannel = New HttpServerChannel("8086")
ChannelServices.RegisterChannel(httpChannel, False)
Dim ipcChannel As IChannel
ipcChannel = New IpcServerChannel("Server")
ChannelServices.RegisterChannel(ipcChannel, False)
Next, hook up our remote class to the registered channel. Again you can use any of the following.
The type of object instantiation can also be controled in the hosting app:
- Singleton: Good for multiple calls where server maintains object between calls and also state:
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(RemotingClassLib.clsRemoteObject), "MyRemoteObject", _
WellKnownObjectMode.Singleton)
SingleCall: Good to keep overheads down
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(RemotingClassLib.clsRemoteObject), "MyRemoteObject", _
WellKnownObjectMode.SingleCall)
- ClientSide Activation: Client controls activation and recieves a dedicated object.
RemotingConfiguration.RegisterActivatedServiceType( _
GetType(RemotingClassLib.clsRemoteObject))
That’s all for now on the server side, now to the calling client!
The Client Side
Here we must reference the Classlibrary that contains the class we wish to instantiate. Oh you say, that kind of negates the whole point because this will take a local copy, then if we update the class library we have a problem. Yes you are absolutely right but what you should do is create an interface in a separate assembly. Then implement that interface in your class library, after setting a reference to the interface library. Then you get the client remoting app to reference the interface also. This way your implementation code is not copied to the client. I’ll tweak the code at the end of this article, but for now let’s keep it simple. So with the reference we can instantiate the object, all we need is a line to redirect calls to methods on this object to the remote object, easy:
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles Me.Load
RemotingConfiguration.RegisterWellKnownClientType( _
GetType(RemotingClassLib.clsRemoteObject), _
"tcp://localhost:8085/MyRemoteObject.rem")
End SubPrivate Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim rs As New RemotingClassLib.clsRemoteObject
Me.Text = rs.getRemoteString()End Sub
That’s it !!!!
Refactor!™ for Visual Studio® - Refactoring support for VB.NET at last
Friday, March 7, 2008
Getting ready for Silverlight 2.0 - Part 1
- Install the .NET Framework 3.5 (if you have VS2008 this is not necessary, you have it already) first before you install Expression Blend 2.5.
- Install Silverlight 2 Beta 1
- Install Expression Blend 2.5 March 2008 Preview (25 megabytes)
My next post will take you through creating you first project.
Customising the WebService Help Page
So some years later I'm gonna show you how.
The trick is in the Web.Config. Inside System.web you can set up a WebServices Tag and then include a wsdlHelpGenerator Tag to place your settings. Some options are now available:
Turn of ALL WSDL and Help!!
<System.Web>
<webServices>
<protocols>
<remove name="Documentation"/>
</protocols>
</webServices>
Or you can point it to your own file:
<webServices>
<wsdlHelpGenerator href="Default.aspx"></wsdlHelpGenerator>
</webServices>
But like this you have to do the whole page again yourself, there must be an easier way to just add some custom bits like a compnay logo, contact details etd, well there is. If you dig around, %Windows%\Microsoft.NET\Framework\v2.0.50727\CONFIG you'll find a file called DefaultWsdlHelpGenerator.aspx. Now you know what you have to do: Copy it and customise it :) if you want just your webservice changed, or alter it to alter all WebService DOcumentation across the whole machine!!
Adding a WebReference to a Windows Forms Application in VS2008
- Clicking Discover will find the Webservice in the solution and create a Service reference that must be consumed via the WCF route.
- The other way is to click Advanced at the bottom and then select WebService. The rest should be very familiar!!
What's really interesting is that fact that once you have one WebService Reference you can now do it the old way!!! Right click and you get the image below !!
Wednesday, March 5, 2008
Thank you ProcessMeNtOR for the Bottle Warmer!!
Creating a One-Way Webservice to improve responsiveness
<SoapDocumentMethod(Oneway:=True)> _
<WebMethod()> _
Public Sub Oneway()
Threading.Thread.Sleep(10000)
End Sub
<WebMethod()> _
Public Sub Twoway()
Threading.Thread.Sleep(10000)
End Sub
And then we would call theses like this:
Dim proxy As New localhost.Service()
Dim dtStart As New Date
dtStart = Now
proxy.Oneway()
MessageBox.Show(DateDiff(DateInterval.Second, dtStart, Now))
dtStart = Now
proxy.Twoway()
MessageBox.Show(DateDiff(DateInterval.Second, dtStart, Now))
When you run the code the one way method returns instantly, no delay, the two way will wait 10 seconds and stall the client app!!
Using Session State in a Webservice AND calling from a Windows Form
<WebMethod(EnableSession:=True)> _
Public Function HelloWorld() As String
If Session("FirstCall") Is Nothing Then
Session("FirstCall") = Now
End If
Return Session("FirstCall")
End Function
And calling this from a webform is not a problem since the browser can handle session information in a cookie etc. However it gets just a little tricky when you call it from a windows form because it has no idea about cookies. So you have to take care of it in the call like this:
Private Cookies As System.Net.CookieContainer
Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click
Dim proxy As New localhost.Service()
' Set the Cookie Container on the proxy
If Cookies Is Nothing Then
Cookies = New System.Net.CookieContainer()
End If
proxy.CookieContainer = Cookies
MessageBox.Show(proxy.HelloWorld)
End Sub
A great explanation can be found here: http://msdn2.microsoft.com/en-us/library/aa480509.aspx
Caching a WebService Call
Public Function HelloWorld() As String
Return "Hello World" & Now
End Function
The duration is defined in seconds.
Tuesday, March 4, 2008
devNET Malta is now a member of Culminis
Culminis is an international not-for-profit organization devoted to the development and growth of the IT community. After supporting and connecting professional user groups and associations, student organizations, and solution providers for more than two years we have come to understand the goals and needs of each group, as well as the resources they have to share. With this knowledge we are developing programs that ensure a meaningful and equitable exchange of those resources, ultimately elevating the status of the IT Pro both in their industry and in the community.
This is a greatopportunity for us to contribute globally to .NET development as well as allow us to benefit from the support of a global network of IT professionals that share our same goals... To make IT Fun!!
Cannot reply to email through Outlook Web Access (OWA) on Windows Vista
- Work in Basic mode in IE7 or Firefox and lose some of that great Webclient interface or
- Install the this MS fix to use iFrames on the exchange server!!
Monday, March 3, 2008
Alias a namespace/library in C# with Using;
Have a look at the using directive help on the MS site here.
This allows you to turn this:
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection();
into this:
using myData=System.Data.SqlClient;
myData.SqlConnection = new myData.SqlConnection();
This is much moreuseful when you have to work with smo in Microsoft.Server.Management.Smo!!!!
Big thank :)
Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed.
Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.
My leaving the domain was fine, it was the joining the domain that was the problem. However I had failed to read the message, I still had mapped drives to the shared folders on the old domain with the same user nameand folders. So I quickly disconnected the shares and the joining to the domain was instant!! I could then remap them all again.
Moral of the story: READ THE ERROR MESSAGE!!! They sometimes make sense :)
Friday, February 29, 2008
Heros Happen {Here} : Virtual Launch!
Wednesday, February 27, 2008
The image file E:\en_SQL2000_Ent_64bit_VL\setup.exe is valid, but is for a machine type other than the current machine.
It turns out that this version of SQL server targeted the Itanium 64 processor, where as this server was a Xeon. So it seems I will have to deploy SQL 2000 32 bit edition and make sure to apply SP4 !! The installation cannot be carried out from the autorun, but has to be run from the x86\setup directory.
Friday, February 22, 2008
Windows Vista SP1 for x86 and x64 is here!
Monday, February 18, 2008
Project 'SilverlightProject1' could not be opened because the Microsoft Visual Basic 2008 compiler could not be created. Unable to find required file
Project 'SilverlightProject2' could not be opened because the Microsoft Visual Basic 2008 compiler could not be created. Unable to find required file 'mscorlib.dll'.
So I hunted around the web and ended up on ScottGu's blog, surprise:) Some said ditch VB.NET and use C#. Sure enough the C# project worked fine, grrrr. So I uninstalled Silverlight 1.0 and tried the Silverlight 1.1 alpha September refresh. Guess what all is OK. Works a charm in VB.NET.
Accessing resources in a non-typed way in VB.NET
label1.text = My.resources.CompanyName
Now intellisense haspicked up the strongly type property and helps you. The same works for images, add an image to the resource file, browse for it and name it Image1. The following code also works:
Picturebox1.Image = My.resources.Image1
Note no need for the extension and also the intellisense pops up again. You just have to love this!!
So now you want to load a random file from the resources, like a random picture..... hmm this strong typing is getting in the way now grrrr.
Do not fret use the resourcemanager, this lets you get to any resource in the current assembly using a string paramater with its name. YES
So imgine you have 10 pics, called 0.jpg, 1.jpg, 2.jpg etc and you want to load them randomly
so the code now looks like this
Dim intNumber as integer = System.Convert.ToInteger(Math.rnd() * 9 )
Picturebox.Image = CType(My.resources.ResourceManager.GetObject(intNumber), Image)
You can also call the GetString method to pull strnig resources in an untyped fashion!!
Friday, February 15, 2008
Web Parts common Error when getting started
Error:Server Error in '/WebSite1' Application.--------------------------------------------------------------------------------
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error:
Now this error may appear completely unrelated and confusing but it makes sense when you know why ASP is complaining. Basically the WebPartManager is trying to contact the profile store to save your persoanlisation settings, which happen to default to SQLServer by default. Now your app is clean and you have not specified anywhere that you wanted to SQL as your profile storeor perhaps you don't have SQL even installed. So to get around this just switch off the webpartmanager personalisation by setting its personalisation attribute to false:
<asp:webpartmanager id="webpartManagerSampleSite" runat="server" enabled="false"></asp:webpartmanager>
Friday, February 8, 2008
Windows 2008 Server RTM
- Standard Edition,
- Enterprise Edition and
- Datacenter Edition.
Saturday, February 2, 2008
ASP.NET 2.0 Dynamic master page switching
- Create two or more master pages with the same ContentPlaceHolder controls and public properties. These could be straight copies or better still two child masters based on the same masterfile
- Optionally, provide a way for users to switch between master pages.
Assign the master page in the content page’s Page_PreInit method.Session("masterpage") = "Master2.master"
Response.Redirect(Request.Url.ToString)
Sub Page_PreInit(ByVal sender As Object, ByVal e _ As EventArgs)
If Not (Session("masterpage") Is Nothing) Then
MasterPageFile = CType(Session"masterpage") ,String)End If
End Sub