flutter doctor –android-licenses gives a java error

After installing flutter on my development environment, I face flutter doctor android license issue while I was checking the installation with below command:

flutter doctor --android-licenses
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
    at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
    at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
    at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)
    at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 5 more

That was not the expected result as I follow the installation instructions step by step documented on flutter official site.

I could successfully fix the issue by simply install install Android SDK command line tool from the Android SDK Manager, in order to do that, follow the below steps

  1. Start Android Studio
  2. Go to Tools > click on SDK Manager
  3. From the left-hand side choose, Appearance & Behavior then System Settings then Android SDK
  4. from the tabs, Select SDK Tools 
  5. Check Android SDK Command-line tools 
  6. click ‘apply’.

Below screenshot is showing the settings popup (I have dark theme on Android Studio)

Android Studio – Settings popup

If you are still facing issues after applying above steps, consider upgrading JDK to the latest. here is the Java official upgrading JDK 8 (latest at this moment)

Microsoft announced the born of new baby; the Windows 365 Cloud PC

Recently Microsoft announced the born of Windows 365 to be early August 2021; It is the Cloud PC version of Windows OS that is dominant over the years. I believe this is will change the whole game in the hybrid working environment

COVID-19 pandemic enforce business to start thinking of the remote working as the best option to overcome the health issues.. Organizations everywhere have transformed themselves through virtual processes and remote collaboration. The ability to work whenever, however, and wherever it’s needed has become the new normal. Everyone want to have working environment that has technologies that’s familiar, easy to use and easy to access. Hybrid working environment becoming the key to success. Microsoft announcing Windows 365; the Cloud Windows version with almost the same experience as Windows 10 or Windows 11. This will be great empowering tool for businesses to move on the Hybrid working model.

Full Windows experience in all devices.. just like what we used to have.

With this great hybrid work paradox, leaving organizations around the world with multiple options to decide how to get connected in a hybrid world and provide the employees with the needed access to organization’s resources from anywhere. All what they need is to have internet connection.

From my point of view; I can tell that the Cloud PC (Windows 365) is a great technology feature that will change the game. Having a secure full version of windows 10/11 experience will enhance and empower the workspace, regardless of the workforce location or devise.

One of the great features is that you can stream all of your personal apps, tools, data and settings from the cloud across virtually all devises including iPad, Mac and android devises.

Familiar tools

I always say, Simplicity is the key to success. Windows 365 have that in hart of the design principles. Microsoft promise us that we can apply the management and security policies to the Cloud PCs in easy way. Also you can monitor the Cloud PC performance and processing power, and easily find the Cloud PC that is not working with best performance needed.

Zero Trust Powering the Cloud security

Per Microsoft, The Cloud PC architecture has been built while keeping in mind the best security practice; Zero Trust architecture, Windows 365 also helps solve for today’s critical security challenges by design, storing and securing information in the cloud, not on the cloud device itself.

Microsoft built Cloud PC specific Security baseline for quick start, you can alter these security policies later on to fit you needs but we wouldn’t recommend doing that without a solid understanding of the side effect turning off these features. Windows Defender is a built-in software into the Windows 365.

The Security baseline provided by Microsoft It not only protects your Cloud PCs, but also gives you security recommendations to lower risks, and helps you quickly find out and troubleshoot any security incidents.

Learn more information about Windows 365

1. https://www.microsoft.com/en-us/microsoft-365/blog/2021/07/14/introducing-a-new-era-of-hybrid-personal-computing-the-windows-365-cloud-pc/

How To backup MySQL DB on Windows severs

Backing up database is essential to eliminate the risk of losing data whenever there is a hardware failure or software issues. In this post, I’ll be showing the possible ways to create backups for MySQL databases.

In fact, There are several ways to Backup MySQL databases, you need to evaluate each one and select the best fit into your needs. I’ll list the possible ways, but I’ll be focusing on the data dump approach.

Types of MySQL backups:

  1. Logical: By using MySqldump utility, you will be able to create a data dump of your database. The Expected output is a .sql file that has all insert statement needed to re-create the database again.
  2. Physical: by coping the actual database files into another location. – This approach usually is recommended for huge databases as it is faster to do the backup and faster to restore in case of any failure. The limitation of this approach, is restoring the database has to be on the similar hardware as the original one.
  3. Partial: Partial backup is meant to have a backup of single table. This is usually useful when you wat to do a bulk operation on that table and you want to create a restore point in case of any failure happened.

For the purpose of this article, I’ll be focusing on the first option; Logical Backup. It is the easiest way as well as it is using a built in tool called mysqldump. This utility tool is being shipped with MySQL engine, Thus it will be installed by default on your MySQL Server. – So no third party tool needed.

You can create a .bat file to do the backup and get benefits of the built-in Windows Task Scheduler to have the backup done on daily basis. Let’s dive into it.

  • Creating backups for all databases on my MySQL engine:
mysqldump --user=root --password=******* --result-file="C:\MySQLdump.sql"  --all-databases

On this command line, you are telling mysqldump utility to have a backup of all databases and store it on the C:\MySqlDump.sql file. If you open the result file in any texts editor, you will find a normal sql statements to insert the data.

  • Creating Backup for a single database:
mysqldump --user=root --password=******* --result-file="C:\MySQLdump.sql"  --[DbName]

it is the same command as all databases, but you need to replace the all-databases option with the name of the database that you are looking for backing it up.

Advantages of using data dump approach over other options:

  1. You are not limited to specific MySQL version. The output of this dump, is normal SQL CRUD operations which means all what you need to do is to connect to the new MySQL engine and execute the datadump file.
  2. You can edit the datadump file in case you are looking to do few tweaks before executing it again.
  3. No 3rd party tools are needed. The MysqlDump.exe tool is built in utility and will be installed within MySQL installation.

For more information about mysqldump, please see the MySQL related documentation here

LastIndexOf in TSQL

I came a cross a case where I need to parse a string and get a everything after specific character. Unfortunately there is no a function that is being shipped out of the box with MS SQL Server that is doing the needed job. So we had to use 3 built-in functions in SQL in order to do the job, here is a sample TSQL statement that demonstrate how you can do it

DECLARE @SomeString VARCHAR(100)
SET @SomeString = 'Part1;Part2;Part3'

SELECT RIGHT(@SomeString, CHARINDEX(';', REVERSE(@SomeString) + ';') - 1)

SQL Server Build Versions

SqlServerVersionsI was working on maintaining SQL Server DB backups on a new server of mine, but I faced an error message that telling me my backup file created on database engine 10.50.4042 version while my current database engine version is 10.00.5500. I believe you already faced such an error message.

Once I got that error message, the first question came into my mind is how can I know what these version numbers really menas to me and how can fix this issue.. answering to these question was nicely listed into this blog post, actually the author of this blog did a great job of creating a catalog of versioning numbers and what each one means.   https://buildnumbers.wordpress.com/sqlserver/

GPG Encryption with a trust keys

before I start describing the issue, I want to give you a quick introduction about GPG and why we need to use it

GPG is one of the great tools/algorithms to do encryption and it is one of the commonly used algorithms to secure data and files. GPG allowing you to use public/private keys to encrypt/decrypt files on both Windows and Linux Operating Systems. Public key is used to encrypt files ONLY, and you can’t use it to Decrypt files; to be able to decrypt files, you need to have the private key pair to the public key used in encryption. if so, you will be able to decrypt the files.

How to generate keys and how to use them is outside the scope of this article; so I’ll not describe them here and I assume you are familiar with these commands.

the main issue that I faced while trying to encrypt files is getting the following prompt message:

“It is not certain that the key belong to the person named in the user ID. if you *really* know what you are doing, you may answer the next question with yes.

while you are doing encryption manually, it is easy to do YES. but when you are using this inside a background process that doesn’t work and you need to let the GPG tool do encryption silently. to do this you need to trust public key that you are using. it is easy thing to do; follow the below steps:

gpg – edit-key <KeyName>

GPG will output some information, and show a line like:
trust: undefined     validity: unknown

then you need to use trust command; type “trust”:

GPG will output below message:

Please decide how far you trust this user to correctly verify other users’ keys
(by looking at passports, checking fingerprints from different sources, etc.)

1 = I don’t know or won’t say
2 = I do NOT trust
3 = I trust marginally
4 = I trust fully
5 = I trust ultimately
m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y

and we are done.. you need to quit from the command by type q then hit enter.

Enable Remote Access for MS SQL Express Edition

By Default when you install SQL Server express edition on a machine you will not be able to connect to it  from another machine by using Microsoft SQL Server Management Studio or application. You need to do specific steps to enable SQL Server Express to accept connections from remote clients.

Recently I read a nice article posted to CodeKicks site about this issue, I would strongly recommend reading that article, to read it click hear

How to Change the Remove Desktop (RDP) Port

You can use "Remote Desktop Connection" tool to connect to other PC and mange them remotely. It is a great tool that is really helpful specially when are talking about outsourcing industry. I do not mean this is only helpful only in IT outsourcing industry, but what I meant it is providing a huge help on that industry because you need to work on windows based machines while you are setting in a different country.

For me, I exposed my personal PC at home to be accessible from public internet network in order to be able to connect to it while I am travelling or at work. But this means I am also exposing my personal PC for hacking risk specially when I am not having a very good secured network infra-structure at home.

Hiding the Remote Desktop port is one step is to make my personal hard to hack. The default remote desktop’s port is 3389. so I decided to change it to something else to make it harder for hackers to attack on my PC. Below is the steps of how to do it:

1. Click on Start menu
2. Choose Run , this will open the RUN dialog box
3. Type REGEDIT and click on ok, this will launch the Registry Editor for you
4. Locate the following key in the registry
  HKEY_LOCAL_MACHINE\System\Current\ControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber

5. Double click on PortNumber and choose "Decimal" option then change the port number there to something else, let’s say you changed it to be 3333

6. Click OK , then quit Registry Editor
To connect to the PC, you need to type the port number along with PC’s name or IP just like blow examples:
1. PCNAME:333

How to Know the Execution Time of SQL Statements in Simple Way

When client report to you a performance issue in certain area on your system, you start troubleshooting and tackling the issue. the performance bottleneck might be everywhere on your system, it might be on front-end, business layer, data access layer, … etc. The scope of this article is to check the execution time taken for certain SQL statement till you get the result out from the DB. this would  very helpful if the performance issue is at  data retrieval.  after figuring out the performance bottleneck is at data retrieval, the solution might be as easy as adding index for some of table’s columns. but in most cases you might get into a trouble of changing the body of SQL statements to have better performance. so you need a tool to assess your changes. SQL 2008 IDE shipped with a built-in tool that I found so much helpful and made my life much easier.

if you notice there is a small icon on tool bar called “Include Client Statistics”, it is by default not enabled. if you enable it and try to execute a sql statement, you will get a new tab at the result panel. below is snapshot of the new tab on the result panel






Notice the statics between different trials. it will keep the statics up to 10 trials. The statics including with some visual graphics to let you note the effect of your changes weather it increase the execution time or it reduced it.
Try it and you will find it so useful!