Monday, September 30, 2013

How to find the login security type for MS SQL Server

xp_loginconfig Reports the login security configuration of an instance of SQL Server.

exec master.sys.xp_loginconfig 'login mode'


xp_loginconfig (Transact-SQL)

Share/Bookmark

WCF Load Balancing – basicHttpBinding

To enable WCF service to take advantage of Load balancing with basicHttpBinding easily it needs to set keepAliveEnabled property of binding to false when there is connection reuse. When this property is enabled, will lead a client to maintain a persistent connection with the service which helps for performance side of view as the connection reuses with multiple messages. Ideally in a load balanced cluster the purpose is to avoid having sticky sessions and strongly associated a client with a server, a simple solution is utilizing the following configuration for custom binding:

<customBinding> <binding name="CustomHttpBindingConfig" closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00"> <textMessageEncoding /> <httpTransport keepAliveEnabled="false" /> </binding> </customBinding>


Another approach to apply necessary changes through the code discussed before in “WCF service under Network Load Balancing (NLB)” blog entry.

Share/Bookmark

Tuesday, September 24, 2013

Add SSRS (SQL Reporting Services) to an existing SQL Server Clustered Instance

To add a SSRS feature to already installed SQL server cluster it's necessary to bypass checking HasClusteredOrPreparedInstance rule before running setup file otherwise the unstallation will encounter with error during "Installaation Rules" check with some popup message like following:



To avoid above mentioned error it's possible to run setup as following:
Setup.exe /SkipRules=StandaloneInstall_HasClusteredOrPreparedInstanceCheck /Action=Install


Share/Bookmark

SSRS (Reporting Services), Scale Out, Clusters, or NLB, ...

The question around installing Reporting Services as part of a SQL Cluster install with attention to the fact that SSRS is not cluster aware and utilizing NLB if you want to do it (even though it's not recommended) ended up in the following URL which I would like to share here.

Share/Bookmark

Monday, September 23, 2013

How to find out installed features on SQL server instance

The SQL Server Setup Discovery Report helps to view installed features on a local SQL server instance,

Start menu --> All Programs --> Microsoft SQL Server --> Configuration Tools --> SQL Server Installation Center --> Click the "Tools" --> "Installed SQL Server features discovery report"



The command line version would be like the folowing:
setup.exe /ACTION=RUNDISCOVERY /Q

The setup.exe is located somewhere like (for MS SQL Server 2012):
C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012

The report will be located in log folder under "Setup Bootstrap" in a unique subfolder which will be named as YYYYMMDD_HHmmSS, but the location can be vary depend on installation location:
C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\YYYYMMDD_HHmmSS

Share/Bookmark

Thursday, September 19, 2013

SSRS Line Spacing

LineHeight property of Textbox control works just when the report renders in HTML format, to control line spacing in a Multi line textbox which carries a long text who handles auto text wrap up doesn't functions correctly.

Vote up for the following item in Microsoft Connect:
https://connect.microsoft.com/SQLServer/feedback/details/557661/line
Share/Bookmark

Friday, September 13, 2013

JavaScript - Calling function "statements" before definition

function statements get interpreted and will be added to the execution stack before code execution then that's the reason but have attention that it doesn't happen to neither function expressions nor functions which define by Function constructor.

<!DOCTYPE html><html lang="en"><body><script> // logs 11 console.log(aFunc(1, 2, 3)); function aFunc(x, y, z) { return x*y + arguments[0]*arguments[1]*arguments[2] };
// logs "Uncaught TypeError: ..." console.log(iFunc(1, 2, 3)); var iFunc = function (x, y, z) { return x*y + arguments[0]*arguments[1]*arguments[2] };
// logs "Uncaught TypeError: Property 'bFunc' of object [object Object] is not a function" console.log(bFunc(1, 2, 3)) var bFunc = function (x, y, z) { return x*y + arguments[0]*arguments[1]*arguments[2] }; </script></body></html>

Share/Bookmark

Thursday, September 12, 2013

Non-primitive [false] Boolean object is actually [true]

A Boolean object with false parameter (not the primitive false value) which generated from the Boolean() constructor, the object value will be true to check you may use it in an "if" condition.

If a value is false, undefined, null, NaN, 0, -0, or an empty string(""), it is false! but any other value in JavaScript will be converted to true if used in a Boolean context.

<!DOCTYPE html> <html lang="en"> <body> <script> var myBoolean = new Boolean(false); console.log( myBoolean ); console.log( myBoolean.toString() ); console.log( myBoolean.valueOf() ); if( myBoolean ) console.log( typeof myBoolean ); </script> </body> </html>

Share/Bookmark

Wednesday, September 11, 2013

JavaScript - references to object properties

if the property of an object which you try to access is not available, JavaScript will try searching the prototype chain. At first steps it goes after the constructor function that created the object to check its prototype (e.g., Array.prototype) and if that's not available there it keeps searching up the chain at the constructor behind the initial constructor.

As all those prototype properties are objects, the final step would be Object.prototype because there is no other constructor prototype property upper than Object level to be examined.

Anyway if finally JavaScript can't find the property it would have produced an error stating that the property was undefined.

<!DOCTYPE html><html lang="en"> <body> <script> var myArray = ['element1', 'element2']; console.log(myArray.hasOwnProperty('join')); console.log(myArray.join());
console.log(myArray.hasOwnProperty('toLocaleString')); console.log('toLocaleString' in myArray); console.log(myArray.toLocaleString());
</script> </body> </html>

Share/Bookmark

Javascript console.log for web browsers

Javascript console.log for web browsers by console.log you may view any output message, other debugging tools or plugins can be utilized too for this purpose which are generally better as they provide rich features for debugging (e.g Firebug, ...).

To open the console window the following keywords work depend on the web browser:

console window
<b>Internet Explorer<\b> F12 to open the developer tools, then
Ctrl+3 to open the console window
<b>Chrome<\b> Ctrl+Shift+J
<b>Firefox<\b> Ctrl+Shift+K
<b>Safari<\b> Ctrl+Alt+I

Share/Bookmark

Tuesday, September 10, 2013

Enable/Disable - SSRS Export Types

SSRS supports exporting to different formats when you view the report through a drop-down list. Report services server configuration file which is available in the following path allows to control the list:
C:\Program Files\Microsoft SQL Server\MSSQL.2\Reporting Services\ReportServer\rsreportserver.config

Inside the <Render> tag elements, the Extension names have Visible attribute which changing them to true will make the Extension visible in the Export list.
Example:


Share/Bookmark

Thursday, September 5, 2013

TSQL - Count number of lines in string

Counting \r\n in a TSQL string and determine the number of new lines.
DECLARE @str VARCHAR(128) SET @str = RTRIM(LTRIM( 'Line 1' + CHAR(13)+CHAR(10) + 'Line 2' + CHAR(13)+CHAR(10) + 'Line 3' + CHAR(13)+CHAR(10) + 'Line 4' )) SELECT @str , (LEN(@str) - LEN(REPLACE(@str, CHAR(13)+CHAR(10), ''))) / 2 + IIF( CHARINDEX(CHAR(10)+CHAR(13), REVERSE(@str), 0) = 1, 0, 1) AS strNoOfLines

Share/Bookmark