Thursday, July 21, 2022

Work Life: MS Sql SMO Script StringCollection, Understanding why result is a StringCollection

Understanding StringCollection with MS Sql SMO Script took me some time to understand better. For some reason it did not occur to me why there are multiple lines. I initially did not care, so I did some workarounds.

Initially, I didn't care because I was using it to compare the same objects across multiple servers so as long as all environments were consistent it did not matter, so I just joined it all together or removed the first two values.

I was then put in charge of managing the source control. The script that was generated for database project did not include the ANSI_NULL or QUOTED_IDENTIFIER options. There are over 10k objects so I cannot possibly manually remove them.

I tried to find a ScriptionOption to remove them but all the answerers bypasses the question by saying that it is required (or at least highly recommended). Most questioners problems are that they are missing the GO command.

Although there are plenty of questions to remove, I could not find any answers that removed them. I have gone through many versions of the same unsatisfying answers. The best is just to add it to the code to ignore those lines or add GO after each record.

Summary

Each record in the StringCollection is a SQL command. Although satisfying to know the answer, a little disappointed in myself that it took this look to figure it out.

I still don't like that none of the Microsoft solutions are ever consistent though. SSMS includes not only ANSI_NULLS and QUOTED_IDENTIFER but also the USE [DatabaseName]. While the SMO Script method includes the ANSI_NULL and QUOTED_IDENTIFIER but does not include the USE. And then the database import into Visual Studio or Azure Data Studio do not include ANSI_NULLS and QUOTED_IDENTIFER but includes a GO at the end.

Run as Script

Join all the rows with a GO command between each record:
myStringCollection.Join("\r\nGO\r\n");

For Source Control

Because database project does not include the ANSI_NULL and QUOTED_IDENTIFIER, I remove all those records. Requesting multiple objects is more troublesome, so I just request one object at a time. The reason it is more troublesome is because there is no strong correlation between the script and the object it is for without assuming it is in the same order as the request or parsing the script. Because this is for source control, it is not worth the risk of pulling the incorrect script.

Monday, July 18, 2022

Buggish: MS Visual Studio 2022 Empty Toolbox or Common Controls only (no solution)

Simply Microsoft Visual Studio shows only Common Controls. If reset, then it becomes empty list. Restarting Visual Studio 2022 will bring back the Common Controls. If I select Show All, it'll show a huge list of disabled controls.

Sunday, July 17, 2022

Life: One of many things to do after getting a green card (GC) / permanent resident card

After helping a friend who recently received his green card...

If you have bank account(s), make sure to update your account status so that they provide a W-2 otherwise, they will send a W-8BEN or W-8BEN-E.

Thursday, July 14, 2022

Buggish: Me and Remembering What I Wanted to Post

Already here for the third time to post something that I thought was important... but clearly not important enough to remember after I get distracted by someone. So now this post has transformed into a post about myself as proof that I am not perfect either and all readers including myself should still perform due diligence.

Best wishes to my future self in hopes these happen less often.

Wednesday, July 13, 2022

Buggish: In Jira cloud, unable to create sub-stories

This may be more of a problem with our team inability to break problems down into smaller parts but that is out of my control and little that I can do about it. Because the story spans more than one sprint, the group has divided the story not into smaller stories but into roles. So one sprint will have the Refinement part of the story. Another sprint with Development part. Another sprint for the Test part.

This makes it troublesome in tracking what the Jira ID is for the story. Is it the refinement story, or the dev story, or is it test? Preferably, I want to use the Dev story because it contains the code that is referenced everywhere else. But it is neither the beginning nor the end.

Can I use the epic? Not really, because the epic contains other stories.

Can I use tasks? Possibly but it is not the same as a sub-task. Task is not considered a child of the story. It can be associated with a story but it can also be associated with other stories.

Can I use sub-tasks? Possibly, but we already use sub-tasks to break down the tasks for dev, testing, deployment, etc. And in Jira none of these can have additional sub-types. Also sub-tasks cannot be assigned a sprint. Because of this case, a task would make more sense.

More complications come up due to the integration with GitHub. Because the integration is dependent on the Jira ID used in the branch name, commit comments, and pull request, consistent use of the Jira ID is important. 

The more I think on it, the more I think the issue is more on the broken SDLC process.

Monday, July 11, 2022

Scammish: Canon all-in-one printers/scanner/fax (imo, just do not buy)

Scanner is completely useless without ink. Why? I have absolutely no idea either. This clearly an intended feature by Canon. Because of this alone, I say this is completely useless. If you want to go with just the Canon printer, see my other article where Canon printer uses cyan ink even though I have only printed black and white documents with both the app and the printer settings set to black and white. Supposedly, Canon claims this makes the black, blacker. I just need a print; I don't need a professional black color. It could be a light grey-scale for all I care to save more ink. But of course, there are no settings at all for this. Additionally, this is for any ink that is empty not all of them. For example, once cyan is out the entire printer (including printing) is useless even if you are printing black and white with full black ink cartridge.

JUST STAY AWAY FROM CANON

What is more scammish, is that I cannot even buy ink for my printer anymore... so... what a total electronic waste on the planet.

SAY NO TO CANON

What a crappy business model? If I had known this was the reason for the lower price, I would have just paid more for another device.

Summary

I would be embarrassed as an engineer if I had worked for Canon. I am already a bit ashamed as engineer that such a product exists. 


Reference

https://douglastclee.blogspot.com/2021/03/scammish-printers-using-cyan-when.html


Friday, July 8, 2022

Buggish: MS Authenticator on Company Secured Phone; Having to sign in 5 times just to use a site.

Company secured phones can be extremely burdensome in that everything requires an authentication. None of the automated notification goes through until it is unlocked. Because of all this, I missed many 2-factor authentication because it turns out to be almost like 5 authentication steps.


If I do not remember to unlock my phone first and I sign into a page that requires authentication, I have to first unlock my phone. This triggers all the notifications which includes all the emails, all the messages, and all the IM/DMs. By the time, I can even get to the button to open authentication, the login has already timed out. So I sign-in again...

By the time, I sign in again... my phone has locked. So I have to unlock again. Then open the authenticator again, agree, put in the unlock code again. Then watch my sign-in hasn't logged in. Check my phone again, and notice another authentication and repeat. Then I watch my sign-in expire and say the sign in failed because it too short for two authentications. Two because the first one was for the first time that I logged in.

So I sign in for a third time. This time I unlock my phone first. Open, unlock code, agree... and finally in. Sometimes it even fails to log in for some reason and I have attempt a fourth time. And then even sometimes this just keeps failing, then I try on another browser. If that fails, I reboot and do it all yet again.


And our lovely company also likes to use the admin account practice. We also have two domains. So the first step was just to switch domain. So now, I have sign in again to get my admin password. This time with an additional step to put in a code, then put in my unlock code. Copy the admin password.

Go to the site I wanted to go to, sign in with admin account. Then put in the admin password again. Finally, usually I get to where I needed to be.


Why do I need to log in so many times? By the second or third or fourth or tenth time, does the system think that the hacker took over my phone or device or my life? The most likely scenario is that I got so frustrated that I threw my phone out the window at which point I guess then all this security does make sense.

Wednesday, July 6, 2022

MIND BLOWN: powershell or cmd from window explorer (Windows 10)

MIND BLOWN: A new category to publish something that has been around forever that I have never known and is a life-changer for me.


HISTORY: For a long, long, long time... I have always dreaded using cmd, CLI, powershell, etc. because I just hated having to navigate to the folder. I have only known to open it from the run command or some shortcut. It is not bad if I can manage my folders because I keep it short and simple. Other people always seem to have deep folder structures, spaces, special characters, etc.


SUMMARY: I can just type powershell or cmd in the address bar (ALT+D), and it'll open to the directory the windows explorer is open to.

I don't know when this started and I don't care because I rarely ever have to go to an older version of Windows and Windows 10 has been around for some time now. But this is so mind-blowing for me. Because I can tell you that every time I had to use powershell, I always, ALWAYS right-click in the window in hopes that an option would appear for me. There is the Run Powershell, but that doesn't accept user prompts (or at least I have never figured out how to get that to work as I don't work with PS on a daily basis or even yearly basis). But now that I have been tasked to build DevOps pipelines, I am finally forced to learn this stuff.


Additional Notes: Found the reason, right-click does not work is because the script was throwing an error:

File C:\test.ps1 cannot be loaded. The file C:\test.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

To resolve this, I had to run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

After this, I was able to right-click and execute it.


Alternative: I can also just go to file and open with mouse clicks.