Tuesday, October 01, 2019

Best Smartphones/tech of 2019

So I was looking for the best tech of 2019.

Here it goes:

New Pixel 3 XL
Google - Pixel 3 XL with 64GB Memory Cell Phone (Unlocked) - Just Black

 Refurbished Pixel 3 XL


Pixel 2 XL
Google Pixel 2 XL 64 GB, Black (Renewed)

Will be adding more stuff as time goes by.

Enjoy IT!

Monday, December 24, 2018

SOLID Principle

S.O.L.I.D stands for:
When expanded the acronyms might seem complicated, but they are pretty simple to grasp.

S - Single-responsiblity principle
O - Open-closed principle
L - Liskov substitution principle
I - Interface segregation principle
D - Dependency Inversion Principle


Single-responsibility Principle
S.R.P for short - this principle states that:
A class should have one and only one reason to change, meaning that a class should have only one job.

Open-closed Principle
Objects or entities should be open for extension, but closed for modification.

Liskov substitution principle
Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.

Interface segregation principle
A client should never be forced to implement an interface that it doesn't use or clients shouldn't be forced to depend on methods they do not use.


Dependency Inversion principle
Entities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions.

Conclusion
Honestly, S.O.L.I.D might seem to be a handful at first, but with continuous usage and adherence to its guidelines, it becomes a part of you and your code which can easily be extended, modified, tested, and refactored without any problems.

Monday, July 09, 2018

Android Style Action Bar Transperency


I had a problem that in Android the Action Bar was always showing as Transparent.
To fix this, what i did was just remove a line from the Styles of v21

Block this line

   
item name="android:statusBarColor" @android:color/transparent



Wednesday, October 14, 2015

Reality

There were some people moving furniture from a house. The neighbors saw them, and thought that may be there neighbor is moving to another place.
After they left, the police came. And started asking "did you see the thief?". 

Elections looked fine, until people started coming up with the problems that they faced. So if someone stole my vote, i have to say it. Even if its the 100th time. I will not let any one steal and get away with it. Don't tell me that you shouted last time too. 


Sunday, March 08, 2015

Recursive Function in SQL Query


What i wanted to do was to make a function that will give me all the people under 1 manager.
So there could be managers under 1 manager ans so on.

This is what i did.

alter FUNCTION fGetManager
(     
       @EmployeeID bigint
)
RETURNS TABLE
AS
RETURN
(
WITH DR ( KID, NAME, Manager) AS (
SELECT KID, NAME, Manager FROM Employees K WHERE KID = @EmployeeID
UNION ALL
SELECT K.KID, K.NAME, K.Manager FROM Employees K INNER JOIN DR D ON K.Manager= D.KID
)
SELECT kid FROM DR
)
GO


--Using this function

--SELECT * FROM Employees where kid in ( select * from [dbo].[fGetManager] (2))

Enjoy IT!

Monday, January 20, 2014

Select Random Rows from SQL Server DB Table


Wanted to select random rows from a table for some analysis. Found this.

 SELECT * FROM TABLENAME
  WHERE (ABS(CAST(
  (BINARY_CHECKSUM
  (COLUMNNAME, NEWID())) as int))
  % 100) < 1

Sunday, November 18, 2012

Convert Column names to Captions

I wanted to convert a column name from the database to a caption.
E.g:
DBType  to "DB Type"
ApplicationURL to "Application URL"
This is what i did for it.
C# code

public static string ReturnColumnCaption(String f)
        {
            string s = "";
            char o = '\0';
            for (int i = 0; i <= f.Trim().Length - 1; i++)
            {
                char c = f.Substring(i, 1)[0];
                if (char.IsUpper(c))
                {
                    if (char.IsUpper(o))
                    {
                        if (i + 1 < f.Trim().Length)
                        {
                            char t = f.Substring(i + 1, 1)[0];
                            if (char.IsUpper(t))
                            {
                                s += c;
                            }
                            else
                            {
                                s += " " + c;
                            }
                        }
                        else
                        {
                            s += c;
                        }
                    }
                    else
                    {
                        s += " " + c;
                    }

                }
                else
                {
                    s += c;
                }
                o = c;
            }
            return s.Trim();
        }

VB.NET
Private Function ReturnColumnCaption(ByVal f As String) As String

        Dim s As String = ""
        Dim o As String = ""
        For i As Integer = 0 To f.Trim.Length - 1
            Dim c As Char = f.Substring(i, 1)
            If Char.IsUpper(c) Then
                If Char.IsUpper(o) Then
                    If i + 1 < f.Trim.Length Then
                        Dim t As Char = f.Substring(i + 1, 1)
                        If Char.IsUpper(t) Then
                            s += c
                        Else
                            s += " " + c
                        End If
                    Else
                        s += c
                    End If
                Else
                    s += " " + c
                End If

            Else
                s += c
            End If
            o = c
        Next
        Return s.Trim()
    End Function

Best Smartphones/tech of 2019

So I was looking for the best tech of 2019. Here it goes: New Pixel 3 XL Google - Pixel 3 XL with 64GB Memory Cell Phone (Unlocked) - ...