Monday, 16 March 2020

Python Learning


Hi Guys !!! Hope all is well.   Today  i am going to put Python example source code fom my GitHub account. Below is the topic covered. Please go and check and share your feedback or any  modification or addition in it. 

https://github.com/Saurabh-12/Python_Learning

1. StreamLit Example (support data science projects using Streamlit)

A good data scientist needs to have a fair bit of knowledge of web frameworks to get along and Web frameworks are hard to learn. It is confusing in all that HTML, CSS, and Javascript with all the hit and trials, for something seemingly simple to do.
I am showing a simple example with Streamlit to plot our data on Web(localhost).

List of file for streamLit exanple

  • app_gif.gif
  • DS_Store
  • football_data.csv
  • StreamLitExample.py

2. Some best Python Trick

I have given example of 36 important python trick to do a long logical operation in short using Standard library. “Hidden Gold”in Python’s Standard Library. Please go through each trick to see the magic of python.

3. Server side example

 - ServerExample.py
If you run above file, It create a server scocket and keep listing for any client connection and data. You can write your client program in python or Android.

4. Class and object example in Python

I have created below example file to show class and object usages in python.
  • Class_Object_Basic.py
  • Mutable_Immutable_Object_In_Python.py
  • Python_Inner_Class.py
  • Passing_Members_Of_One_Class_to_Other.py

5. Top 10 mistake in Python

Some example code to show common mistake in python.
  • Top_10_Mistake_In_Python_Program.py

6. Tuple Example

  • Tuple_And_Methods.py

7. Collections example in python

Below file contains info for each datatype and its examples
  • Python_Collections.py file

8. Famous String methods in python

some famous inbuilt strings methods in python
  • String_Inbuilt_Method_Python.py

9. Function in python

Some famous Python function feature example
  • Python_Function.py

10. Advance Feature Python

I am putting 5 advance feature example in python
  • 5_Advance_Features_Python.py

11. PriorityQueues example

Create and use PriorityQueues in python
  • PriorityQueues.py

12. LinkedList, Queue and Stack Example

I have added LinkedList, Queue and stack implementation example in python
  • LinkedListNode.py
  • QueueExamplePython.py
  • StackExample.py

Thanks
Saurabh Sharma
Happy Coding !!!

Friday, 6 March 2020

PackageManagerService AOSP

Hi Guys!!! Hope All is Well .

Today We are going to analyse PackageManagerService class in Android open source project (AOSP).

  • The Package Manager service is a central service in the Android system
  • It manages all the packages in the system and is central to platform security.
  • It maintains a mapping between user/group identifiers and higher-level permission strings
we will see how permissions are managed and granted by the Package Manager
service.
Path of Package Manager service
http://androidxref.com/8.1.0_r33/xref/frameworks/base/services/core/java/com/android/server/pm/

1. Built-in permission UID mappings are stored on the filesystem at
/system/etc/ permissions/platform.xml 
the code path in AOSP is
http://androidxref.com/8.1.0_r33/xref/frameworks/base/data/etc/platform.xml
This is loaded into the Package Manager service into the following variable:
final SparseArray<HashSet<String>> mSystemPermissions =
                                                                                   new SparseArray<HashSet<String>>();

2. User application permissions
The service maintains user application permissions in the filesystem at
/data/system/packages.xml 
Fire up the emulator and drop into an adb shell. We will inspect the contents of the packages.xml file . Obtain a copy with the following command:
adb pull /data/system/packages.xml

3. Open up the file(step 2) in a text editor and search for the term "UserId"

4. The Package Manager service stores and manages all configuration data in XML files with proper Linux permissions on these files. Internally, the service makes use of XML pull parsers to read and process these files. This service is interrogated by other services, most notably the Activity Manager service, as to whether a package possesses a certain permission or not.


Build a Custom Kernel Module for Android

Hi Guys!!!Hope you are doing well !!!. Today I will describe how you can write a custom kernel module(Hello world) for Android and load it a...