Monday, July 31, 2023

How to get the table name with a required column name in MySQL using query

While working on a project we had a big database which contains more than 250 tables. I wanted to get the table name containing a column say "Column A". We can do it easily with a query.

Say now we have a database called as "Test_Database" with lot of tables and columns. Now I want to get all the table names in this database which contains "Column A" or "Column B". We can execute the below query to get the table names:

SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('Column A','Column B'
AND TABLE_SCHEMA='Test_Database'; 


Above query shows all the table names which contains "Column A" or "Column B" columns. That's it. Happy coding !

Thursday, July 13, 2023

How to add drawable resources to an existing Android Studio project

To add a drawable resource to an existing Android Studio project, you can follow these steps: 

  • Open your Android Studio project.
  • In the Project Explorer pane on the left side, navigate to the res folder.
  • Right-click on the res folder and select "New" -> "Android Resource Directory".
  • In the "Resource type" dropdown, select "drawable".
  • Click "OK" to create the new drawable resource directory.
  • In the newly created drawable directory, right-click and select "New" -> "Image Asset" (if you want to add an image file) or "Vector Asset" (if you want to add a vector file).     

       Follow the prompts in the Asset Studio wizard to import or create the desired image or vector resource.
  • If you choose "Image Asset", you can select an existing image file or create a new one. You can customize various options such as image type, shape, and padding.
  • If you choose "Vector Asset", you can import an SVG file or create a new vector using the built-in vector editor.
  • After configuring the asset, click "Next" and "Finish" to complete the process.
  • The new drawable resource will be added to the drawable directory, and it will be automatically generated in various densities (e.g., mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi) if it's an image asset.
  • can now reference the newly added drawable resource in your layout XML files or Java code by using its resource identifier (e.g., @drawable/your_drawable_resource_name).

Note: If you want to add an image file directly to the drawable directory without using the Asset Studio, you can simply copy the image file and paste it into the drawable directory. Make sure the image file has a proper filename, adhering to Android resource naming conventions (e.g., lowercase letters, underscores, no spaces or special characters).

 By following these steps, you can add a drawable resource to your existing Android Studio project.

 

 


 

 

 

  

Tuesday, July 11, 2023

Hybrid app development for Android and IOS

 
There are several popular platforms available for developing hybrid apps for Android and iOS. The choice of the best platform depends on various factors such as your familiarity with programming languages, the complexity of your app, performance requirements, and the specific features you need. Here are three widely used platforms for hybrid app development:
 
React Native: React Native is a popular JavaScript framework developed by Facebook. It allows you to build native-like mobile apps using JavaScript and React. React Native offers a rich set of pre-built UI components, provides excellent performance, and allows code sharing between Android and iOS platforms. It has a large and active community, which means you can find plenty of resources, libraries, and support.
 
Flutter: Flutter is an open-source UI framework developed by Google. It uses the Dart programming language and allows you to build beautiful, high-performance apps for both Android and iOS platforms from a single codebase. Flutter provides a rich set of customizable widgets and has a hot-reload feature that allows for fast development and testing. It has gained popularity for its fast rendering capabilities and native-like performance.
 
Xamarin: Xamarin is a cross-platform app development framework owned by Microsoft. It allows you to build apps using C# and .NET, providing a native-like user experience. Xamarin allows code sharing across platforms, and you can access native APIs and use platform-specific functionality. It has a mature ecosystem, and if you are already familiar with C# and .NET, Xamarin can be a good choice.
 
All of these platforms have their strengths and weaknesses, so it's important to evaluate your specific project requirements and consider factors like performance, development speed, community support, and learning curve before choosing the best platform for your hybrid app development.

In this, if you ask which is easy to learn. The ease of learning a platform can vary depending on your background, previous experience, and familiarity with the programming languages involved. However, in terms of beginner-friendliness, Flutter is often considered to have a relatively gentle learning curve.
 
Flutter uses the Dart programming language, which is easy to grasp for developers who are already familiar with object-oriented programming concepts. Dart has a clear syntax and provides helpful error messages, making it easier for beginners to learn and understand.
 
Additionally, Flutter offers a rich set of documentation, tutorials, and resources, including a detailed online documentation, video tutorials, and a vibrant community. These resources can assist beginners in getting started with Flutter and provide guidance throughout the learning process.
 
That being said, it's important to note that the perceived ease of learning also depends on your prior programming experience and the specific requirements of your project. If you already have experience with JavaScript and React, React Native may be more accessible for you. Similarly, if you are already proficient in C# and .NET, Xamarin might be easier to pick up.
 
Ultimately, the best approach is to try out different platforms, explore their documentation and resources, and choose the one that aligns with your skill set and project needs.

Sunday, July 9, 2023

How to Embed PDF in Word file

To embed a PDF file within a Word document, we can follow these steps:

 

  • Open Microsoft Word and create a new or existing document where you want to embed the PDF file.
  • Click on the "Insert" tab in the ribbon at the top of the Word window.
  • In the "Text" section of the ribbon, click on the "Object" button. This will open the "Object" dialog box.
  • In the "Object" dialog box, click on the "Create from File" tab.
  • Click on the "Browse" button and navigate to the location where your PDF file is saved. Select the PDF file and click "OK".
  • In the "Object" dialog box, make sure the checkbox next to "Link to file" is unchecked. If it's checked, the PDF file will be linked to the Word document instead of being embedded.
  • Optionally, you can check the checkbox next to "Display as icon" if you want the PDF file to appear as an icon in your Word document. If you leave it unchecked, the PDF pages will be displayed directly in the Word document.
  • Click on the "OK" button to embed the PDF file into your Word document.

The PDF file should now be embedded within your Word document. You can resize and reposition it as needed. When you save the Word document, the embedded PDF file will be included and accessible whenever you open the document on a device with a compatible PDF viewer.

Friday, June 30, 2023

Android Studio says: duplicate class found and not able to build

While I was trying to build an android project on latest Android studio that is: 

Android Studio Flamingo | 2022.2.1 Patch 2
Build #AI-222.4459.24.2221.10121639, built on May 12, 2023
Runtime version: 17.0.6+0-b2043.56-9586694 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

I got the below error:
"Duplicate class found"

Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.internal.jdk7.JDK7PlatformImplementations$ReflectSdkVersion found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.internal.jdk8.JDK8PlatformImplementations$ReflectSdkVersion found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.io.path.DirectoryEntriesReader found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.ExperimentalPathApi found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.FileVisitorBuilder found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.FileVisitorBuilderImpl found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.FileVisitorImpl found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.LinkFollowing found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathNode found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathRelativizer found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathTreeWalk found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathTreeWalk$bfsIterator$1 found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathTreeWalk$dfsIterator$1 found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathTreeWalkKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathWalkOption found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathsKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathsKt__PathReadWriteKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.io.path.PathsKt__PathUtilsKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.jdk7.AutoCloseableKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk7-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.21)
Duplicate class kotlin.jvm.jdk8.JvmRepeatableKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.jvm.optionals.OptionalsKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.random.jdk8.PlatformThreadLocalRandom found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
Duplicate class kotlin.streams.jdk8.StreamsKt found in modules kotlin-stdlib-1.8.0 (org.jetbrains.kotlin:kotlin-stdlib:1.8.0) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)
I solved this issue by downgrading the dependencies.
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'

Just downgrading from 2.6.1 to 2.5.1
Like below

implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'


If the above solution does not affect, you can try to add the below dependency:

implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
If the above solution does not affect anything, try downgrading some plugins you just upgraded. It'll definitely resolve.

I hope it is helpful.

Saturday, June 24, 2023

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Error in android

I got the below error while running my android project :

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script7.groovy: 1: unable to resolve class

To solve this error I have to upgrade my jdk. To upgrade the jdk, you can follow the below steps

From File menu -> Project Structure -> SDK Location -> JDK location Drop down menu choose:
Embeded JDK c:....\jre


or you can upgrade the jdk to latest jdk by clickiing on upgrade to latest jdk. You can upgrade jdk from Gradle settings also.

This solves the above error. 

Wednesday, June 7, 2023

Understanding Android Security: Best Practices for Secure App Development

 Developing secure Android apps requires following best practices and implementing various security measures. Here are some tips to enhance the security of your Android app:

  1. Secure Data Storage:
    • Use secure storage mechanisms, such as the Android Keystore system, to store sensitive data like passwords, encryption keys, and API keys.
    • Avoid storing sensitive information in plain text or easily accessible locations like shared preferences.
    • Employ data encryption techniques like AES or RSA when storing data on disk or transmitting it over the network.
  2. Input Validation and Sanitization:
    • Validate and sanitize all user inputs to prevent common security vulnerabilities like SQL injection, cross-site scripting (XSS), and remote code execution.
    • Utilize input validation libraries and frameworks to simplify the process and reduce the risk of errors.
  3. Secure Network Communication:
    • Use secure communication protocols such as HTTPS/TLS for transmitting sensitive data over the network.
    • Implement certificate pinning to ensure the authenticity of the server’s SSL certificate.
    • Validate server certificates and hostname to prevent man-in-the-middle attacks.
    • Avoid transmitting sensitive information in URL parameters or query strings.
  4. User Authentication and Authorization:
    • Implement strong and secure authentication mechanisms, such as password hashing, biometric authentication, or OAuth-based authentication.
    • Enforce secure password policies (e.g., complexity, length, expiration) to enhance user account security.
    • Implement session management techniques to handle user sessions securely.
    • Employ appropriate authorization mechanisms to control access to sensitive app features and data.
  5. Secure Code Practices:
    • Regularly update and patch your app’s dependencies, libraries, and frameworks to address known security vulnerabilities.
    • Implement secure coding practices, such as input validation, output encoding, and secure error handling.
    • Avoid hardcoding sensitive information like API keys, passwords, or cryptographic keys directly in the code.
    • Utilize appropriate security frameworks and libraries to handle security-related tasks effectively.
  6. User Privacy:
    • Request and handle user permissions appropriately and transparently, following the principle of least privilege.
    • Implement privacy controls and settings to allow users to control their data and preferences.
    • Be cautious with collecting and storing personally identifiable information (PII), adhering to privacy regulations like GDPR or CCPA.
  7. Code Obfuscation and Reverse Engineering:
    • Employ code obfuscation techniques (e.g., ProGuard, R8) to make it harder for attackers to understand and reverse engineer your app’s code.
    • Use techniques like code tampering detection and runtime integrity checks to detect and respond to tampering attempts.
  8. Regular Security Testing:
    • Conduct regular security assessments and penetration testing to identify and address vulnerabilities.
    • Use static code analysis tools and security testing frameworks to identify common security issues during the development process.
    • Perform dynamic security testing to simulate real-world attacks and assess the resilience of your app.
  9. Stay Updated with Security Best Practices:
    • Keep up-to-date with the latest security guidelines and best practices from Android and security communities.
    • Follow Android’s security-related recommendations, including the Android Security Guidelines and Security Best Practices documentation.

Remember, security is an ongoing process, and it’s essential to monitor security news and updates regularly to address emerging threats and vulnerabilities.

Tuesday, June 6, 2023

Building Android Apps with Material Design Guidelines

Building Android apps with Material Design guidelines can help you create visually appealing and intuitive user interfaces. Here are some key considerations and best practices to follow when incorporating Material Design into your Android app:

  1. Understand Material Design Principles:
    • Familiarize yourself with the principles of Material Design, such as material metaphor, bold and intentional design, meaningful motion, and responsive interactions. This will provide a foundation for implementing Material Design effectively.
  2. Use Material Components:
    • Utilize the Material Components for Android library, which provides pre-built UI components following Material Design guidelines. This library offers a wide range of customizable components like buttons, cards, dialogs, text fields, and more, ensuring visual consistency and smooth integration.
  3. Consistent Color and Typography:
    • Follow the color and typography guidelines provided by Material Design. Use the color palette and typography scale to ensure consistency throughout your app.
    • Apply color and typography appropriately to indicate hierarchy, emphasize important elements, and enhance readability.
  4. Responsive Layouts:
    • Design responsive layouts that adapt to different screen sizes and orientations. Utilize ConstraintLayout and other responsive layout techniques to create flexible and scalable UIs.
    • Ensure that your app’s UI elements are appropriately sized and positioned to provide a consistent user experience across different devices.
  5. Meaningful Motion and Transitions:
    • Leverage motion to enhance user experience and provide visual feedback. Use meaningful and purposeful animations to guide users, convey changes, and highlight important actions.
    • Implement smooth transitions between screens and interactions to create a seamless and engaging user flow.
  6. Iconography and Imagery:
    • Utilize appropriate icons from the Material Design icon library or create custom icons that align with the Material Design style.
    • Use high-quality imagery that aligns with Material Design aesthetics. Optimize image sizes and resolutions to ensure smooth performance.
  7. Adaptive Design:
    • Take advantage of adaptive design techniques to optimize your app’s appearance on different devices, including smartphones, tablets, and foldable devices.
    • Adapt layouts, fonts, and spacing dynamically to provide an optimal user experience on various screen sizes and form factors.
  8. Gestures and Touch Feedback:
    • Implement touch gestures and touch feedback to make your app interactive and responsive. Use touch ripples and animations to provide visual feedback when elements are tapped or swiped.
    • Ensure that touch targets are appropriately sized and spaced to accommodate different screen sizes and user interactions.
  9. Accessibility:
    • Consider accessibility guidelines when designing your app. Use appropriate contrast ratios, provide alternative text for images, ensure proper focus order, and support assistive technologies.
    • Test your app’s accessibility features and make necessary adjustments to ensure inclusivity for all users.
  10. Test and Iterate:
    • Test your app thoroughly on various devices and screen sizes to ensure that the UI elements and interactions align with Material Design principles.
    • Collect user feedback and iterate on your design to improve usability and address any usability issues or inconsistencies.
Remember that Material Design is a set of guidelines, and while it provides a solid foundation for building visually appealing and intuitive apps, it’s essential to strike a balance between adhering to the guidelines and incorporating your app’s unique branding and identity.
Happy coding!!!

Saturday, March 18, 2023

Formula to count the blank cells in excel

When I was working on some data calculations in a excel sheet, we had a situation to count the blank number of cells in a range of rows. There are lot of statistical formulas available in excel

Here is the one formula which can be used to achieve this. and We can see how can use this.
We can use COUNTBLANK function, one of the Statistical functions, to count the number of empty cells in a range of cells.

Syntax
COUNTBLANK(Range)
 
The COUNTBLANK function syntax has the following arguments:
 
Range    Required. The range from which you want to count the blank cells.
 
Remark
Cells with formulas that return "" (empty text) are also counted. Cells with zero values are not counted.

Example:




Hope this helps!

Friday, March 17, 2023

How to add email and phone link in shopify

 While working with Shopify themes, somebody was asking me how to make by clicking on email, it should automatically open the installed email client and add the email address to field. This is very simple to do.

1. Name the link "Email us" or whatever content you want your clients to see.
2. Put "mailto:name@example.com" in the Link box.
3, Replace the placeholder email address with your email address

Similarly you can add a telephone number with the prefix "tel:+xxxxxxxxxx" .. And link it. It automatically opens the dialer.

Click Add, then Save, and you're finished. 





Thursday, March 16, 2023

WhatsApp, dialer and email integration for a flutter WebView application

Recently we were working on an E-commerce website. Then we have decided to build a webview flutter application.  We built it successfully and was working fine. But in the website we have a feature to interact with the customer care executive through WhatsApp. But this did not work in the flutter app. But works very well from the browser on the desktop.  However, because WhatsApp and our flutter app are separate applications, this did not work or we were unable to activate WhatsApp through our application. 

In mobile, we get the below error when we try to click on the whatsApp button in the application: 

ERR_UNKNOWN_URL_SCHEME Error


The url_launcher module in Flutter can be used to incorporate WhatsApp into a Flutter webview application.

1. Add the url_launcher dependency to your pubspec.yaml file:

dependencies:
  url_launcher: ^6.0.9


2.  Import the url_launcher package in your Dart file:

        import 'package:url_launcher/url_launcher.dart';



3.  In your webview widget, add an onPageFinished callback that gets triggered when the page finishes loading. Inside this callback, you can use url_launcher to launch WhatsApp:

WebView(

  initialUrl: 'https://example.com',

  onPageFinished: (String url) {

    if (url.contains('whatsapp://send')) {

      launch(url);

    }

  },

)


or: 

navigationDelegate: (NavigationRequest request) {
            if (request.url.contains('api.whatsapp.com')) {
              launch(request.url); //This is where Whatsapp launches
              return NavigationDecision.prevent;
            }

In the above code, we check if the URL contains whatsapp://send. If it does, we use launch to open the URL in the system's default browser, which will launch WhatsApp if it is installed.
Note that this will only work on devices that have WhatsApp installed. If WhatsApp is not installed, the URL will not be opened.


Same thing we can do for a dialer and email integrations: Here is the code for that

 if (request.url.contains('mailto:')) {
              launch(request.url);
              return NavigationDecision.prevent;
            }

            if (request.url.contains('tel:')) {
              launch(request.url);
              return NavigationDecision.prevent;
            }


In some cases, the other urls apart from this may not work so, you  need to add NavigationDecision.Navigate option as shown in the below code:

 if (request.url.contains('wa.me')) {
              launch(request.url); //This is where Whatsapp launches
              return NavigationDecision.prevent;
            }
            if (request.url.contains('mailto:')) {
              launch(request.url);
              return NavigationDecision.prevent;
            }

            if (request.url.contains('tel:')) {
              launch(request.url);
              return NavigationDecision.prevent;
            }
            return NavigationDecision.navigate;
          },



Hope this helps. 




Monday, March 6, 2023

How to Change Version Code and Version Name in Flutter

We released a flutter application on the Play Store, and now I want to submit a new version of the application. We are attempting to alter the version number using the below command in Visual Studio Code:

flutter build apk --build-name=1.3.0 --build-number=3

or alterring the local.properties like this (through Android Studio or Visual Studio Code)

 

 flutter.versionName=1.3.0
 flutter.versionCode=3
 flutter.buildMode=release

 

With these changes when we build the apk bundle and try to release it in Google play store, We get the below error from play store:

You must use a different version code for your APK or your Android App Bundle because code 1 is already assigned to another APK or Android App Bundle

The Solution for this is as below: 

1. Go to build.gradle and the change the flutterVersionCode and flutterVersionName  as below
        
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1.3.0'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '3.0'
}

2. Go to pubspec.yaml file and add the versionCode and versionName as below:

version: 1.4.0+4

environment:
sdk: ">=2.12.0 <3.0.0"

Update version:A.B.C+X in pubspec.yaml.

For Android:

A.B.C represents the versionName such as 1.0.0.

X (the number after the +) represents the versionCode such as 1, 2, 3, etc.

Do not forget to execute flutter build apk or flutter run after this step, because: When you run flutter build apk or flutter run after updating this version in the pubspec file, the versionName and versionCode in local.properties are updated which are later picked up in the build.gradle (app) when you build your flutter project using flutter build apk or flutter run which is ultimately responsible for setting the versionName and versionCode for the apk.

For iOS:

A.B.C represents the CFBundleShortVersionString such as 1.0.0.
X (the number after the +) represents the CFBundleVersion such as 1, 2, 3, etc.
Do not forget to execute flutter build ipa or flutter run after this step

Happy Coding 


Saturday, March 4, 2023

Top 10 Coding Languages to Learn to Work in Technology in 2023

Programming languages are obviously very important to software engineers. Programming languages have not only made it simpler for coders to finish their work, but they have also made it possible for organizations to accomplish their objectives in the most effective way possible. 

You've come to the correct spot if you're curious about the programming languages that software developers use the most.


Python - Python is an easy-to-learn, high-level programming language that is widely used in web development, data analysis, machine learning, artificial intelligence, and scientific computing. Python is a high-level, interpreted programming language that is widely used for various purposes, including web development, scientific computing, data analysis, artificial intelligence, machine learning, automation, and more. Here are some key details about Python: 

Python was first released in 1991 by Guido van Rossum and has since become one of the most popular programming languages in the world.  Python is known for its simple and easy-to-learn syntax, which makes it an ideal language for beginners. Python supports multiple programming paradigms, including object-oriented, functional, and procedural programming.

Python has a vast standard library that provides a wide range of modules and functions for various tasks, from file I/O to web development. Python is an interpreted language, which means that the code is executed line by line rather than being compiled into machine code beforehand. Python is highly extensible and can be easily integrated with other languages like C and C++. Python has a large and active community of developers who contribute to its development and create a wide range of third-party libraries and frameworks.

Overall, Python is a versatile and powerful programming language that can be used for a wide range of tasks, from simple scripts to complex applications.

 
JavaScript and TypeScript - JavaScript is the programming language of the web and is widely used in front-end web development, creating dynamic user interfaces, and building web applications. TypeScript is a superset of JavaScript that adds static typing to the language. It is popular for building large-scale applications. 

JavaScript and TypeScript are both programming languages that are widely used for web development. Here are some key details about each language.

JavaScript: 
 
  • JavaScript is a high-level, dynamic programming language that is used primarily for front-end web development. It is supported by all modern web browsers and is used to create dynamic and interactive user interfaces. 
  • JavaScript is often combined with HTML and CSS to create dynamic web pages and web applications. 
  • JavaScript is an interpreted language, which means that the code is executed in the web browser rather than being compiled into machine code beforehand.
  • JavaScript has a vast ecosystem of third-party libraries and frameworks, including React, Vue, and Angular, which make it easier to develop complex web applications.

 TypeScript:

  • TypeScript is a superset of JavaScript that adds static typing and other features to the language. It is often used for larger-scale web applications that require more structure and maintainability.  
  • TypeScript is designed to be easy to read and understand, with a syntax that is similar to JavaScript.
  • TypeScript is compiled into JavaScript before it is executed, which means that it can be used in any browser that supports JavaScript.
  • TypeScript has a strong type system that helps catch errors before runtime, making it easier to maintain and debug code.
  • TypeScript is often used with popular front-end frameworks like Angular and React, but it can also be used on the back-end with Node.js.

Overall, both JavaScript and TypeScript are important languages for web development, with JavaScript being more widely used for front-end development and TypeScript being used for larger-scale applications that require more structure and maintainability.

 
Java - Java is a versatile programming language that is used to develop applications for desktops, mobile devices, and the web.

Java is a popular programming language that is widely used for developing a variety of applications, from desktop and mobile applications to web-based applications and enterprise-level systems. Here are some key details about Java:

  • Java was first released in 1995 by Sun Microsystems and has since become one of the most popular programming languages in the world.
  • Java is a high-level, object-oriented programming language that is designed to be platform-independent, which means that it can run on any platform that has a Java Virtual Machine (JVM). 
  • Java is strongly typed, which means that it requires variable declarations and is less prone to type errors.
  • Java has a large standard library that provides a wide range of functions and utilities for various tasks, from file I/O to network programming.
  • Java is often used in enterprise-level systems and web development, with popular frameworks like Spring and Struts.
  • Java is known for its security features, which make it a popular choice for developing applications that require a high level of security, such as banking and financial systems.
  • Java is also widely used for Android app development, with Android Studio being the primary development environment for Android applications.

Overall, Java is a versatile and powerful programming language that can be used for a wide range of applications, from desktop and mobile applications to web-based and enterprise-level systems. Its platform independence, strong typing, and large standard library make it a popular choice for developers of all levels.

 
Kotlin - Kotlin is a modern, concise programming language that is designed to be more readable and efficient than Java. It is widely used in Android app development. Kotlin is a modern programming language that is designed to be a more concise, expressive, and safe alternative to Java. It is an open-source language developed by JetBrains, the company behind popular IDEs like IntelliJ IDEA and Android Studio. Here are some key details about Kotlin:

  • Kotlin is a statically typed language that is fully interoperable with Java, which means that it can be used alongside Java in existing projects.
  • Kotlin is designed to be more concise than Java, with a syntax that is more expressive and readable. It also eliminates a lot of the boilerplate code that is required in Java.
  • Kotlin is an object-oriented language that supports functional programming constructs like lambdas, higher-order functions, and coroutines.
  • Kotlin is designed to be safe, with features like null safety and type inference that help prevent common errors and improve code quality.
  • Kotlin is often used for developing Android applications, with Google officially supporting Kotlin as a first-class language for Android development.
  • Kotlin also has a growing ecosystem of libraries and frameworks, including popular frameworks like Spring Boot and Ktor.

 Overall, Kotlin is a modern and powerful language that offers many advantages over Java, including increased productivity, better readability, and improved safety. Its interoperability with Java also makes it an attractive choice for developers who want to migrate to a more modern language without having to rewrite their entire codebase.


 
Swift - Swift is the primary programming language used to develop applications for iOS and macOS devices. It is a fast and powerful language that is easy to learn. Swift is a modern programming language developed by Apple for developing applications for iOS, macOS, watchOS, and tvOS. Here are some key details about Swift: 
  • Swift was first introduced by Apple in 2014 and has since become the primary language for iOS app development.
  • Swift is designed to be a fast and safe language, with a syntax that is easy to read and write.
  • Swift is a strongly typed language that supports both object-oriented and functional programming paradigms.
  • Swift offers a number of features that make it easier to write safe and reliable code, including optionals, type inference, and automatic memory management.
  • Swift is open-source, which means that it is free to use and can be used on platforms other than Apple's.
  • Swift has a growing ecosystem of third-party libraries and frameworks, including popular frameworks like SwiftUI and Combine.

Overall, Swift is a powerful and modern language that offers many advantages over Objective-C, the previous primary language for iOS app development. Its focus on safety and reliability, combined with its ease of use and growing ecosystem, make it an attractive choice for developers who want to build high-quality iOS, macOS, watchOS, and tvOS applications.

 
Rust - Rust is a systems programming language that is designed to be fast, secure, and reliable. It is used to build applications that require high performance and low-level control. It was created by Mozilla and released in 2010, and has since gained popularity among developers for its unique features and capabilities. Here are some key details about Rust:

  • Rust is a statically typed language that is designed for systems programming, which means that it is intended for low-level programming tasks like writing operating systems, device drivers, and high-performance applications.  
  • Rust offers a number of features that make it easier to write safe and reliable code, including memory safety guarantees, zero-cost abstractions, and pattern matching.
  • Rust has a syntax that is similar to C++, but with a number of modern features that make it easier to write and maintain code.
  • Rust is designed to be a fast language, with performance comparable to C and C++.
  • Rust has a growing ecosystem of third-party libraries and frameworks, including popular frameworks like Rocket and Actix.
  • Rust has a strong focus on community and open-source development, with a large and active community of developers contributing to the language and its ecosystem.

Overall, Rust is a powerful and unique language that offers many advantages over traditional systems programming languages like C and C++. Its focus on safety and reliability, combined with its modern features and growing ecosystem, make it an attractive choice for developers who want to build high-performance systems-level applications.

 
Go - Go is a programming language developed by Google that is used to build scalable, high-performance applications. It is popular for building web servers and networking applications. Go, also known as Golang, is a modern programming language developed by Google in 2007. It was designed to be a simple, efficient, and scalable language that is easy to learn and use. Here are some key details about Go: 
  • Go is a statically typed language that is designed for concurrency and multi-core processing, which means that it is optimized for running on modern hardware.
  • Go offers a number of features that make it easy to write simple, efficient, and maintainable code, including garbage collection, automatic memory management, and a syntax that is similar to C. 
  • Go has a large standard library that provides a wide range of functions and utilities for various tasks, from network programming to web development.
  • Go is often used for developing server-side applications, with popular frameworks like Gin and Echo. 
  • Go has a growing ecosystem of third-party libraries and tools, including popular tools like Docker and Kubernetes.
  •  Go is open-source, which means that it is free to use and can be used on platforms other than Google's.

Overall, Go is a powerful and efficient language that offers many advantages over traditional programming languages like C and Java. Its focus on simplicity, efficiency, and concurrency, combined with its growing ecosystem, make it an attractive choice for developers who want to build high-performance server-side applications.


C++ - C++ is a high-level programming language that is widely used for developing applications in a variety of domains, including system programming, game development, and scientific computing. It is an extension of the C programming language, with added features that make it more powerful and flexible. Here are some key details about C++:

  • C++ is a statically typed language, which means that types are checked at compile-time, resulting in faster code execution.
  • C++ is an object-oriented language, which means that it supports features like classes, inheritance, and polymorphism.
  • C++ provides low-level programming constructs like pointers and memory management, which makes it useful for system programming.
  • C++ is often used for developing games, as it provides powerful graphics and audio APIs.
  • C++ is also used in scientific computing, as it provides access to high-performance libraries like the Boost C++ Libraries and the Armadillo library.
  • C++ has a large and active community, with many third-party libraries and frameworks available for various tasks.

Overall, C++ is a powerful and flexible language that is suitable for a wide range of applications. Its low-level programming constructs, object-oriented features, and support for high-performance computing make it an attractive choice for developers who want to build robust and high-performance applications. However, its syntax can be complex and difficult to learn for beginners, and it requires careful attention to memory management to avoid bugs and crashes.

 
Ruby - Ruby is a dynamic, object-oriented programming language that is popular for building web applications, especially with the Ruby on Rails framework. This was created by Yukihiro "Matz" Matsumoto in 1995. It is known for its simplicity, flexibility, and ease of use. Here are some key details about Ruby: 

  • Ruby is a dynamically typed language, which means that it does not require explicit type declarations for variables.
  • Ruby is designed to be easy to read and write, with a syntax that is similar to natural language.
  • Ruby is an object-oriented language, which means that everything in Ruby is an object.
  • Ruby has a large and vibrant community, with many third-party libraries and frameworks available for various tasks, including popular frameworks like Ruby on Rails.
  • Ruby is often used for developing web applications, but it can also be used for other tasks like automation, scripting, and data analysis.
  • Ruby has a strong focus on developer happiness, with a philosophy that emphasizes the importance of making programming enjoyable and fun.

Overall, Ruby is a popular and powerful language that offers many advantages over other programming languages. Its simplicity, flexibility, and ease of use make it an attractive choice for developers who want to build high-quality web applications or other software.


Laravel- Laravel is a popular PHP Web application framework that is widely used in web development. It provides elegant syntax and a set of tools and features that make it easy to build scalable and maintainable web applications. 
Laravel is a free and open-source PHP web application framework that was created by Taylor Otwell in 2011. It is designed to simplify the development of web applications by providing an elegant syntax, a range of tools, and a wide variety of features. Here are some key details about Laravel:

  • Laravel is built on top of the PHP language, which is widely used for web development.
  • Laravel follows the Model-View-Controller (MVC) architectural pattern, which separates the application's concerns into three distinct components.
  • Laravel provides a range of features, including built-in authentication, database migrations, task scheduling, and unit testing.
  • Laravel has a simple and elegant syntax that is easy to read and write, which makes it a popular choice for developers who want to build web applications quickly.
  • Laravel has a large and active community, with many third-party packages and libraries available for various tasks.
  • Laravel is often used for developing web applications, including e-commerce platforms, content management systems, and social networking sites.

Overall, Laravel is a powerful and flexible web application framework that is suitable for a wide range of applications. Its elegant syntax, rich feature set, and active community make it an attractive choice for developers who want to build high-quality web applications quickly and efficiently.


Disclaimer: The information provided in this article is solely the author's opinion and not an investment advice – it is provided for educational purposes only. By using this, you agree that the information does not constitute any investment or financial instructions by the author.