Resize view to fit aspect ratio of video in Android ExoPlayer

Been playing with ExoPlayer in Android and trying to resize a view to fit the aspect ratio of the video being played, i.e. fill the view with the video. References: Change resize mode for ExoPlayer Change aspect ratio of SurfaceView for ExoPlayer video 5-part series on building video player using ExoPlayer import android.view.ViewGroup.LayoutParams; import com.google.android.exoplayer2.Player.EventListener; …

Print QR code to network-enabled thermal receipt printer using Java

For more information on the ESC/POS command set which receipt printers use for printing, see What is ESC/POS and How Do I Use It by Michael Billington, also the author of the excellent escpos-php PHP library for receipt printers. Thanks to this StackOverflow post as well: printing QR codes through an ESC/POS thermal printer? 🙂 …

Print Chinese text to network-enabled thermal receipt printer using Java

For more information on the ESC/POS command set which receipt printers use for printing, see What is ESC/POS and How Do I Use It by Michael Billington, also the author of the excellent escpos-php PHP library for receipt printers. Steps to run: Save the code below as NetworkReceiptPrinter.java – change printer IP accordingly. Run javac …

Using COALESCE and logging SQL string in Play Framework 2.x

For future reference…after spending quite some time figuring it out 😛 package models; import com.avaje.ebean.Model; import com.avaje.ebean.Query; import play.Logger; import play.data.validation.Constraints; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = “my_table”) public class MyModel extends Model { @Id public Long id; @Column(name = “name”) public String name; @Constraints.Required @Column(name …