Android Studio – using SensorEventListener.

This tutorial is about programming android hardware sensors service: TYPE_ACCELEROMETER.
You can start by using last version of Android Studio version 3.1.1 with the default project Empty Activity.
Is very simple to use accelerometer with Android Studio by read the values and show us into the text view area.
The SensorEventListener is used to read this values.
The MainActivity will need work with: … implements SensorEventListener.
This example can be used also like a good way to learn about this issues.

  • the implements is a keyword specific to interfaces, whereas extends is used to inherit classes;
  •  a class must implement all methods of an interface, unless the class is declared as abstract.

You need to change the default text Hello World from activity_main.xml file with this:

Make changes into file
The functions: onSensorChanged and onAccuracyChanged is not created by I.D.E. and can be created by code inspections when you write the source code.

The result is a text with the values of accelerometer of your hardware.

Posted in All, Android, Programming. Tagged with , , , , .

PowerShell tips – part 009.

Today I come with this simple tutorial about how to show logs from the last day.
The command is very simple and can be used with powershell and administrator command shell like this:

This command is build from Get-EventLog and parse by Get-Date, see options:

About AddDays is not only option you can use it.
You can get all of this options using this command:

Posted in All, Commands, PowerShell, Windows 8. Tagged with , , , , .

C# – First steps with C# and .NET – part 003 .

This tutorial show you how to deal with a C# and forms using Visual Studio Community 2017.
You need to start your project with C# – Windows Form Apps (.NET Framework).
On this default form window project you can change title and some settings like size, colors .
After that , you need to add editbox and label for each area from country , city street and number to window form.
In my example I used text_country for the name of editbox and I let default label1 for the label. The text from label1 I changed to Country to see it on form.
Make this changes for each editbox and label.
You need to have one button named search map point and one webbrowser area to show the location on map.
Next, press on button and make the changes into source code to work with webbrowser area.
The source code is simple – see bellow sorce code and the application screenshot.
The application can be found here:

Posted in All, C#, Programming, Windows 10, Windows 8. Tagged with , , , , , , .

Go – about errors .

The golang come with a fair amount of functions end up returning errors like values.
The golang errors functions looking like this:

You can use the errors package and that implements functions to manipulate errors.
The official golang example:

You can see how is created the new custom errors using the New function:

The fmt package formats an error value by calling its Errorf() string method, see example:

You can add more information about the error using struct type and fields.
The error type is an interface type and can be used into this way.

And an error variable represents any value that can describe itself as a string, see example:

Posted in All, Go, Programming. Tagged with , , , , .

News: Snort tool version for Windows .

This is a news and a simple fix tutorial about this tool.
The Snort tool version for Windows is easy to install and use it.
You can download it from here.
First you need to create an account to the official website to download the rules and also to use the winpcap tool.
You need make all settings for snort.conf file into etc folder.
Because I used then I fix this:

Don’t worry for some warnings about ERROR: null(0) Failed to parse the IP address:
Then you can use the administrator command shell to run it:

The result of this command is this output:

Posted in news. Tagged with , , , , .