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
from time import sleep_ms | |
from machine import Pin, I2C | |
# Default Address | |
SI7021_I2C_DEFAULT_ADDR = 0x40 | |
# Commands | |
CMD_MEASURE_RELATIVE_HUMIDITY_HOLD_MASTER_MODE = 0xE5 | |
CMD_MEASURE_RELATIVE_HUMIDITY = 0xF5 | |
CMD_MEASURE_TEMPERATURE_HOLD_MASTER_MODE = 0xE3 |
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
private bool CheckIfColumnExists(string tableName, string columnName) | |
{ | |
using(var conn = new SQLiteConnection("Data Source=mydb.sqlite;")) | |
{ | |
conn.Open(); | |
var cmd = conn.CreateCommand(); | |
cmd.CommandText = string.Format("PRAGMA table_info({0})", tableName); | |
var reader = cmd.ExecuteReader(); | |
int nameIndex = reader.GetOrdinal("Name"); |
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
@echo off | |
rem | |
rem **************************************************************************** | |
rem | |
rem Copyright (c) Microsoft Corporation. All rights reserved. | |
rem This code is licensed under the Microsoft Public License. | |
rem THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF | |
rem ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY | |
rem IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR | |
rem PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. |
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
<?xml version="1.0"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/10/XMLSchema-instance" | |
version="1.0"> | |
<xsl:output method="html"/> | |
<xsl:template match="/"> | |
<HTML> | |
<BODY> | |
<xsl:apply-templates select="//xsd:complexType[@name]"> |
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
... | |
<c:TabIndexConverter x:Key="TabIndexConverter" /> | |
<SolidColorBrush x:Key="TabItemSelectedBackground" Color="Gray" /> | |
<SolidColorBrush x:Key="StandardButtonBackground" Color="White" /> | |
<Style TargetType="{x:Type TabItem}"> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="TabItem"> | |
<Grid Name="Panel" Height="90"> |
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
set CURRENT_DIR=%~dp0 | |
echo %CURRENT_DIR% |
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
// Minimal async file copy using background worker | |
public class FileAsyncCopy | |
{ | |
private string _source; | |
private string _target; | |
BackgroundWorker _worker; | |
public FileAsyncCopy(string source, string target) | |
{ | |
if (!File.Exists(source)) |
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 @db_name varchar(100) = 'dbname'; | |
declare @kill_commands varchar(max) = ''; | |
select | |
@kill_commands=@kill_commands+'kill '+convert(varchar(5),spid)+';' | |
from master..sysprocesses | |
where | |
spid <> @@SPID -- avoid to kill the current process | |
and dbid=db_id(@db_name) | |
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
SELECT | |
t.name AS TableWithForeignKey, | |
c.name AS ForeignKeyColumn, | |
r.name AS ReferencedTable, | |
rc.name AS ReferencedColumnName | |
FROM sys.foreign_key_columns AS fk | |
inner join sys.tables AS t ON fk.parent_object_id = t.object_id | |
inner join sys.columns AS c ON (t.object_id = c.object_id AND fk.parent_column_id = c.column_id) | |
inner join sys.tables AS r ON fk.referenced_object_id = r.object_id | |
inner join sys.columns AS rc ON (r.object_id = rc.object_id AND rc.column_id = fk.referenced_column_id) |