Category Archives: Microsoft

Backup MySQL Security SQL Tips & tricks Tutorials web services Windows server

Schedule Mysql Backups to Amazon S3 in Windows server 2008 R2

1 – Access Amazon Services, S3
2 – Create a New Bucket if there’s no one.
3 – Create credentials in  IAM Amazon Services
4 – Download the tool s3.exe for windows, from s3.codeplex.com

read more »

Microsoft Windows 8 Windows server

Change product key in windows server 2012 or windows 8

1. Use slmgr

  • Open an elevated command prompt and type the following commands:
  • slmgr -upk
    This will remove the key first
  • slmgr -ipk xyzyx-xyzyx-xyzyx-xyzyx-xyzyx
    This will add your key. Of course replace the xyzyx-xyzyx with your own real key.
  • Activate Windows (you will probably have popups already during this process)

2. Use slui.exe

  • Swipe in from the right edge of the screen, and then tap Search. Or, if you are using a mouse, point to the lower-right corner of the screen, and then click Search.
  • In the search box, type Slui.exe 0x3.
  • Tap or click the Slui.exe 0x3 icon.
  • Type your product key in the Windows Activation window, and then click Activate.

3. You can also use the Volume Activation Management Tool (VAMT) 3.0 to change the product key remotely, or if you want to change the product key on multiple computers.

The last two methods can be  found referenced in this KB: http://support.microsoft.com/kb/2750773

 

Hyper-V Microsoft

How to remove a VM from Hyper-V

Delete the VM from Hyper-V Manager: Open Hyper-V Manager right click the VM you want to remove and click Delete.

This only removed the VM from that Hyper-V Manager.  It did not delete the VMs files.

This is good for porting this VM to another Hyper-V host or back to the original

Microsoft SQL SQL Server

SQL Server, Common Table Expressions

A common table expression (CTE) can be thought of as a temporary result set that is defined within the execution scope of a single SELECT, INSERT, UPDATE, DELETE, or CREATE VIEW statement. A CTE is similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. Unlike a derived table, a CTE can be self-referencing and can be referenced multiple times in the same query.

A CTE can be used to:

  • Create a recursive query. For more information, see Recursive Queries Using Common Table Expressions.
  • Substitute for a view when the general use of a view is not required; that is, you do not have to store the definition in metadata.
  • Enable grouping by a column that is derived from a scalar subselect, or a function that is either not deterministic or has external access.
  • Reference the resulting table multiple times in the same statement.

Using a CTE offers the advantages of improved readability and ease in maintenance of complex queries. The query can be divided into separate, simple, logical building blocks. These simple blocks can then be used to build more complex, interim CTEs until the final result set is generated.

CTEs can be defined in user-defined routines, such as functions, stored procedures, triggers, or views.

read more »

SQL SQL Server Transact-SQL

Recursive Queries using Common Table Expressions (CTE) in SQL Server

Given the example , hierarchical data structures, organizational charts and other parent-child table relationship reports can easily benefit from the use of recursive CTEs. Common Table Expression is just one of those T-SQL enhancements available for SQL Server 2005. CTEs bring us the chance to create much more complex queries while retaining a much simpler syntax. They also can lessen the administrative burden of creating and testing views for situations where the view will not be reused.

Syntax

WITH cte_alias (column_aliases)
AS
(
cte_query_definition   --initialization
UNION ALL
cte_query_definition2 --recursive execution
)
SELECT * FROM cte_alias

Sample (from Root nodes to Leaf  noes)

WITH Managers AS
(
--initialization
SELECT EmployeeID, LastName, ReportsTo
FROM Employees
WHERE ReportsTo IS NULL
UNION ALL
--recursive execution
SELECT e.employeeID,e.LastName, e.ReportsTo
FROM Employees e INNER JOIN Managers m
ON e.ReportsTo = m.employeeID
)
SELECT * FROM Managers

Sample (From Leaf nodes to Root nodes), where u must specifie the leaves to include/use.

WITH xEmployees AS
(
--initialization
SELECT  EmployeeID, LastName, ReportsTo
FROM Employees
WHERE EmployeeID IN (55,98,65,12)  -- sample Leaf nodes to filter/use
UNION ALL
--recursive execution
SELECT a.EmployeeID,a.LastName,a.ReportsTo
FROM Employees a INNER JOIN xEmployees m
ON a.EmployeeID = m.reportsTo
)
SELECT Distinct EmployeeID, LastName, ReportsTo  FROM xEmployees

!Importante to use “Distinct” statement!

SQL Server Transact-SQL

get a substring in SQL SERVER using space as separator

get a substring in SQL SERVER using space as separator


SELECT CASE CHARINDEX(' ', news.description, 40)
  WHEN 0 THEN news.description
  ELSE SUBSTRING(news.description, 0, CHARINDEX(' ', news.description, 40) - 0)
  END
 AS FirstWord
FROM news

source:
http://www.dreamincode.net/forums/topic/239440-how-can-i-get-a-substring-in-sql-server-using-space-as-separator/
CHARINDEX (Transact-SQL) http://msdn.microsoft.com/pt-pt/library/ms186323.aspx

SUBSTRING (Transact-SQL)http://msdn.microsoft.com/en-us/library/ms187748.aspx

.NET ASP.Net Microsoft

Enterprise Library

The Microsoft Enterprise Library is a collection of reusable software components (application blocks) designed to assist software developers with common enterprise development cross-cutting concerns (such as logging, validation, data access, exception handling, and many others). Application blocks are a type of guidance; they are provided as source code, test cases, and documentation that can be used “as is,” extended, or modified by developers to use on complex, enterprise-level line-of-business development projects.

read more »

Microsoft Tips & tricks Windows 8

How to close Apps in Windows 8

There are 4 ways you can close metro apps in the new Windows 8:

  1. If you have a touch screen tablet or laptop, touch your finger on the top of the screen and drag it all the way to the bottom. It will minimize and move the app from your way.
  2. If you don’t have a touch screen but you use a mouse, do the same with the mouse. Point your mouse on the top of the screen and drag it all the way down. When you point the mouse to the top of the screen, you can see the cursor is changing.
  3. Press ALT key + F4. This will still work just like the traditional Windows programs.
  4. The killer option: use ALT+CTRL+DEL and kill the app using the task manager.

 

Microsoft Tips & tricks Windows 8

Windows 8 Activation Error: DNS name does not exist Error Code: 0x8007232B

Depending on where the installation media was obtained from (MSDN, TechNet subscription download,..) the activation wizard  by default will look for a Key Management Service (KMS) host on your internal network. It will not try to activate using the internet to reach Microsoft Activation servers.

The solution is to manually change the product key to a Multiple Activation Key (MAK) most likely provided with your MSDN or TechNet subscription.

To change the product key, use the slmgr.vbs script included with your Windows installation.

  1. Run the command prompt as an administrator
  2. Enter slmgr -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx where xxxxx-xxxxx-xxxxx-xxxxx-xxxxx is your product key.
Microsoft Windows 8

Windows 8 RTM System Requirements

Today August 15th, 2012, Microsoft releases the RTM version of Windows 8 for MSDN and TechNet subscribers along with an evaluation version of Windows 8 Enterprise to early adopters and developers; if you want to give a try and not sure about minimum system requirements then this blog post helps you to determine whether your existing PC is capable to install it or not.

Microsoft has kept its promise that Windows 8 won’t require any more hardware than Windows 7. Grant George, Corporate VC of Windows Test repeats on Bulding Windows 8 blog what Microsoft has said in the past. So Windows 8 RTM works great on the same hardware that powers Windows Vista and Windows 7:

  • 1 GHz or faster 32-bit (x86) or 64-bit (x64) processor
  • 1 GB RAM (32-bit) or 2 GB RAM (64-bit)
  • 16 GB available hard disk space (32-bit) or 20 GB (64-bit)
  • DirectX 9 graphics device with WDDM 1.0 or higher driver
  • Taking advantage of touch input requires a screen that supports multi-touch
Got all… Then you can download the Windows 8 RTM and experience first-hand the beautiful, fast and fluid experience.