Monday, January 23, 2012

Visual Studio Command to Collapse/Expand all sections of code

CTRL + M + O will collapse all
CTRL + M + L will expand all
CTRL + M + P will expand and disable outlining
CTRL + M + M will collapse/expand the current section

CTRL + M, CTRL + L collapses/expands (toggles) all regions

Monday, November 28, 2011

MS-Word Easter Egg

Open MS-Word
type =Rand(3,8)
press Enter


On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create pictures, charts, or diagrams, they also coordinate with your current document look. You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can also format text directly by using the other controls on the Home tab. Most controls offer a choice of using the look from the current theme or using a format that you specify directly. To change the overall look of your document, choose new Theme elements on the Page Layout tab. To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command.
Both the Themes gallery and the Quick Styles gallery provide reset commands so that you can always restore the look of your document to the original contained in your current template. On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create pictures, charts, or diagrams, they also coordinate with your current document look. You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can also format text directly by using the other controls on the Home tab. Most controls offer a choice of using the look from the current theme or using a format that you specify directly. To change the overall look of your document, choose new Theme elements on the Page Layout tab.
To change the looks available in the Quick Style gallery, use the Change Current Quick Style Set command. Both the Themes gallery and the Quick Styles gallery provide reset commands so that you can always restore the look of your document to the original contained in your current template. On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks. When you create pictures, charts, or diagrams, they also coordinate with your current document look. You can easily change the formatting of selected text in the document text by choosing a look for the selected text from the Quick Styles gallery on the Home tab. You can also format text directly by using the other controls on the Home tab. Most controls offer a choice of using the look from the current theme or using a format that you specify directly.

Thursday, October 20, 2011

Excel: Searching inside a string

VBA = instr(string to be searched, string searching for, where to start)


formula:  = search()

Tuesday, October 18, 2011

Microsoft Home Use Program

If you have a valid SOCOM email address, you can take advantage of the Microsoft Home Use Program.


Program Code:  8FC2A88309

The cost for Microsoft Office is a staggering $9.95.

SELECT from a Stored Procedure

There are multiple ways of doing this.

Method #1

  1. if exists (select * from master..sysservers where srvname = 'loopback')     
  2. exec sp_dropserver 'loopback'
  3. go 

Method #2

  1. exec sp_addlinkedserver @server = N'loopback', @srvproduct = N'',     @provider, @datasrc = N'SQLOLEDB', = @@servername 
  2. go

Method #3

  1. select * into #t from openquery(loopback, 'exec yourSproc') 
  2. select * from #t 
  3. drop table #t


go


  

Export to XML from SQL Server

select EmployeeID, FirstName, LastName from employees
ORDER BY EmployeeID
FOR XML AUTO, elements




select EmployeeID, FirstName, LastName from employees
ORDER BY EmployeeID
FOR XML AUTO

Upload image into SQL Server 2005

INSERT INTO myTable(Document)
SELECT * FROM OPENROWSET(
     BULK N'C:\Inetpub\wwwroot\file.jpg', SINGLE_BLOB
) rs

SQL Server T-SQL table variable example

DECLARE @tblTravelRecords table (
     RequestID uniqueidentifier,
     TravelNumber varchar(7),
     EstimatedTravelCost decimal(11,2),
     [status] int
)

INSERT INTO @tblTravelRecords
SELECT pol.RequestID
     , pol.PONumber
     , CAST( subtotal + pol.Shipping + IsNull(pol.Discount,0) + pol.SalesTax as decimal(11,2) ) as 'EstimatedTravelCost'                             
     , pol.Status
FROM luPOStatus lu RIGHT JOIN (PurchaseOrderLog pol LEFT JOIN @tblPOsubtotal pod ON pol.RequestID=pod.RequestID) ON lu.StatusID=pol.Status
WHERE [Contract] = @Contract
          AND TaskNumber = @TaskNumber
          AND SubTask = @SubTask
          AND ( UseFFPFunds <> 1 OR UseFFPFunds IS NULL )