Fernando Machado Píriz's Blog

Posts about enterprise architecture and related topics

Every company is a software company, and every software company might to be a service provider

leave a comment »

Software is pervasive. Except perhaps for the one-man (or women) burrito-like shops in the streets, every business runs on software. And they are an exception if and only if they do not accept credit card payments or use online grocery delivery services to refill their raw materials stock. Every company is a software company at the end of the day, either a software-consumer only or a software-development-and-consumer combo.

For those enterprises that do in-house software development and then use that software to run their business, even if it is just a portion of the total software being used, the traditional software development lifecycle might not be appropriate in some circumstances, as we will see in a minute.

An for those enterprises who’s business is to develop software for other enterprises or individuals to consume, the traditional software development lifecycle might not be appropriate either.

By traditional software development lifecycle I do mean the process that creates a software product at the end. I do not care if it is waterfall or is agile, the only thing that matters me is that a software product is created as a result of that process. It has the following characteristics:

  • Many features. Differentiation of the product is based on having as many features as possible for as wide an audience as possible. Products are rarely targeted to specific roles or customer needs.
  • Mean time to failure. As with traditional manufactured products, its main focus is mean-time-to-failure: products are better if they have few failures.
  • Slow update peace. Software product updates are relatively uncommon; it may be through patches for fixing bugs, through service packs to add new functionality, or through entire new versions. And development time for software products is usually large, followed by a maintenance warranty, and then a rest period before starting over.
  • Unknown consumption habits. Once products are released, is hard to know how they’re consumed by users, and take decisions based on usage patterns.
  • On time, on budget. Most important priority is to release products on time and on budget.

In addition, as with traditional manufactured products, reliability is perceived from the perspective of each individual unit. Providing reliability requires controlling quality within the production process. When users experience product problems, they are usually willing to wait until office hours for their problem to be addressed. A problem rarely impacts more than one person at a time. And usually it’s clear for users when problems are due to issues in the software product, as opposed to issues in the environment in which the software runs.

But any of these businesses might be affected by today’s transformation on software demands:

  • Your company develops an mobile software application, it can be a line-of-business application in the enterprises world, or it can be another specific-purpose software application in the marketplace for the consumers world. In the second case, most of these applications at least do store some data or do some kind of processing in a remote back-end, which puts them in the same group as those in the first case: mobile applications that consumes remote services.
  • Your company does electronic business with other companies, it can be exposing internal processes through software where others can participate, or use software applications to exchange information in order to complete a transaction. One way or another you are either providing software based services, or consuming them; probably both.

Did you notice the word software at the beginning of the two previous sentences and the word service at the end? It is not casual –I wrote it that way- but that is what we are and will be seeing in the foreseeable future: mobile software applications that consumes some kind of remote service and software based services exposed for others to consume.

If you feel that any of the two before mentioned categories do apply to your company, either if you are creating software for your own business consumption or in the business of developing software for others to use, and you are still developing software as products, guest what? You are not developing software, you are providing services. I do call these software-based service providers. And that is a completely different beast, want to know why? Let us see:

  • Reliability and agility over features. Differentiation of the service is based on highly reliable capabilities that fit a specific set of market needs. Effective services emphasizes reliability and agility over features.
  • Mean time to resolution. As with traditional utility services, its focus is mean-time-to-recovery: failures will happen, so services are better because of its fast recovery.
  • Continuous updates, continuous development. Software updates are continuous; they might release new features or entire new versions very frequently, and fix bugs on a daily basis. Software development for services is usually continuous; they might have release cycles, but usually those cycles are very short.
  • Detailed usage patterns. Usually it’s possible to collect very accurate and huge amounts of usage data, driving more meaningful decisions.
  • Up and running at appropriate costs. Most important priority is to have the service up and running, keeping the appropriate operating cost.

Furthermore, as with traditional utility services, reliability is a function of the entire system. Providing reliability requires real time, proactive monitoring of the behavior of every system component. When users suffer service outages, the impact is much wider, with one problem impacting a wide array of customers. Response cannot wait for office hours. Product support has to be ready 24x7x365. Users don’t care where the issues are when service outages occur. They might be in the software the service is based on, or in the datacenter, or in the network, or in any of the dependent components

You cannot keep pace with change requests and do not have enough agility to accompany businesses transformations? You have conflicting requirements from different business units or different users groups? You cannot find a good way to organize your software development and software operations teams? Guess what, your software factory is probably not organized as a service provider needs to be organized.

Software factories are organized around software products while service providers are organized around services. And you still wonder why it did not work?

Organizing teams around products means two things. One: you have a team by product, some members can be shared among teams, but teams do work for a product. And two: you very probably have segregation of tasks inside teams: business analyst, architects, designers, developers, testers, and operators if you do run your own software. Does one product use others? Of course, except if you have monolithic giant piece of software, in which case you are way worst that the rest of us, and have more urgent and important problems to solve. Each of the roles of a product team I mentioned before, does work for their own product. They really do not care about products using theirs products and certainly they do not control the other products they consume. And the transition from development to operations looks like developers throwing something over a fence to operators to catch… who cares what happens in the other side? There is always a revenge, operators can always fill bug fix request to developers.

Organizing teams around services, means that a service team has everything it needs to deliver the service and fulfill the service level agreement. There is no fence. Service owner, business analysts, developers, testers and operators sits together upfront to define how the service itself, and the service development process, will look like, end-to-end. Radical, isn’t it? Yes, but that is what you need: An operator telling a software developer what kind of automated deployment, monitoring and telemetry capacities he will need in order to operate the service. These are non-functional requirements and architects and software developers are used to deal with them. A tester telling a software development the way he or she should design the software for him or her to being able to effective and efficiently testing it. These are non-functional requirements too. A software architect or developer telling the service owner what can or cannot be built given time and budget restrictions. Sounds crazy, but these examples are just business requirements, the service owner should be used to deal with them during service definition.

If you think that services are just on the outer layer in contact with the outside world, you are plain wrong. The very same concept can be used in inner layers, in what I love to call the service-oriented enterprise architecture. It is not the same as the plain old service oriented architecture, where application services was the cornerstone. I am talking about business services, application services, and infrastructure services, all organized in the same way, relying one on each other via well defined operation level agreements from the service consumer side, and service level agreements as part of clear service definition from the service provider side.

Biggest software companies (well, it depends on your definition of big) are in fact software-based service providers (Microsoft, Google, Amazon, Facebook, Twitter, Whatsup, Apple, and so on). Your company might not be as big as those, but if it is a software-based service provider, you might have more things in common with them that you think. Someway or another all of them do organize behind the services they do provide. Why you do not?

Written by fernandomachadopiriz

November 20, 2014 at 2:30 am

.NET UY Conf, October 3rd & 4th

leave a comment »

Written by fernandomachadopiriz

June 11, 2014 at 4:58 pm

Posted in Announcements

Connecting an Hyper-V Virtual Machine to the Internet through a Wireless Connection

with one comment

In a previous post I wrote about how to configure your laptop to act alternatively as a virtualization server or as a nearly-standard desktop. Why would you do that? Well, if you need to use 64 bits virtual machines on top of Microsoft’s virtualization solutions, your only choice is to run Windows Server 2008 or Windows Server 2008 R2 with Hyper-V. For example, if you need to have different SharePoint 2010 developing environment configurations on the same machine, you will need to use 64 bits virtual machines.

In that post I shown how to configure an hypervisor server operating system –specifically Windows Server 2008 R2 with Hyper-V– to behave almost the same as desktop operating system –let us say Windows 7–, by enabling the features that ship disabled by default: wireless networking, audio, Aero, hibernation, and so on. Even better, since you probably want to switch between the hypervisor server scenario back and forth to the desktop scenario, I included some scripts files to enable required services and disable non-needed ones in each one case.

Even if you can successfully run both 32 bits and 64 bits virtual machines on your laptop when Hyper-V is properly configured, provided you have the appropriate hardware resources, you will realize sooner or later that Hyper-V is designed to run on a physical server, not on a laptop. Let me give you an example: Why do you use a laptop, after all? For mobile computing, don’t you? Well, if you do mobile computing with your laptop, you will be connected wirelessly, at least occasionally. Then you will realize you cannot connect your virtual machines to the Internet by using a wireless connection: Hyper-V only shows Ethernet network adapters when creating external virtual connections.

The two workarounds I found in the Internet –configuring Internet Connection Sharing or using Routing and Remote Access Service– were useless for me because ICS is disabled by my administrator and RRAS is too much complicated to setup.

I have two network interface cards in my laptop, an Intel® 82567LM-3 Gigabit Network Connection, and an Intel® Centrino® Ultimate-N 6300 AGN:

image

But only the first one is available in the list of network cards to be used when creating an external virtual connection:

image

There is an easy way to workaround this, and get an external virtual network connected with a wireless connection:

  1. Configure an external virtual connection using your wired local area connection as usual. Your virtual machines use this connection when you are connected by wire to access the Internet.
  2. When you are not connected by wire, bridge your wireless connection with the external virtual connection, by selecting both connections in the Network Connections window, right clicking, and choosing Bridge Connections from the context menu.

Your will see an additional network connection named Network Bridge and you will be able to access the Internet from your virtual machine guests through the wireless connection. Delete the bridged connection when you get connected by wire again.

image

Since you probably do not need to be permanently connected to the Internet, but want to access your host’s files and folders, I usually configure an internal virtual connection in addition to the external one, and all my virtual machines have two virtual network adapters connected to each of them.

If you are in the same scenario than me, I hope this tip simplifies your life. Cheers.

Written by fernandomachadopiriz

March 26, 2011 at 11:33 am

Posted in SharePoint 2010

Tagged with

New release of Visual Studio 2010 and .NET Framework 4 Training Kit

with one comment

imageMicrosoft yesterday published for download the March 2011 release of the Visual Studio 2010 and .NET Framework 4 Training Kit. You can download the kit from here. This training kit includes presentations, hands-on labs, and demos, covering the latest topics in the recently updated versions of Visual Studio 2010 and .NET Framework 4. Enjoy.

 

 

 

 

 

 

 

Written by fernandomachadopiriz

March 15, 2011 at 10:15 pm

Visual Studio 2010 Service Pack 1 Released

leave a comment »

The final version of the Visual Studio 2010 Server Pack 1 is available since yesterday for MSDN susbscribers. The list of new features and fixes is available here.

Among the most interesting new features for me are:

  • Silverlight 4 compatibility
  • Unit testing support for .NET Framework 3.5 targets
  • IntelliTrace for 64 bits and SharePoint applications
  • Web applications and web project hosting on Internet Information Services (IIS) 7.5 Express
  • Microsoft Web Platform Installer support

Written by fernandomachadopiriz

March 10, 2011 at 10:08 am

Developing SharePoint 2010 solutions in your laptop using Windows Server 2008 R2 with Hyper-V

with 4 comments

If you usually develop SharePoint Server 2010 solutions from your office desktop, it is very likely that you have a full sized server there, with all required servers and tools installed on it, or better yet if you use different server versions or configurations, you have multiple virtual machines, each one with all required software installed on it. In such case, this blog post is not for you.

If your scenario is different, as mine is, and you work from different places using a laptop, and need to have different SharePoint Server 2010 installations (different versions, different languages, etc.), then you need your servers and tools running on virtual machines.

With Microsoft Office SharePoint Server 2007, both your host and your guest operating systems could be 32 bits, since you were able to use the 32 bits version of SharePoint servers. In addition, it was possible to use a client (non-server) operating system as host, by using Microsoft Virtual PC 2007 for example. With SharePoint Server 2010 that is not true anymore and the guest operating system needs to be a 64 bits one, let us say Windows Server 2008 R2 64 bits. This is because SharePoint Server 2010 only runs on top of 64 bits operating system.

You cannot have any 64 bits operating system on a virtual machine by using Microsoft Virtual PC 2007 or the new Windows 7’s Windows Virtual PC; the only way you can virtualize a 64 bits operating system is by using a hypervisor: Windows Server 2008 with the Hyper-V role.

Does it look a bit odd to run a hypervisor on a laptop, does not? Well, probably you are right, but you will get accustomed to it, believe me.

What do you lose by using Windows Server 2008 with Hyper-V as the host operating system of your laptop? If you use the default installation, you do not have:

  • Audio and Windows Media Player. The Windows Audio service is disabled by default and the Windows Media Player is not installed in a server. Usually there is nobody listening music at the servers room, it is a very noisy environment.
  • Wi-Fi connectivity. The Wireless LAN Service feature is not installed. Usually servers a wired-connected to the network.
  • Aero. The Themes service is disabled by default to preserve server’s resources.
  • Search. The Windows Search service is disabled by default also to preserve server’s resources.
  • Sleep and hibernate. Usually servers are always on and never sleep or hibernate, even turn off.
  • Event Tracker. You cannot shut down the system without explaining the reason why first.
  • Internet Explorer’s Enhanced Security. Every time you try to visit a website you get a message saying why you should not browse the web from a server.

But what is reasonable in a server, is not reasonable in the laptop you use for your everyday work, right? You want to hear music, you need wireless connections, you need to search for files and email messages, you love the look and feel of Aero, and you do not carry your laptop with the hard disk drive spinning every time you move from one place to another.

Except for sleeping and hibernating, you can have audio, wireless connectivity, file and email search, and a desktop look and feel in Windows Server 2008 R2. Unfortunately, as soon as you add the Hyper‑V role, you lose the ability to sleep/hibernate your laptop. But news are no so bad, you will be able to sleep/hibernate your laptop by temporarily disabling the hypervisor without removing it.

In this blog post I will show you how to tweak a default Windows Server 2008 R2 installation so it looks and behaves like a Windows 7 desktop. This is how mine looks:

WS2008R2

Enabling audio

This one is easy. Simply click the Start button and type “services” in the search box and then open the Services console. Look for the Windows Audio service, right click and choose Properties, then in the Properties dialog box change the Start type from Disabled to Automatic.

Or open an administrative Command Prompt and type sc \\[machine] config audiosrv start= auto replacing [machine] for your computer’s name and then type net start audiosrv.

Enabling Wi-Fi, Aero and Search

Install the missing features. Click the Start button and type “server” in the search box and then open the Server Manager console. On the left panel click on Features, then click on the Add Features link on the right panel. In the Add Features Wizard select and install the features Desktop Experience and Wireless LAN Service.

Once these features are installed, open the Services console again and look for the Themes service, right click and choose Properties, then in the Properties dialog box change the Start type from Disabled to Automatic. Do the same with the Desktop Window Manager Session Manager service. Do the same also with the Windows Search service but set Start type to Automatic (Delayed start).

Or open an administrative Command Prompt and type for %%s in (uxsms themes) do (sc \\[machine] config %%s start= auto) and then sc \\[machine] config wsearch start= auto and finally for %%s in (uxsms themes wsearch) do (net start %%s).

Enabling sleep/hibernate

Let us assume you have installed Windows Server 2008 R2 and then you added the Hyper-V role. If you open an administrative Command Prompt and then you run the bcdedit /enum {current} you will get an output like this one:

clip_image003

bcdedit is not a “binary coded decimal” editor, as you might probably guess, but a “boot configuration datastore” editor. Note the hypervisorlaunchtype set to Auto in the last line. Also note the Windows Server 2008 R2 description; this is the text you see during boot when multiple boot configurations are available or during system recovery.

Copy this boot configuration to a new one by typing bcdedit /copy {current} /d “Microsoft Windows Server 2008 R2 (w/o Hyper-V)” in an administrative Command Prompt. The text between the quotes is the description of the new boot configuration. You can choose a description different than mine.

The command outputs a message including a GUID of the new boot configuration. Disable the hypervisor role in the new boot configuration by using bcdedit /set {GUID} hypervisorlaunchtype off where GUID is the GUID shown by the previous command.

You are done. Additionally, if you want to change your default boot configuration, or change the time to display the list of configurations during boot, you can use bcdedit or the Startup and Recovery dialog box in the System Properties.

This new boot configuration will disable Hyper-V and let you enable sleep/hibernation, but (obviously) you will need to reboot your laptop before that. This is by far more efficient than completely removing the Hyper-V role, which by the way, also requires a reboot.

To enable hibernation after reboot, you will need to open an administrative Command Prompt and run powercfg –H (uppercase haitch).

Disabling Event Tracking

Open the Local Group Policy Editor by clicking on Start and typing “edit policy” in the search box. Then expand Local Computer Policy in the left pane, then Computer Configuration, then Administrative Templates, finally System. In the right pane look for Display Shutdown Event Tracker, double click it to edit its configuration, and choose Disable.

Disabling Internet Explorer Enhanced Security

Click the Start button and then type “server” in the search box and then open the Server Manager console. Select the root node in the left tree and then click on the Configure IE ESC link in the right pane. Choose Off to disable the setting.

Final remarks

Now you can use your laptop in two scenarios: as a hypervisor or as a regular laptop. In the first scenario, is highly recommended that you disable back services like Windows Audio, Themes, Windows Search, etc. and turn Aero themes off, in order to preserve system resources. In addition, if you have other servers like SQL Server or even a SharePoint server installed on top of your host operating system, it is highly recommended to turn them off while using the hypervisor.

Since you need to shut down the system before moving your laptop while using the hypervisor, and since you need to reboot to switch from one scenario to the other, consider buying a solid state disk drive for your system partition to speed up shut down and start up times. By the way, with a disk like that, turning your laptop off and on could be even faster than hibernating and restoring from a regular hard disk drive, if your laptop has a lot of RAM, as it should have to use eventually multiple virtual machines simultaneously.

To facilitate switching from the hypervisor scenario to the regular laptop scenario, you can use the following batch files and scripts.

Use this batch file to enable or disable search by simply typing search on or search off in an administrative Command Prompt. This batch file not only stops or starts the search service; it also enables or disables it, so the current status is kept after rebooting.

@echo off

rem Enables and starts or stops and disables search services

rem Search services:
rem	Windows Search

set x=%1%#
if %x%==# goto usage
if %1%==on goto enable
if %1%==off goto disable

:usage

echo "Usage: search on|off"
goto end

:enable

rem Enables desktop services

for %%s in (wsearch) do (sc \\[machine] config %%s start= delayed-auto)
for %%s in (wsearch) do (net start %%s)

pause
goto end

:disable

rem Disables search services

for %%s in (wsearch) do (net stop %%s)
for %%s in (wsearch) do (sc \\[machine] config %%s start= disabled)

pause
goto end

:end

 

You can use this other batch file to enable or disable the audio related services, by typing audio on or audio off in an administrative Command Prompt.

@echo off

rem Enables and starts or stops and disables audio related services

rem Audio services:
rem	Windows Audio
rem	Windows Audio Endpoint Builder

set x=%1%#
if %x%==# goto usage
if %1%==on goto enable
if %1%==off goto disable

:usage

echo "Usage: audio on|off"
goto end

:enable

rem Enables audio services

for %%s in (audiosrv audioendpointbuilder) do (sc \\[machine] config %%s start= auto)
for %%s in (audiosrv audioendpointbuilder) do (net start %%s)

pause
goto end

:disable

rem Disables audio services

for %%s in (audiosrv audioendpointbuilder) do (net stop %%s)
for %%s in (audiosrv audioendpointbuilder) do (sc \\[machine] config %%s start= disabled)

pause
goto end

:end

 

To stop all servers’ services, there is another batch file you can use to stop and disable or start and enable these services, by typing servermode off or server mode on on an administrative Command Prompt.

@echo off

rem Enables and starts or stops and disables server related services

rem Server services:
rem	Application Host Helper Service
rem	Distributed Transaction Coordinator
rem	Simple Mail Transfer Protocol (SMTP)
rem	IIS Admin Service
rem	Net.Msmq Listener Adapter (depends on Message Queuing)
rem	Message Queuing
rem	SharePoint 2010 Timer
rem	SharePoint 2010 Tracing
rem	SharePoint 2010 User Code Host
rem	SharePoint Foundation Search V4
rem	SharePoint Server Search 14
rem	SQL Full-text Filter Daemon Launcher (MSSQLSERVER)
rem	SQL Server Agent (MSSQLSERVER) (depends on SQL Server (MSSQLSERVER))
rem	SQL Server (MSSQLSERVER)
rem	SQL Server (SHAREPOINT)
rem	SQL Server (SQLEXPRESS)
rem	SQL Server Analysis Services (MSSQLSERVER)
rem	SQL Server Browser
rem	SQL Server Integration Services 10.0
rem	SQL Server Reporting Services (MSSQLSERVER)
rem	SQL Server VSS Writer
rem	Visual Studio Team Foundation Background Job Agent
rem	Visual Studio Team Foundation Build Service Host
rem	World Wide Web Publishing Service

set x=%1%#
if %x%==# goto usage
if %1%==off goto disable
if %1%==on goto enable

:usage

echo "Usage: servermode on|off"
goto end

:disable

rem Disables server services

for %%s in (apphostsvc SMTPSVC msdtc iisadmin NetMsmqActivator msmq sptimerv4 sptracev4 spusercodev4 spsearch4 osearch14 SQLSERVERAGENT MSSQLSERVER MSSQL$SHAREPOINT MSSQL$SQLEXPRESS MSSQLServerOLAPService SQLBrowser MsDtsServer100 ReportServer SQLWriter TFSJobAgent TFSBuildServiceHost W3SVC) do (net stop %%s)
for %%s in (apphostsvc msdtc SMTPSVC iisadmin NetMsmqActivator msmq sptimerv4 sptracev4 spusercodev4 spsearch4 osearch14 MSSQLFDLauncher SQLSERVERAGENT MSSQLSERVER MSSQL$SHAREPOINT MSSQL$SQLEXPRESS MSSQLServerOLAPService SQLBrowser MsDtsServer100 ReportServer SQLWriter TFSJobAgent TFSBuildServiceHost W3SVC) do (sc \\[machine] config %%s start= disabled)

pause
goto end

:enable

rem Enables server services

for %%s in (apphostsvc msdtc iisadmin NetMsmqActivator msmq sptimerv4 sptracev4 spusercodev4 MSSQLFDLauncher SQLSERVERAGENT MSSQLSERVER MSSQL$SHAREPOINT MSSQL$SQLEXPRESS MSSQLServerOLAPService SQLBrowser MsDtsServer100 ReportServer SQLWriter TFSJobAgent TFSBuildServiceHost W3SVC) do (sc \\[machine] config %%s start= auto)
for %%s in (msdtc) do (sc \\[machine] config %%s start= delayed-auto)
for %%s in (spsearch4 osearch14 MSSQLFDLauncher SMTPSVC) do (sc \\[machine] config %%s start= demand)
for %%s in (apphostsvc msdtc iisadmin NetMsmqActivator msmq sptimerv4 sptracev4 spusercodev4 spsearch4 osearch14 MSSQLFDLauncher SQLSERVERAGENT MSSQLSERVER MSSQL$SHAREPOINT MSSQL$SQLEXPRESS MSSQLServerOLAPService SQLBrowser MsDtsServer100 ReportServer SQLWriter TFSJobAgent TFSBuildServiceHost W3SVC SMTPSVC) do (net start %%s)

pause
goto end

:end

 

Since hypervisor’s services are needed only when you boot using the hypervisor configuration, these services are enabled or disabled on a separate batch file.

@echo off

rem Starts or stops Hyper-V related services

if %1%==off goto disable
if %1%==on goto enable
goto end

:disable

for %%s in (vhdsvc nvspwmi vmms hvboot) do (net stop %%s)
for %%s in (vhdsvc nvspwmi vmms hvboot) do (sc \\[machine] config %%s start= disabled)
pause
goto end

:enable

for %%s in (vhdsvc nvspwmi vmms) do (sc \\[machine] config %%s start= auto)
for %%s in (hvboot) do (sc \\[machine] config %%s start= demand)
for %%s in (vhdsvc nvspwmi vmms hvboot) do (net start %%s)
pause
goto end

:end

 

Since I do a lot of work with many different servers (SQL Server, SharePoint Server, Team Foundation Server, etc.), the list of services I have in this batch file is big. You can remove or add your own services from the batch file. If you plan to modify it, pay attention to the following:

1. Dependencies. You need to stop a services after all the services that depends on it, to avoid confirmation messages stopping your batch file processing. Make sure your start them in the reverse order.

2. Start type. Disabling services is easy: there is just one disabled status. But enabling them is a bit more complicated, because there is more than one start type: automatic, automatic but delayed, and manual. Make sure you return the start type to the original one.

The extra mile: if you want your Windows Server 2008 R2 installation to look exactly (well, very similar at least) than a Windows 7 desktop, with Aero and themes, you can use these additional batch files and scripts. You bet it, there are desktopmode on and desktopmode off commands to do this.

@echo off

rem Enables and starts or stops and disables desktop related services

rem Desktop services:
rem	Windows Audio
rem	Windows Audio Endpoint Builder
rem	Windows Search
rem	Desktop Window Manager Session Manager
rem	Disk Defragmenter (stop only)
rem	Themes

set x=%1%#
if %x%==# goto usage
if %1%==on goto enable
if %1%==off goto disable

:usage

echo "Usage: desktopmode on|off"
goto end

:enable

rem Enables desktop services

for %%s in (audiosrv audioendpointbuilder uxsms defragsvc themes) do (sc \\[machine] config %%s start= auto)
for %%s in (wsearch) do (sc \\[machine] config %%s start= delayed-auto)
for %%s in (defragsvc) do (sc \\[machine] config %%s start= demand)
for %%s in (audiosrv audioendpointbuilder wsearch uxsms themes) do (net start %%s)
DesktopTheme.vbs

pause
goto end

:disable

rem Disables desktop services

for %%s in (audiosrv audioendpointbuilder wsearch uxsms defragsvc themes) do (net stop %%s)
for %%s in (audiosrv audioendpointbuilder wsearch uxsms defragsvc themes) do (sc \\[machine] config %%s start= disabled)
ServerTheme.vbs

pause
goto end

:end

 

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:""C:\Windows\Resources\Themes\aero.theme"""

Wscript.Sleep 15000
WshShell.AppActivate("Desktop Properties")
WshShell.Sendkeys "%FC"
WshShell.Sendkeys "{F4}"

 

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "rundll32.exe %SystemRoot%\system32\shell32.dll,Control_RunDLL %SystemRoot%\system32\desk.cpl desk,@Themes /Action:OpenTheme /file:""C:\Windows\Resources\Ease of Access Themes\classic.theme"""

Wscript.Sleep 1000
WshShell.AppActivate("Desktop Properties")
WshShell.Sendkeys "%FC"
WshShell.Sendkeys "{F4}"

 

One final recommendation: add the folder where this batch files and scripts are stored to the PATH environment variable.

Have fun.

PS: In order to be completely honest, there are other things you will lose if you choose to install Windows Server 2008 R2 in your laptop. First, the Bluetooth drivers are usually not available for server operating systems, so be aware if you depend on Bluetooth devices for your daily work. Second, depending on your system’s hardware, other device drivers might not be available for server operating systems. The most common ones are the fingerprint reader and the smart card reader drivers. You can try installing the drivers for Windows 7, but this may or may not work. Finally, some third party tools detect a non-desktop operating system and refuse to run or even to install. So far, I can live with all these limitations, but you cannot say I did not tell you.

Written by fernandomachadopiriz

February 12, 2011 at 12:13 pm

First look to the Microsoft Visual Studio LightSwitch beta

with 7 comments

A new member of the developers’ tools family has been announced earlier this month and the first beta will be available soon for download: Microsoft Visual Studio LightSwitch.

What it is and what it is for?

With LightSwitch we can easily and quickly create business applications from the scratch, including not only the application user interface forms, but also the application database; you can also create applications from existing databases.

In this article I will provide an overview of LightSwitch using the beta version soon to be available. The project I will create is a simple application to record the books I loan to my friends.

A new LightSwitch application starts by creating a new Visual Studio project. A LightSwitch project will contain application’s data and forms definitions. By using these definitions LightSwitch generates a SQL Server database and the source code in C# or Visual Basic.

In this article I will use a C# project template. Here you can see the familiar Visual Studio new project dialog box, with the two templates provided by LightSwitch.

image

Once the project is created we can connect to an existing data source or create a new data definition for the application. In this post I will show how to create data definitions from the scratch.

image

The first thing to do is to define how book entities are. I am interested in each book’s author and title. Then we create an entity Book, with Author and Title fields, both of type String and both required. These entities will be stored in a Books table.

image

Then a definition for loans is created. From each loan I am interested in knowing to whom I loaned the book, when the book was loaned, and when it was returned. Then we create a second entity called Loan, with fields ToFriend, DateLoaned and DateReturned; the first field is of type String and the two other are of type Date; the first two fields are required, but the latest is not. These entities will be stored in the Loans table.

image

Now a new relationship between books and loans is defined.

image

See below how the definition of the entity Loan and its relationship with Book looks:

image

Now we need to define the forms to edit these entities. Many different form templates are available -allowing one record to be edited at a time, multiple records in a grid, etc. I will use a template for a simple record insertion.

image

The form definition created by the wizard can be modified. I have changed only the name to display and the description of the form.

image

Once the form definition is finished, we can test the application. This LightSwitch version allows creating the following application types:

image

When the build is started LightSwitch:

  • Creates the database
  • Generates the source code
  • Compiles the application

A LightSwitch application is typically a three tier application, using certain specific technologies for each tier:

In this article you can find more information about the architecture of a LightSwitch application.

When a LightSwitch application gets executed:

  • A local web server is started
  • The application is deployed on this web server
  • The application is started

That is what we see:

image

Let us complete the fields to add the first book:

image

The application automatically assigns a new identifier to the first book.

image

Out of the box, the application already has some simple validations, like the one corresponding to the fields marked as required.

image

image

image

The second form is to insert loans. This is also a simple new record form. We can see how LightSwitch assigns a Date Picker control to the DateLoaned and DateReturned fields, of type Date. It also assigned a Modal Window Picker control to edit the association between a Loan and a Book.

image

When we run the application we can see how the controls assigned to Date fields looks:

image

The Modal Window Picker control allows searching and selecting a book to be associated with a loan. The control includes not only the search features, but also allows paging results.

image

Although this way to edit loans is not so bad, I would prefer to see the list of books, and from there to easily access each book’s loans, and eventually adding new books in the same place. The template for this kind of editing form is called List and Details Screen. Look how LightSwitch allows indicating if books’ and loans’ details should be included on the form.

image

Once the form is created, we can edit its definition. Like in previous cases, I only slightly change the name to display and add a description.

image

We can see how the new form looks when running the application. The list of books appears on the left. From there we can add, modify, and delete books. For the book selected in the list on the left, we can see the loans in the right. From there we can also add, modify, and delete loans.

image

Be aware that for adding and modifying books and loans, LightSwitch automatically generated a form with the same controls defined in their respective new record forms.

image

image

These forms have also the default behavior for validating the rules defined in the entities.

image

When more than one record is changed in a list, modifications are not sent to the database until the list is saved by using the Save button.

image

How much time takes this application to be created? Not too much, as you can see in this video:

 

You can download the video from here.

Okay, but what kind of applications is LightSwitch for? Perhaps we need to wait for a while to see who really takes advantage of this new technology. Simple applications like the one I created in this post can be created really quickly, but we all know that real world applications are not as easy to build as the ones I have demoed, are they? For non-professional or occasional developers –for whom other technologies like Microsoft Access or Visual FoxPro was created in the past-, LightSwitch can be their new preferred tool. Professional developer will probably not be able to build 100% of the complex business applications they create today by using LightSwitch, but at least they can use LightSwitch as a tool for rapid prototyping.

In certain places in the application definition we can write C# code to add functions not provided by LightSwitch -for business rules for example. But then we need to know the object model of the code generated by LightSwitch, to be able to consume from our own handwritten code the types automatically generated by LightSwitch.

Some of the templates seem to be extensible –this beta version includes templates lists with just an element, but probably it is because it is a beta. Furthermore, it seems that LightSwitch will be able to create applications for Windows Azure also. Since all the code and the database are generated from definitions, the same application could be migrated from the desktop to the cloud just by changing a setting in the project properties page.

With an object model easy to be consumed in extension points and a strong ecosystem augmenting LightSwitch capabilities, it looks like we will be able to use it to develop applications more complex than the one created here. It is too soon yet, time will tell.

Written by fernandomachadopiriz

August 20, 2010 at 12:50 am

Follow

Get every new post delivered to your Inbox.

Join 223 other followers