Introduction

As a mobile app developer, you’re constantly looking for ways to simplify your development process while still delivering feature-rich, high-quality applications. Xamarin is an excellent choice for building cross-platform mobile apps, and Xamarin.Essentials is a powerful companion library that can save you time and effort by providing access to native APIs through a single, unified interface. In this blog post, we’ll explore the Xamarin.Essentials library, its most useful features, and how developers can easily integrate these components into their Xamarin projects.

What is Xamarin.Essentials?

Xamarin.Essentials is a library that provides developers with a wide range of cross-platform APIs to access native device features using a shared codebase. It eliminates the need to write platform-specific code for common app functionalities like accessing the device’s file system, geolocation, or connectivity information. Xamarin.Essentials is compatible with Xamarin.iOS, Xamarin.Android, and Xamarin.Forms projects, allowing you to streamline your app development process.

Getting Started with Xamarin.Essentials

To start using Xamarin.Essentials in your project, follow these simple steps:

Install the Xamarin.Essentials NuGet package: In Visual Studio, navigate to the NuGet Package Manager and search for ‘Xamarin.Essentials’. Install the package to your shared code project and your platform specific projects (iOS, Android, and UWP, if applicable).

Add the required initialization code:

For Android, open the MainActivity.cs file and add Xamarin.Essentials.Platform.Init in the OnCreate method:

protected override void OnCreate(Bundle savedInstanceState)
{

Xamarin.Essentials.Platform.Init(this, savedInstanceState);

}

For iOS, open the AppDelegate.cs file and add Xamarin.Essentials.Platform.Init in the FinishedLaunching method:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{

Xamarin.Essentials.Platform.Init();

}

For UWP, open the MainPage.xaml.cs file and add Xamarin.Essentials.Platform.Init in the MainPage constructor:

public MainPage()
{

Xamarin.Essentials.Platform.Init();

}

Update your app permissions: Based on the APIs you use, you may need to add specific permissions to your platform-specific projects. Refer to the Xamarin.Essentials documentation for the required permissions for each API.

Popular Xamarin.Essentials Features

Now that you’ve set up Xamarin.Essentials let’s explore some of its popular features and how to implement them in your Xamarin projects:

Geolocation

Obtain the user’s current location, calculate distances, and track location changes. To get the user’s location, use the Geolocation.GetLocationAsync method:

using Xamarin.Essentials;

public async Task GetCurrentLocationAsync()
{
try
{
var location = await Geolocation.GetLocationAsync();
return location;
}
catch (Exception ex)
{
// Handle exceptions
}
return null;

}

Connectivity

Check the user’s internet connection status and monitor for changes.

To check if the user has an active internet connection, use the Connectivity.NetworkAccess property:

using Xamarin.Essentials;


public bool IsConnectedToInternet()
{
var networkAccess = Connectivity.NetworkAccess;
return networkAccess == NetworkAccess.Internet;
}

To monitor connectivity changes, subscribe to the Connectivity.ConnectivityChanged event:

using Xamarin.Essentials;

public void SubscribeToConnectivityChanges()
{
Connectivity.ConnectivityChanged += OnConnectivityChanged;
}

private void OnConnectivityChanged(object sender, ConnectivityChangedEventArgs e)
{
var networkAccess = e.NetworkAccess;
// Handle connectivity changes
}

Device Information

Get information about the user’s device, such as the model, OS version, and screen metrics.

To obtain device information, use the properties provided by the DeviceInfo class:

using Xamarin.Essentials;

public string GetDeviceInformation()
{
string model = DeviceInfo.Model;
string manufacturer = DeviceInfo.Manufacturer;
string osVersion = DeviceInfo.VersionString;
DevicePlatform platform = DeviceInfo.Platform;

return $"Model: {model}\nManufacturer: {manufacturer}\nOS Version: {osVersion}\nPlatform: {platform}";

}

Conclusion

Xamarin.Essentials is a valuable tool that can help you create feature-rich, cross-platform mobile apps with a unified, shared codebase. By leveraging the powerful, pre-built components it offers, you can save time and effort, streamline your app development process, and focus on delivering a fantastic user experience. To explore more Xamarin.Essentials features, visit the official documentation. Happy coding!

Women Learning on a Computer.

If you are looking to become a Security Engineer or already started on the path, below is a learning path that could be followed to achieve the goal.

  1. Learn the basics of computer networking:
    • Start by learning the fundamentals of computer networking, such as the OSI model, network topologies, and protocols. You can find plenty of resources online, such as videos and tutorials.
    • Familiarize yourself with networking devices such as routers, switches, firewalls, and load balancers.
    • Learn about IP addressing, TCP/IP, DNS, and DHCP. These are the building blocks of network communication and are essential for a security engineer.
    • Practice configuring network devices, such as setting up VLANs, access control lists, and VPNs.
    • Links
  1. Gain proficiency in programming:
    • Choose a programming language to focus on, such as Python or Bash.
    • Start by learning the basics of programming, such as syntax, data types, and control structures.
    • Move on to more advanced topics, such as file I/O, error handling, and regular expressions.
    • Practice writing scripts and programs to automate tasks, such as network scanning or log analysis.
    • Explore libraries and frameworks that can help you with specific security tasks, such as Scapy or PyCryptodome.
    • Links
  1. Develop a solid understanding of operating systems:
    • Choose an operating system to focus on, such as Linux or Windows.
    • Learn the basics of the command-line interface and how to navigate the file system.
    • Familiarize yourself with system administration tasks, such as managing users and permissions, configuring services, and troubleshooting.
    • Learn about security features of the operating system, such as firewalls, antivirus software, and encryption.
    • Links
  1. Learn the fundamentals of cybersecurity:
  1. Get familiar with penetration testing:
    • Learn about the different phases of a penetration testing engagement, such as reconnaissance, scanning, enumeration, exploitation, and post-exploitation.
    • Practice using penetration testing tools such as nmap, Metasploit, and Burp Suite.
    • Learn about web application security testing, such as SQL injection and cross-site scripting.
    • Familiarize yourself with wireless security testing, such as cracking WPA2 passwords and sniffing wireless traffic.
    • Links
  1. Study security frameworks and standards:
    • Study security frameworks such as NIST, ISO 27001, and CIS. These frameworks provide guidelines on how to secure systems and networks.
    • Learn about compliance standards, such as PCI-DSS and HIPAA. These standards are mandatory for certain industries and provide guidance on how to protect sensitive data.
    • Explore privacy regulations such as GDPR and CCPA. These regulations provide guidance on how to handle personal data and protect individual privacy.
    • Links
  1. Gain practical experience:
    • Participate in security-related projects, such as creating a honeypot or building a secure web application.
    • Join bug bounty programs and practice finding and reporting vulnerabilities in web applications and software.
    • Do an internship in a security-related field. This will give you hands-on experience and help you build your skills.
    • Links
  1. Get certified:
  1. Keep up to date:
    • Cybersecurity is a rapidly evolving field, and it is important to stay up to date with the latest threats, technologies, and trends.
    • Subscribe to security blogs and news sites to stay up to date with the latest developments in the field.
    • Attend conferences, seminars, and webinars to network with other security professionals and learn about new technologies and techniques.
    • Join online communities such as Reddit or StackExchange to discuss security topics with other professionals.
    • Participate in CTF (Capture the Flag) competitions to practice your skills and learn new techniques.
    • Links
  2. Specialize in a specific area:

Questions, Comments and Feedbacks are welcome.

Azure is constantly adding new tools to its arsenal and although Azure Data Factory is not new but I have been recently working a lot with it to manage and transform data. In the process I learned a lot about the various capabilities of ADF and also managed to figure out a few tricks. In this series I would share what I have learned so far to help anyone who is taking steps towards a similar journey.

Azure Data Factory allows us to manage the ETL lifecycle for the big data with the flexibility of serverless scaling. Let’s create a Data Factory and I will explain more as we proceed. Navigate to Azure Portal if not already there and search for Data Factories in the search bar. Select Data Factories from the result.

You will be taken to the Data Factories Blade. If you have not created any then you should see a screen like below.

Click on Create Data Factory and you will be taken to the blade like below to enter the details like subscription, resource group, region name and version. As of today V2 is the latest version.

If you like you could enter setup a git repository for the Data Factory. I created a repo and added the details.

The next option is to add tags. I am going to skip that as I am not going to use them in this demo. Once you click next you would see the Review + Create section. If all the validation pass you would be able to Create the Data Factory.

Once you click on create, you would see the deployment starting and once the resource is created you should see something like below.

Click on Go to resource and we will be taken to the Data Factory. You will a lot of details about the Data Factory here just like any other Azure Resource. The couple of like that I would like to point out are

  • Author and Monitor – this will take to another interface where we will be able to create the Pipelines (scheduled data-driven workflows) that would the ETL for us.
  • Documentation – as you already know this would give pretty detailed information about the different aspects of the Data Factories.

I would leave the documentation part up to you to browse through. Let’s navigate to Author and Monitor.

If you added GitHub details while creating the Data Factory then you would be asked to Login to GitHub to provide ADF the necessary permissions.

Once you are done with that you would see a screen like below. The main navigation is in the top left corner of the page. Click on the

This will take to the screen below. Since this the first time we are we do not have anything at the moment. Let’s go ahead and click on the + in the top left corner and select pipeline.

This will create a pipeline and show the Activities toolbar which we will use to drag and drop new activities into the pipeline.

You will also notice that there is yellow indicator with number 1 below the Author Icon. This is because we now have changes that unpublished.

* Your top menu might be a little different if you did not select GitHub for source control.

Let’s add a Copy data activity to the pipeline. We can do this by dragging and dropping the Copy data activity from Move & transform onto the central screen.

We will copy data from a SQL Server database to the blob storage. I am not going to cover the creation of SQL Server Database. If you do not have one then you could take this as an assignment to create one. Now let’s link to the SQL Database under the Source. Click on New.

This will open a flyout on the side and we can select SQL as the new Dataset.

We do not have a linked service yet so let’s go ahead and create one which will let us connect to the Sql database we have.

Once we have saved the dataset and linked service information, we should see something like below in the Source section

We want to copy the data to Blob storage. Just like SQL storage, I am not going to go into details of creating a blob storage. I hope you are able to set that on your own. If you are unable to do so then please comment on the post and I will add the details for it. Let’s select New and create a new dataset for the blob storage and select the Azure Blob Storage.

Select the DelimitedText and select New for the creation of Linked service.

Add the required details for the Azure Blob Storage and make sure you test connection.

Once we have setup the copy data then click on Debug to run the activity.

This will run the pipeline in Debug mode and show the run details in the output tab in the bottom. You would be able to see more details about the run when you click on the glasses icon. Also clicking on the two arrow icons you could see the input and output to this activity.

Also when I browse to the container in the Blob Storage I am able to see the data from the SQL database there.

Hope you found this helpful. Feel free to leave feedback and questions.

WHO has declared Coronavirus a global pandemic and almost every country in the world is impacted by it. A lot of people are trying to track the state of pandemic and it’s impact. A lot of people and organizations have come forward to help in this global crisis. But just like everything else where there is good there is evil. Malicious apps, websites, scams and ransomware have spun up to take advantage of the situation.

One of the ransomeware app it the Covid 19 Tracker which promises to give you the real time tracking of the spreading virus near you.

But in the background changes the password of your android phone and locks it. It then demands $100 in Bitcoin to be paid to be able to unlock your phone.

Be safe and just like always visit only the sites you trust and please refrain from installing untrusted apps on your mobile phone.

Microsoft has delivered the fastest project of this size that I know of to provide accurate and up to date information on the coronavirus (COVID-19). You can visit the live tracker at https://bing.com/covid. The website is mobile friendly as well.

XOR cipher is a simple additive encryption technique in itself but is used commonly in other encryption techniques. The truth table for XOR cipher is as below. If the bits are same then the result is 0 and if the bits are different then the result is 1.

 

Bit 1 Operation Bit 2 Result
0 0 0
1 0 1
0 0 1
1 1 0

 

Let’s take an example. We would encrypt Sun using the key 01010010 repeatedly .

Encryption
Text          |     S    |     u     |     n       |
ACII Code     |    083   |    117    |    110      |
Binary        | 01010011 |  01110101 |  01101110   |
Key           | 01010010 |  01010010 |  01010010   |
Cipher        | 00000001 |  00100111 |  00111100   |

Now if we XOR the cipher with the same key we will get back the out original text.

Decryption
Cipher        | 00000001 |  00100111 |  00111100   |  
Key           | 01010010 |  01010010 |  01010010   |
Output        | 01010011 |  01110101 |  01101110   |
ACII Code     |    083   |    117    |     110     |
Text          |     S    |     u     |      n      |

This encryption we just did was not very secure because used the same key over and over again. To make our encryption more secure we should use a unique key and not the one which is repetitive in nature. A good technique that could be used is One-time Pad. This makes the encryption much more secure to the brute force attack.

XOR encryption and decryption

The encryption and decryption using XOR has the same code. A python implementation for the same is below:

 

input_str = raw_input("Enter the cipher text or plain text: ")
key = raw_input("Enter the key for encryption or decryption: ")
no_of_itr = len(input_str)
output_str = ""


for i in range(no_of_itr):
    current = input_str[i]
    current_key = key[i%len(key)]
    output_str += chr(ord(current) ^ ord(current_key))

print "Here's the output: ", output_str

And here’s a sample run

Image showing sample run of ROT13 encoder decoder

Image showing sample run of XOR encryption and decryption

 

The entire source code for this post can be found at https://github.com/abhishuk85/cryptography-plays

Any questions, comments or feedback are most welcome.