Sql Server: Backup all the databases of the instance

security8

They told me (Alessandro Alpi), to don’t blog this :) because there’s a lot of this stuff out there, but this my blog, and it is too cool when developing in load testing environment, and you need to backup, try load test data, and restore previous version, so forgive me about this:

sys.sp_MSforeachdb @command1 = N'BACKUP DATABASE [?] TO DISK = N''C:\_Databases\_Backup\Databases\?.bak'' WITH NOFORMAT, INIT'

Change the “C:\_Databases\_Backup\Databases\” into your default BackupDirectory found in the instance facets, to avoid security problem.

DON’T USE THIS CODE IN PRODUCTION!!

[MVP Summit 2014] Roslyn Hackathon, Analyzers!!

dotnet_logo

Today with my Italian friends (Raffaele Rialdi aka Raf, Marco Minerva and Renato Marzaro), we’re working on Roslyn, the new open source C# compiler by Microsoft community, in detail today we’re working on creating new analyzers, that helps developer with live feedback while developing, like validating a regular expression, before going live and see the exception at runtime, an analyzer can provide such a feedback while writing code / at compile-time.

Marco Minerva and me, we’re working on a regular expression analyzer, to help find if the literal regex written in code is valid, before run the application, will be just a prototype, and if it will works :) will be push it on github (check our repo, starting from next week).

Stay tuned!! :)

C# .NET – Collections Comparison

generic.net.collection.interfaces

I liked a James Michael Hare’s post “C#/.NET Fundamentals: Choosing the Right Collection Class“, and I like to re-blog the comparison table:

Collection Ordering Contiguous Storage? Direct Access? Lookup Efficiency ManipulateEfficiency Notes
Dictionary Unordered Yes Via Key Key:O(1) O(1) Best for high performance lookups.
SortedDictionary Sorted No Via Key Key: O(log n) O(log n) Compromise of Dictionary speed and ordering, uses binarysearch tree.
SortedList Sorted Yes Via Key Key:O(log n) O(n) Very similar toSortedDictionary, except tree is implemented in an array, so has faster lookup on preloaded data, but slower loads.
List User has precise control over element ordering Yes Via Index Index: O(1)
Value: O(n)
O(n) Best for smaller lists where direct access required and no sorting.
LinkedList User has precise control over element ordering No No Value:O(n) O(1) Best for lists where inserting/deleting in middle is common and no direct access required.
HashSet Unordered Yes Via Key Key:O(1) O(1) Unique unordered collection, like a Dictionary except key and value are same object.
SortedSet Sorted No Via Key Key:O(log n) O(log n) Unique sorted collection, like SortedDictionary except key and value are same object.
Stack LIFO Yes Only Top Top: O(1) O(1)* Essentially same as List except only process as LIFO
Queue FIFO Yes Only Front Front: O(1) O(1) Essentially same as List except only process as FIFO

PASS SQL Saturday Parma Agenda now available!

Originally posted on Alessandro Alpi's Blog:

PASS SQL Saturday Parma agenda is now available!

This is the timetable:
From        To
————————–
10:00       11:00
11:15       12:15
12:30       13:30
13:30       14:30
14:30       15:30
15:45       16:45
16:45       17:00
17:00       18:00
————————–
 
We will have three tracks:
  • BI, for Business Intelligence, BigData, xVelocity, etc.
  • DEV, for developers 
  • OPS, for operations and administration
Checkout the agenda here and organize your Saturday with the schedule builder!
 
Stay Tuned! :)
 
 
 
 

View original

Start all services filtering by Name and StartMode / StartupType using PowerShell

Sometimes I need to start or restart a lot of services belonging to my application, all having the product / company name as prefix, and I would like to start it all, but not the ones that are flagged as Manual.

To simple start all the services that match a prefix you would do something like this:

Start-Service "MyProduct*"

but when you need to start the service that are not flagged as Manual startup, there’s no command/filter directly in powershell command, but you need to use Wmi objects in this way:

Get-WmiObject win32_service | where { $_.Name -like "MyProduct*" -and $_.StartMode -ne "Manual" } | Start-Service

With the same syntax you can of course, do Get-Service, Stop-Service, and all the other related commands.

RabbitMQ: Completely Hard Reset a RabbitMQ Server Installation

clean-rabbitmq

Probably the most exciting thing of this post is the funny image of RabbitMQ’s cleaner :)

Yes, you can also reset the RabbitMQ instance, by running these commands:

rabbitmqctl.bat stop_app

rabbitmqctl.bat reset

rabbitmqctl.bat start_app

soft-reset-rabbitmq

…but sometimes could be necessary to clean up stuff, especially when you have played around cluster, multiple node on the same machine, ad so on.

It took me a while to figure out who was maintaining a reference to the %appdata%\RabbitMQ folder, even after I uninstalled Erlang, so here’s the simple steps:

  1. Uninstall RabbitMQ Server
  2. Kill the process epmd.exe (this was the process maintaning a reference to the RabbitMQ folder)
    rabbitmq-epmd-process
  3. Delete the folder RabbitMQ that is under %appdata%
    rabbitmq-folder-wont-delete If you also want to change the erlang cookie, you will need to delete also the file “.erlang.cookie” that you find under your users folder %userprofile%
    rabbitmq-erlang-cookie If you have a cluster and remove .erlang.cookie the node would no be able to rejoin the cluster
  4. Reinstall RabbitMQ Server

 

That’s all folks!

Use Microsoft App Studio to create professional Apps for Windows and Windows Phone

Originally posted on Robin Sedlaczek's Blog:

Introduction

In 2013 Microsoft published the App Studio Beta (http://appstudio.windows.com/). With the App Studio web application, it is very easy to create Windows and Windows Phone applications. You do not need to write a line of code to create professional apps. In this post I like to give a short overview of App Studio, how easy it is to create apps and the code behind your apps.

Overview

Once you have a Microsoft account, you can log on the App Studio and start creating projects. The image below shows the My projects page where all your apps are listed. You can create new apps, edit existing apps or delete them.

Image

App Studio Project List

To create a new app, simply click the “Start new project” button. The following page let you select a template for your app. There is a bunch of layout templates you can use depending on your…

View original 1,717 more words

Software on the hosted build server

Took directly from visual studio site: Hosted build controller.

You can check the detail list, and install the visual studio extension “Avanade Extensions for VS2012” (VS2013 version) to track the software installed on the hosted build server using the Software Inventory functionality.

The hosted build server is deployed with the following software:

  • Windows Server 2012 R2, 64-bit environment, with Windows PowerShell
  • Team Foundation Build (Team Foundation Server 2013)
  • Visual Studio
    • Visual Studio 2013 Update 2 RC
    • Visual Studio SDK 2013 RTM
    • Visual Studio 2012 Ultimate Update 4
    • Visual Studio SDK 2012 RTM
    • Visual Studio 2010 SP1
  • The .NET Framework
    • .NET 4.5.1
    • .NET 4.5
    • .NET 3.5 SP1
  • Microsoft Azure
    • SDK 2.3
    • SDK 2.2
    • SDK 2.1
    • SDK 2.0
    • SDK 1.8
    • SDK 1.7
  • Other components
    • Apache ANT 1.9.3
    • Apache Maven 3.1.1
    • Java Standard Edition Development Kit 1.7 U51
    • Microsoft Office Developer Tools for Visual Studio 2013 Update 1
    • Node.js 0.10.26
    • Node.js Tools 1.0 Alpha for Visual Studio 2013
    • SharePoint 2010 and SharePoint 2013
    • SQL Server Data Tools for Visual Studio 2010, Visual Studio 2012, and Visual Studio 2013
    • TFS Build Extensions
    • TypeScript 1.0
    • WIX Toolset 3.7
    • Web Deploy 3.0
    • Windows Phone SDK 8.0

 

RabbitMQ: Change the Hostname

rabbitmq-change-hostname

If you change the name of the machine where RabbitMQ server is installed, you will see that the service will no longer be startable, this because RabbitMQ relays on the machine name to create and connect to the node, even if it is local.

To fix this problem, you just have to reinstall the rabbitmq windows service, by using the proper command line utility rabbitmq-service.bat

*********************
Service control usage
*********************

rabbitmq-service help    - Display this help
rabbitmq-service install - Install the RabbitMQ service
rabbitmq-service remove  - Remove the RabbitMQ service

The following actions can also be accomplished by using
Windows Services Management Console (services.msc):

rabbitmq-service start   - Start the RabbitMQ service
rabbitmq-service stop    - Stop the RabbitMQ service
rabbitmq-service disable - Disable the RabbitMQ service
rabbitmq-service enable  - Enable the RabbitMQ service
  1. First start a command prompt as administrator and go to the rabbitmq-server-x sbin folder
    cd %programfiles(x86)%\RabbitMQ Server\rabbitmq_server-3.3.2\sbin
  2. Uninstall the service
    rabbitmq-service.bat remove
  3. Install the service
    rabbitmq-service.bat install

This should recreate the service and configure it to start the node with the correct name.

If this doesn’t work you can follow the instruction on how to completely reset a rabbitmq server installation.