This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @adding_cols NVARCHAR(MAX) = '', @sql NVARCHAR(MAX) = '' | |
IF NOT EXISTS (SELECT * | |
FROM [DWH].INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'SAT_Unfinished_Building_Subjects' | |
AND table_schema = 'frm' AND column_name = 'City') | |
SET @adding_cols = @adding_cols + 'City NVARCHAR(255), ' | |
IF NOT EXISTS (SELECT * | |
FROM [DWH].INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = N'SAT_Unfinished_Building_Subjects' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Плохо: Ср.задержка одной операции > 20 мсек | |
USE master | |
GO | |
SELECT cast(db_name(a.database_id) AS VARCHAR) AS Database_Name | |
, b.physical_name | |
--, a.io_stall | |
, a.size_on_disk_bytes | |
, a.io_stall_read_ms / a.num_of_reads 'Ср.задержка одной операции чтения' | |
, a.io_stall_write_ms / a.num_of_writes 'Ср.задержка одной операции записи' | |
--, * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function Str2Date(strInput As String) As Date | |
If Trim(strInput & vbNullString) <> vbNullString Then | |
If IsDate(strInput) Then | |
If Year(strInput) = 1899 Then | |
Str2Date = strInput | |
Exit Function | |
End If | |
End If | |
Dim regEx As New RegExp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'vosipov' | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
import csv | |
import codecs | |
from geopy import Yandex | |
geolocator = Yandex() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
from geopy.geocoders import Yandex | |
from openpyxl import load_workbook | |
filename = 'realty.xlsx' | |
wb = load_workbook(filename) | |
ws = wb.get_sheet_by_name('data') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import datetime | |
import cProfile | |
import pstats | |
pr=cProfile.Profile() | |
pr.enable() | |
requests.get('http://torgi.gov.ru/lotSearchArchive.html') | |
pr.disable() | |
p = pstats.Stats(pr).sort_stats('tottime').print_stats() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Сделать POST-запрос для фильтра по дате | |
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); | |
doc.LoadHtml(page_content); | |
HtmlNode node = doc.DocumentNode.SelectSingleNode(".//*[@id='lot_search']/../@onclick"); | |
string id_s = node.Attributes["onclick"].Value; | |
var pat = @"id(..)"; | |
var id = Regex.Matches(id_s, pat)[0].Groups[1].Value; | |
var date_filter_body = String.Format("id{0}_hf_0=&extended%3AbidOrganization%3AbidOrganizationName=&extended%3AbidOrganization%3AbidOrganizationLocation=&extended%3AbidOrganization%3AbidOrganizationInn=&extended%3AbidOrganization%3AbidOrganizationKinds%3AmultiSelectText=&extended%3AbidOrganization%3AbidOrganization=&extended%3AbidExtended%3AbidNumber=&extended%3AbidExtended%3AbidStatusId=&extended%3AbidNumberExtended%3AbidFormId=&extended%3AbidNumberExtended%3AdetailComplaintType=&extended%3AbidNumberExtended%3AexpireDateFrom=&extended%3AbidNumberExtended%3AexpireDateTo=&extended |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH MEMBER [Measures].[Caption for Today] AS Format(Now(), 'MMMM dd, yyyy') | |
MEMBER [Measures].[Member's Unique Name] AS [Date].[Calendar].CurrentMember.UniqueName | |
MEMBER [Measures].[Key for Today] AS Format(Now(), 'yyyyMMdd') | |
MEMBER [Measures].[Key for Today (AW)] AS '2007' + Right([Measures].[Key for Today], 4) | |
MEMBER [Measures].[Today (string)] AS '[Date].[Calendar].[Date].&[' + [Measures].[Key for Today (AW)] + ']' | |
SET [Today] AS StrToMember( [Measures].[Today (string)], CONSTRAINED ) | |
SET [Yesterday] AS [Today].Item(0).PrevMember | |
SET [This Month] AS [Today].Item(0).Parent | |
SET [Prev Month] AS [This Month].Item(0).PrevMember |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH MEMBER [Measures].[SMA 30] AS Avg( LastPeriods( 30, [Date].[Date].CurrentMember ), [Measures].[Internet Order Count] ) | |
SELECT { [Measures].[Internet Order Count], [Measures].[SMA 30] } ON 0, | |
{ [Date].[Date].[Date].MEMBERS } ON 1 | |
FROM [Adventure Works] | |
WHERE ( [Date].[Calendar Year].&[2008] ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH MEMBER [Measures].[Reseller Sales PP] As ( [Measures].[Reseller Sales Amount], ParallelPeriod( [Date].[Fiscal].[Fiscal Year], 1, [Date].[Fiscal].CurrentMember ) ) , FORMAT_STRING = 'Currency' | |
MEMBER [Measures].[Reseller Sales YoY %] As iif( [Measures].[Reseller Sales PP] = 0, null, ( [Measures].[Reseller Sales Amount] / [Measures].[Reseller Sales PP] ) ) , FORMAT_STRING = 'Percent' | |
SELECT { [Measures].[Reseller Sales Amount], [Measures].[Reseller Sales PP], [Measures].[Reseller Sales YoY %] } ON 0, | |
{ [Date].[Fiscal].[Month].MEMBERS } ON 1 | |
FROM [Adventure Works] |