Friday, June 14, 2019

Save binary files in MongoDB with Spring-Boot

Saving binary files in MongoDB is pretty simple with Spring-Boot. You simply need to put byte[] type in the CrudRepository entity:



public interface BinayFilesRepository extends MongoRepository<BinaryEntity, String> {

}

@Document(BinaryEntity = "binaries")
public class BinaryEntity {

    private String id;
    private byte[] data;

}

Wednesday, May 22, 2019

Docker: Run MySql Server

A practical way to start MySQL server using docker:



docker run -d -p 3306:3306 --name=mysql-server --env="MYSQL_ROOT_PASSWORD=123456" mysql --default-authentication-plugin=mysql_native_password


Then just connect outside the container with host:
localhost, port:3306, user:root, password:123456

Monday, February 25, 2019

Customize 'Read More' button text on slider for Wordpress theme

I'm building a site using Wordpress and wanted to change the text in the slider buttons. The text says 'Read More' and since this is a Spanish site, I wanted to translate it. I'm a newbie in Wordpress and was surprised this wasn't something configurable in the theme or general site settings. Most of the solutions I found googling required to add a custom php function to override the text.

At the end I found you can add custom css in the theme. So I used a css trick to change the content. First one hides the element and then uses the after selector in combination with the content css element.


.featured-link a span {
  display: none;
}
.featured-link a:after {
  content: 'Leer';
}




Friday, January 11, 2019

AWS S3 Static Website 403 Forbidden error



Got a 403 forbidden access error when trying to test my S3 static website. I set a policy to enable Get access to all resources but still something was wrong. 

Exploring the security properties found this one: "Block public and cross-account access if bucket has public policies". I disabled it and finally was able to access site.


Thursday, January 10, 2019

AWS S3 Static Website Hosting Error saving new Read Policy


I started an AWS tutorial in which first step is setting up a bucket to host a static website. I was trying to apply a policy to enable read access to all contents of bucket but was getting this error saving it: Error Access Denied. Not a very detailed message.


I found that there is an option to "Block new public bucket policies" set in true by default.

I set it to false and problem solved. I guess AWS wants to make sure no one enables full read access of the entire bucket by mistake.