Posts

Showing posts from December, 2019

Android Room Database Subsequent Insert Failed Due to Broken AutoIncrement

Room DB has managed to abstract away complicated SQL statements which is pretty nice. But as with other new things, it takes a while to get used to. It all starts with an entity such as the following: @Entity data class Item( @PrimaryKey(autoGenerate = true ) val id : Int = Int. MIN_VALUE , @ColumnInfo val name : String? } and my Dao has the following function: @Insert(onConflict = OnConflictStrategy. IGNORE ) suspend fun insert(item: Item) The first insert went well, but I noticed my subsequent insert failed. For somewhat reason, it tried to assign the same value as Id. After few trial and error, I managed to fix it by changing the Int. MIN_VALUE to 0. So the entity class becomes: @Entity data class Item( @PrimaryKey(autoGenerate = true ) val id : Int = 0 , @ColumnInfo val name : String? }

"Specify one workspace" - Deleting Team Foundation Phantom Workspace

One day, my colleague somehow discovered a duplicate team foundation workspace in his computer after rebooting his PC. The duplicates make him unable to find the projects tied to remote repository that he is working on. The duplicated workspace has exactly the same name, owner and computer name as the other one except no existing mapping. Worse, Visual Studio detected only one workspace and deleting it doesn't seem to work. We started with tf.exe command after we figure out that we can manage workspaces using command line. Using the following command, we manage to get a list of all workspaces: tf workspaces /collection:<domain>.visualstudio.com\<organization> /owner:* But our attempt to delete the particular workspace using the following command failed with the message "Specify one workspace": tf workspace /delete <workspace_name>;<domain>\<owner_name> After browsing more, we found this thread:  https://developercommunity.visualstudio...