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.

Tuesday, August 14, 2018

Oracle Materialized View Notes

Check all the mviews:

SELECT * FROM all_mviews;

Refresh an mview:

execute dbms_mview.refresh('my_cool_mview','f');

Tuesday, August 1, 2017

Java Lambdas Tips

Creating a lookup method for an Enum



Without lambdas:

public enum Type {
     
     INFO,
     WARNING,
     ERROR;

     final static Map<String, Type> lookup = new HashMap<String, Type>();
     
     static {
      for(Type type : Type.values()) {
       lookup.put(type.name().toLowerCase(), type);
      }
     }

       
     public static Type of(String value){
         Type val = lookup.get(value == null ? null : value.toLowerCase());
         if(val == null){
             val = ERROR;
         }
         return val;
     }
}

With lambda:


public enum Type {
     INFO,
     WARNING,
     ERROR;

     final static Map<String, Type> lookup = Arrays.stream(Type.values())
          .collect(Collectors.toMap(t -> t.name().toLowerCase(), Function.identity()));

     public static Type of(String value){
         Type val = lookup.get(value == null ? null : value.toLowerCase());
         if(val == null){
            val = ERROR;
         }
         return val;
     }
}