Sometimes the need arises to wait for a condition or property to become true, this is especially useful for unit / integration tests. The System.Threading namespace contains SpinWait which will enable use to enter a condition that we want to wait on to see if it becomes true.
We know that TCPview, for example, can close the TCP connection for the other process without closing the process. So how to implement it? Suppose there is a process connecting to the a remote ip and port, how to terminate that connection?
Here how import/export single table using MySQL as DBMS:
Exporting the Table
To export the table run the following command from the command line:
mysqldump -p --user=username dbname tableName > tableName.sql
This will export the tableName to the file tableName.sql.
Importing the Table
To import the table run the following command from the command line:
mysql -u username -p -D dbname < tableName.sql
The path to the tableName.sql needs to be prepended with the absolute path to that file. At this point the table will be imported into the DB.
It took long time for me to manage in the correct way push notifications within my app. Using DevExtreme, I’m able to create a single app both for Android and iOS.
To test the push notifications feature, I use FCM (Firebase Cloud Messaging, by Google).
The classic commad working in SQL Server
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
isn’t working on Azure database.
Here the code to disable the foreign keys on all the table of a database:
DECLARE @enable_constraints bit = 0 --Don't change anything below this line. DECLARE @schema_name SYSNAME DECLARE @table_name SYSNAME DECLARE table_cursor CURSOR FOR SELECT schemas.name, tables.name FROM sys.tables INNER JOIN sys.schemas ON tables.schema_id = schemas.schema_id OPEN table_cursor FETCH NEXT FROM table_cursor INTO @schema_name, @table_name DECLARE @cmd varchar(200) WHILE @@FETCH_STATUS = 0 BEGIN SET @cmd = 'ALTER TABLE ' + QUOTENAME(@schema_name) + '.' + QUOTENAME(@table_name) + ' ' SET @cmd = @cmd + (CASE WHEN @enable_constraints = 1 THEN 'CHECK' ELSE 'NOCHECK' END) + ' CONSTRAINT ALL' PRINT @cmd EXEC( @cmd ) FETCH NEXT FROM table_cursor INTO @schema_name, @table_name END CLOSE table_cursor DEALLOCATE table_cursor
To enable them again, just change the firs row with
DECLARE @enable_constraints bit = 0
When you do some stuff on your database, it can be useful disable, for a while, the foreign keys check. Here how to do it:
Continue reading “Enable/disable foreign keys check”