Monday, August 21, 2017

SQL Server



SQL Server:


Number of tables and sizes (Credit : stack overflow)

SELECT
    t.NAME AS TableName,
    s.Name AS SchemaName,
    p.rows AS RowCounts,
    SUM(a.total_pages) * 8 AS TotalSpaceKB,
    CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceMB,
    SUM(a.used_pages) * 8 AS UsedSpaceKB,
    CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB,
    (SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,
    CAST(ROUND(((SUM(a.total_pages) - SUM(a.used_pages)) * 8) / 1024.00, 2) AS NUMERIC(36, 2)) AS UnusedSpaceMB
FROM
    sys.tables t
INNER JOIN  
    sys.indexes i ON t.OBJECT_ID = i.object_id
INNER JOIN
    sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
INNER JOIN
    sys.allocation_units a ON p.partition_id = a.container_id
LEFT OUTER JOIN
    sys.schemas s ON t.schema_id = s.schema_id
WHERE
    t.NAME NOT LIKE 'dt%'
    AND t.is_ms_shipped = 0
    AND i.OBJECT_ID > 255
GROUP BY
    t.Name, s.Name, p.Rows
ORDER BY
    t.Name


Size of Index


SELECT
    i.[name] AS IndexName,
    t.[name] AS TableName,
    SUM(s.[used_page_count]) * 8 AS IndexSizeKB
FROM sys.dm_db_partition_stats AS s
INNER JOIN sys.indexes AS i ON s.[object_id] = i.[object_id]
    AND s.[index_id] = i.[index_id]
INNER JOIN sys.tables t ON t.OBJECT_ID = i.object_id
GROUP BY i.[name], t.[name]
ORDER BY i.[name], t.[name]





Monday, July 24, 2017

Redshift Spectrum



http://docs.aws.amazon.com/redshift/latest/dg/c-getting-started-using-spectrum-query-s3-data.html



Dabbling with Redshift Spectrum






Keep your larger fact tables in Amazon S3 and your smaller dimension tables in Amazon Redshift, as a best practice. If you loaded the sample data in Getting Started with Amazon Redshift, you have a table named EVENT in your database. If not, create the EVENT table by using the following command.


Amazon Redshift uses massively parallel processing (MPP) to achieve fast execution of complex queries operating on large amounts of data. Redshift Spectrum extends the same principle to query external data, using multiple Redshift Spectrum instances as needed to scan files. Place the files in a separate folder for each table.


Tuesday, July 4, 2017

Docker Mangento

MVC , MVP , MVVM on Android



http://stackoverflow.com/questions/2056/what-are-mvp-and-mvc-and-what-is-the-difference




http://www.bigdev.de/2014/02/gui-design-patterns-mvc-mvp-vs-mvvm.html


https://news.realm.io/news/eric-maxwell-mvc-mvp-and-mvvm-on-android/



https://code.tutsplus.com/tutorials/an-introduction-to-model-view-presenter-on-android--cms-26162




Model-View-Presenter

 For example, when someone clicks the "Save" button, the event handler delegates to the Presenter's "OnSave" method. Once the save is completed, the Presenter will then call back the View through its interface so that the View can display that the save has completed.



AWS Scripting



brew tap wallix/awless; brew install awless


awless config set aws.profile devawless config set aws.profile prod


awless list instances --filter name=api2-ASG production1


Aws Links

xamarin mobile development





https://app.pluralsight.com/library/courses/play-by-play-xamarin-mobile-development/table-of-contents

Sunday, June 18, 2017

Host file, local host and Virus Scanner



https://security.stackexchange.com/questions/96418/localhost-loopback-risk





Catching up on Android 2017

Sunday, June 4, 2017

Managing Elastic Search Domains



http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-managedomains.html



To prevent overloading a dedicated master node, you can monitor usage with the Amazon CloudWatch metrics that are shown in the following table. Use a larger instance type for dedicated master nodes when these metrics reach their respective maximum values.







FreeStorageSpace (Minimum)Specifies the free space, in megabytes, for the single data node with the least available free space in a cluster. Amazon ES throws a ClusterBlockExceptionwhen this metric reaches 0. To recover, you must either delete indices, add larger instances, or add EBS-based storage to existing instances. For more information, see Recovering from a Lack of Free Storage Space.
Relevant statistics: Minimum
CloudWatch MetricGuideline
MasterCPUUtilizationMeasures the percentage utilization of the CPU for the dedicated master nodes. We recommend increasing the size of the instance type when this metric exceeds 40% with a domain status of Active and exceeds 60% with a domain status of Processing.
MasterJVMMemoryPressureMeasures the percentage utilization of the JVM memory for the dedicated master nodes. We recommend increasing the size of the instance type when this metric exceeds 60% with a domain status of Active and exceeds 85% with a domain status of Processing.