Thursday, June 30, 2011

Convert string into Camel Case - SSRS


Convert string into Camel Case - SSRS
You can simply use
=StrConv("MY unpropER CASE LiNe", vbProperCase)

Reference for strconv ...
http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.strings.strconv(v=VS.80).aspx



Tuesday, February 1, 2011

Design Pattern


In Software Engineering, a design pattern is a repeatable solution to a common problem occuring in software design. It is more of as description or template for how to solve the problem that can be used in different situations.

Design Pattern
- Set of guidelines
- Provided solutions for common software design problems
- Consists of one or several software design elements such as modules, interfaces, classes, objects, methods, functions, processes, threads, etc.,
- Relationships among the elements, and a behavioral description


Advantages:
- Improve the structure of software
- Simplify maintenance
- Shared language for communicating
- Separation of concerns
- Minimize logic needed in views
- Enhance testability
- Reduce development time
- Easy to customize applications

Disadvantages:
- Design pattern can be overkill in Simple UI


The Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups: Creational, Structural, and Behavioral.

GOF: ??: The authors of the DesignPatternsBook came to be known as the "Gang of Four." The name of the book ("Design Patterns: Elements of Reusable Object-Oriented Software") is too long for e-mail, so "book by the gang of four" became a shorthand name for it. After all, it isn't the ONLY book on patterns. That got shortened to "GOF book", which is pretty cryptic the first time you hear it.
  1. Erich Gamma
  2. Richard Helm
  3. Ralph Johnson
  4. John Vlissides
DESIGN PATTERN CLASSIFICATIONS
- Creational patterns
- Structural patterns
- Behavioral patterns

Creational Patterns
Abstract Factory Creates an instance of several families of classes
Builder Separates object construction from its representation
Factory Method Creates an instance of several derived classes
Prototype A fully initialized instance to be copied or cloned
Singleton A class of which only a single instance can exist

Structural Patterns
Adapter Match interfaces of different classes
Bridge Separates an object’s interface from its implementation
Composite A tree structure of simple and composite objects
Decorator Add responsibilities to objects dynamically
Facade A single class that represents an entire subsystem
Flyweight A fine-grained instance used for efficient sharing
Proxy An object representing another object

Behavioral Patterns
Chain of Resp. A way of passing a request between a chain of objects
Command Encapsulate a command request as an object
Interpreter A way to include language elements in a program
Iterator Sequentially access the elements of a collection
Mediator Defines simplified communication between classes
Memento Capture and restore an object's internal state
Observer A way of notifying change to a number of classes
State Alter an object's behavior when its state changes
Strategy Encapsulates an algorithm inside a class
Template Method Defer the exact steps of an algorithm to a subclass
Visitor Defines a new operation to a class without change

More patterns
In software engineering, concurrency patterns are those types of design patterns that deal with multi-threaded programming paradigm. Examples of this class of patterns include:

Enterprise Application Integration (EAI) is defined as the use of software and computer systems architectural principles to integrate a set of enterprise computer applications. EAI is the discipline of integrating applications and data within the enterprise into automated business processes.

The Pattern Reference Model will describe as
- Business problem.
Ex: What is the business trying to do? In this we define the scope of the problem by decomposing the business topic into logical business areas from which the requirements for business services can be defined. This allows us to identify the business services needed to solve the business problem.

- Conceptual solution.
Ex: What is the shape of the IT solution? From these services, the first sets of IT services can be deduced and defined in a conceptual solution, and their business service levels can be described in the requirements.

- Logical solution.
Ex: What IT services do we need to realize the solution? In this we refine the IT services into more granular logical components, and mechanisms that are required to create the logical solution. In doing this we evaluate alternative ways of expressing the solution and choose the one we will take forward to implement.

- Physical solution.
Ex: With what infrastructural services will the solution be created? Now the logical solution is fully converted into a hardware and software topological diagram, with products and connections defined. This does not take much account of non-functional business requirements at this time, because it is a generic pattern. However it may identify variations (different options) that would be driven by a loose description of non-functional requirements (such as "very scaleable, very resilient" versus "small, inexpensive").

- Implementation solution.
Ex: How should the Microsoft technology be implemented in the solution? Finally we show more detail about how the Microsoft technology should be implemented in the particular physical configuration.




Tuesday, November 16, 2010

BI Interview ...

BI Interview – Donald Farmer BI Perspective

Today I want to share an amazing interview done by my friend Ella Maschiach’s with the “father” of Microsoft Business Intelligence… Mr. Donald Farmer. He’s responsible for the new amazing Microsoft products like Power Pivot and Sharepoint 2010. You can’t miss this interview. Ella… why do you not follow a career also as a journalist?
ehehhehehehehe



Tuesday, August 17, 2010

SSRS code - colour


http://blogs.msdn.com/bwelcker/archive/2006/09/26/End-of-Amnesia-_2800_Avoiding-Divide-By-Zero-Errors_2900_.aspx

http://blogs.msdn.com/davidlean/archive/2009/02/17/sql-reporting-how-to-conditional-color-1-4-the-basics-report-expressions-custom-code.aspx

Public Function ColorRYG_CTAS123(ByVal Value As Decimal, ByVal MaxPositive As Decimal
, ByVal MaxNegative As Decimal, ByVal Neutral As Decimal) As String
'Example: =code.ColorBack(expression, Max(expression), Min(expression), 0)
'=code.colorback( Fields!Sales.Value,max( Fields!Sales.Value),min( Fields!Sales.Value),0)
'Find Largest Range
Dim decRange As Decimal
Dim decPosRange As Decimal = Math.Abs(MaxPositive - Neutral)
Dim decNegRange As Decimal = Math.Abs(MaxNegative - Neutral)
decRange = IIf(decPosRange > decNegRange, decPosRange, decNegRange)
'Force color into Max-Min Range. Important if you want to Clip the color display to a subset of the data range.
Value = Switch((Value > MaxPositive), MaxPositive, Value <>
'Find Delta required to change color by 1/255th of a shade
Dim decColorInc As Decimal = 255 / decRange
'Find appropriate color shade
Dim iColor As Integer = CInt(Math.Round((Value - Neutral) * decColorInc))
'Return Appropriate +ve or -ve color
Dim strColor As String
If iColor >= 0 Then
'Green
iColor = 255 - iColor 'Thus 0 = White & 255 = Green
strColor = "#" & iColor.ToString("X2") & "FF00"
Else
'Red
iColor = iColor + 255 'NB iColour is -ve; -1 - -255
strColor = "#FF" & Math.Abs(iColor).ToString("X2") & "00"
End If
Return strColor
End Function
Public Function ColorRYG_CTAS45(ByVal Value As Decimal, ByVal MaxPositive As Decimal, ByVal MaxNegative As Decimal, ByVal Neutral As Decimal) As String
'Example: =code.ColorBack(expression, Max(expression), Min(expression), 0)
'=code.colorback( Fields!Sales.Value,max( Fields!Sales.Value),min( Fields!Sales.Value),0)
'Find Largest Range
Dim decRange As Decimal
Dim decPosRange As Decimal = Math.Abs(MaxPositive - Neutral)
Dim decNegRange As Decimal = Math.Abs(MaxNegative - Neutral)
decRange = IIf(decPosRange > decNegRange, decPosRange, decNegRange)
'Force color into Max-Min Range. Important if you want to Clip the color display to a subset of the data range.
Value = Switch((Value > MaxPositive), MaxPositive, Value <>
'Find Delta required to change color by 1/255th of a shade
Dim decColorInc As Decimal = 255 / decRange
'Find appropriate color shade
Dim iColor As Integer = CInt(Math.Round((Value - Neutral) * decColorInc))
'Return Appropriate +ve or -ve color
Dim strColor As String
If iColor >= 0 Then
'Green
iColor = 255 - iColor 'Thus 0 = White & 255 = Green
strColor = "#" & iColor.ToString("X2") & "FF00"
Else
'Red
iColor = iColor + 255 'NB iColour is -ve; -1 - -255
strColor = "#FF" & Math.Abs(iColor).ToString("X2") & "00"
End If
Return strColor
End Function
Public Function ColorRYG_Admissions(ByVal Value As Decimal, ByVal MaxPositive As Decimal, ByVal MaxNegative As Decimal, ByVal Neutral As Decimal) As String
'Example: =code.ColorBack(expression, Max(expression), Min(expression), 0)
'=code.colorback( Fields!Sales.Value,max( Fields!Sales.Value),min( Fields!Sales.Value),0)
'Find Largest Range
Dim decRange As Decimal
Dim decPosRange As Decimal = Math.Abs(MaxPositive - Neutral)
Dim decNegRange As Decimal = Math.Abs(MaxNegative - Neutral)
decRange = IIf(decPosRange > decNegRange, decPosRange, decNegRange)
'Force color into Max-Min Range. Important if you want to Clip the color display to a subset of the data range.
Value = Switch((Value > MaxPositive), MaxPositive, Value <>
'Find Delta required to change color by 1/255th of a shade
Dim decColorInc As Decimal = 255 / decRange
'Find appropriate color shade
Dim iColor As Integer = CInt(Math.Round((Value - Neutral) * decColorInc))
'Return Appropriate +ve or -ve color
Dim strColor As String
If iColor >= 0 Then
'Green
iColor = 255 - iColor 'Thus 0 = White & 255 = Green
strColor = "#" & iColor.ToString("X2") & "FF00"
Else
'Red
iColor = iColor + 255 'NB iColour is -ve; -1 - -255
strColor = "#FF" & Math.Abs(iColor).ToString("X2") & "00"
End If
Return strColor
End Function

Friday, June 4, 2010

Recruitment Sources

  • 6 Figure Jobs
  • AGT
  • Albertajobs.com
  • Arqana Technologies
  • BC TEL
  • CLEARNET
  • Calgaryjobshop
  • CallCareers.com
  • CanadaIT.com
  • Canjobs.com
  • CareerEdge
  • Columbus Group
  • Daedalian
  • Dice
  • ED TEL
  • EdmontonJobShop
  • HigherBracket
  • Hire Ground
  • HotJobs.com
  • Job Bank - Gov't of Canada
  • Jobboom
  • Jobshark
  • Monster
  • Monster.com
  • NWD Systems (Calgary) Inc.
  • Nicejobs
  • OfficeJobs.com
  • OttawaJobShop.ca
  • QUEBEC TEL
  • QUEBEC TEL Mobilite
  • ReginaJobShop
  • SaskatoonJobShop
  • Sprott-Shaw
  • T-Net
  • TELUS
  • TELUS Mobility
  • Tactics for Success
  • WeHire.ca
  • Williams Communications Canada Inc.
  • WinnipegJobShop
  • WorkingCalgaryJobs.com
  • Workopolis Campus
  • Yummy Mummy Careers
  • bctechnology.com
  • callcentrejob.ca
  • jobsfordads.com
  • realpac.ca
  • salesjobsCanada.com
  • working.com
  • workopolis.com

Asp.net / Ajax




To Create Ajax - Loading image creators

Thursday, June 3, 2010

Tools - Series one more

Free software


Paid for software
Visual Studio 2008 Pro (however code should be usable by VS2008 express versions)
SQL2005/2008 Developer Edition (however TSQL should be usable by express versions)
ReSharper.Com http://www.jetbrains.com/resharper/download/ was used to optimise the code.
Vipre from http://www.sunbelt-software.com - an excellent anti-virus and anti-spyware program.

Thursday, May 6, 2010

SSRS Dates Fun


SSRS 2005
If you want to set the parameter / textbox with Date to format ... You can try this.
=Format(Today(), "yyyyMMdd")

If you want to subtract (or add), you can try the below syntax
=Format(DateAdd("d", -1, Today()), "yyyyMMdd")
=Format(DateAdd(DateInterval.Day, -1, Today()), "yyyyMMdd")

MSFT did not provide full details ... but this one will helpful

Friday, April 23, 2010

SQL Backup database - plan using same file name

How to SQL backup database, using scheduled maintenance plans to overwrite the same file name every time the backup is processed?

Solution:

Create a maintenance plan with t-sql in the job step similar to:

exec master.dbo.xp_backup_database @database = '', @filename = 'E:\Backup\_Daily.Bak', @backupname = ' backup', @desc = 'Backup of daily', @logging = 0, @with = 'SKIP', @init= 1, @with = 'STATS = 10'

Note, if the files with same name are overwriting with each backup, there will never be more than one archived backup on that destination.

Thursday, April 8, 2010

Example of With Rollup and With Cube in SQL 2005

Cool: Technique with Rollup and with cube in SQL 2005.

Declare @TempTableData table
(
Customer varchar(50),
ItemName varchar(50),
Quantity int,
PricePerItem float
);

Insert into @TempTableData
Select 'Sreedhar', 'Item 1', 2, 60.00 Union all
Select 'Sreedhar', 'Item 2', 2, 40.00 Union all
Select 'Vankayala', 'Item 1', 1, 60.00 Union all
Select 'Vankayala', 'Item 2', 1, 40.00 Union all
Select 'Vankayala', 'Item 3', 1, 10.00

-- Select all from table
Select * from @TempTableData;

-- Select all with calculated price
SELECT Customer, ItemName, SUM(Quantity * PricePerItem) as Price
FROM @TempTableData
GROUP BY Customer, ItemName

-- Select all with calculated price (with ROLLUP)
SELECT
Case when grouping(Customer) = 1 then 'All Customers' else Customer end as Customer,
Case when grouping(ItemName) = 1 then 'All Items' else ItemName end as ItemName,
SUM(Quantity * PricePerItem) as Price
FROM @TempTableData
GROUP BY Customer, ItemName
With ROLLUP

-- Select all with calculated price (with CUBE)
SELECT
Case when grouping(Customer) = 1 then 'All Customers' else Customer end as Customer,
Case when grouping(ItemName) = 1 then 'All Items' else ItemName end as ItemName,
SUM(Quantity * PricePerItem) as Price
FROM @TempTableData
GROUP BY Customer, ItemName
With CUBE


Results for the above SQL:

Customer ItemName Quantity PricePerItem
Sreedhar Item 1 2 60
Sreedhar Item 2 2 40
Vankayala Item 1 1 60
Vankayala Item 2 1 40
Vankayala Item 3 1 10

(5 row(s) affected)

Customer ItemName Price
Sreedhar Item 1 120
Vankayala Item 1 60
Sreedhar Item 2 80
Vankayala Item 2 40
Vankayala Item 3 10

(5 row(s) affected)

Customer ItemName Price
Sreedhar Item 1 120
Sreedhar Item 2 80
Sreedhar All Items 200
Vankayala Item 1 60
Vankayala Item 2 40
Vankayala Item 3 10
Vankayala All Items 110
All Customers All Items 310

(8 row(s) affected)


Customer ItemName Price
Sreedhar Item 1 120
Sreedhar Item 2 80
Sreedhar All Items 200
Vankayala Item 1 60
Vankayala Item 2 40
Vankayala Item 3 10
Vankayala All Items 110
All Customers All Items 310
All Customers Item 1 180
All Customers Item 2 120
All Customers Item 3 10

(11 row(s) affected)