bykovme

This user hasn't shared any biographical information

Right way to create splash screen for Android in Xamarin Forms app

Usually Splash screen for Android is done with separate activity and even official docs on Microsoft website suggesting this way for Xamarin.Forms but it is not correct as splash screen is needed only to fill the time gap between the moment when user taps the icon to start the app the the moment when app is ready for interaction. Creating separate activity, showing it and then switching to actual activity makes the start even longer.

Below is the correct way of splash screen implementation for Xamarin Forms for Android, the app will start without any delay if you follow the tutorial below.

Read the rest of this entry »

, , , , , , , , ,

Leave a comment

Cannot recover macOS High Sierra?

I ran into this issue when tried to recover old macbook air with lost admin password. Choosing recovery did not help as it always ended with error message “recovery server could not be contacted”.

As I discovered it happened because macbook time was not in sync with apple servers, so the following command in terminal helped to resolve the issue:

ntpdate -u time.apple.com

 

, , ,

Leave a comment

Space disappearing on Mac

One day I noticed that the free space started to disappear on my macbook pro (and even deleting files did not free any byte), I had a difference in 100Gb  between the commands `sudo du -shg /` (space used) and `df -h` (actually free available space).  After hours of googling I’ve managed finally to fix the issue (found out that the space disappeared because my time machine worked in a wrong way ) doing the following

  • Disabling time machine in System Preferences
  • Using command line utility tmutil `tmutil thinlocalsnapshots / 1000000000 1` to shrink the space used by time machine
  • Rebooting the mac into the save mode and staying there for about 5 minutes

Making that note just in case I have that problem again to spare the time but in hope that I do not need to use it anymore ( but probably it will help somebody else). I faced this time machine issue first time for 7 years of Macbook usage 😦

, , , , , , , ,

Leave a comment

Extracting amenity tag info from OSM database in 3 simple steps

Step 1. Download the needed OSM database in PBF format from here: planet.openstreetmap.org (be careful, it has huge size, many GBs)

Step 2. Install golang package for for decoding osm pdf files: github.com/qedus/osmpbf

Step 3. Use simple golang program below to decode whatever you need (let’s say you need to find all petrol stations)

Read the rest of this entry »

, , , , , , ,

Leave a comment

Creating ubuntu service for go app

Step 1

Install go program with go install in the app folder

Step 2

Download service script file from here: Service for go app

Step 3

Change {{USERNAME}} in the script to the user you use in ubuntu to run your app and change  {{APPNAME}}  to binary name in your $GOPATH/bin/, if needed fix the path in cmd variable to point to your own $GOPATH folder

Step 4

Rename the service remove ending ‘.sh’ and copy the service file in the folder  /etc/init.d/

Step 5

Run in the terminal chmod 700 /etc/init.d/goappservice

Step 6

Run sudo update-rc.d goappservice defaults

Step 7

Run sudo update-rc.d goappservice enable

Done!

Use usual service commands to work with your new service.

sudo service goappservice start|stop|restart|status

If there is a new version of the app then just run go install in the app folder and restart the service.

Enjoy

, ,

Leave a comment

Sending mail using TLS with Go

As I did not find any example of go program which is sending UTF-8 mail with TLS, I decided to create my own go package with this functionality + example, find more details here: https://github.com/bykovme/tlsmailgo-mascot-mail

 

Mail message can be sent this easy:

 

mail := tlsmail.TLSMail{
	Host:     "mail.your_favorite_hosting_provider.here",  
	Port:     "465",                           
	Sender:   "noreply@mail_from.here",        
	Password: "123456",                        
	TO:       []string{"mail1@mail_to.here"},
	Subject:  subject,                       
	Body:     body,                          
}

err := mail.Send()

if err != nil {
	log.Println("Mail send failure: " + err.Error())
} else {
	log.Println("Mail sent successfully")
}

Enjoy!

, , , , ,

Leave a comment

Fixing not working auto-completion for golang in Visual Studio Code

gophervsMy favorite code editor for GO  (Visual Studio Code with Go extenstion from lukehoban) on my Mac sometimes loses its intelligent behavior when suddenly code completion stops to work.

Usually just couple of commands in terminal recovers auto-completion back to life:

  1. Close Visual Studio Code
  2. Open terminal and stop gocode with gocode close
  3. Update gocode with the command `go get -u github.com/nsf/gocode`
  4. Start Visual Studio Code again and enjoy.

, , , , , ,

Leave a comment