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.