Mark Espinoza

Apache Tapestry 5, Java, Hibernate, PostgreSQL, Maven, Apache Ant, Apache Tomcat, VPS, HTML, CSS, JQuery, GIT, Parsing, Data Analysis.

  • 2018.03.12 AD at 09:52 EDT
    Mark Espinoza

    New Feature - Pager Service

    So downloading about 25MB each time you refresh the site kinda slows things down. So making a list and checking twice - in this case an ArrayList. Tapestry has a very straight forward way of adding services. You create an Interface with an Implementation and a single line in the AppModule class binding your Implementation to your Interface. A Hashtable is the main container for the pager with keys as page numbers and values as ArrayLists containing the blog posts. The pager service loads the Hashtable via a lazy loaded hibernate session call. When the next/previous page is requested the Post object is loaded. This saves load time and bandwidth, and with tapestry's built in event generators/listeners and single line config for services makes it work 'out of the box', kidding but not kidding. Did I mention I wrote ZERO javascript? The heavy lifting is done on the java side of things. The boiler plate code was written by the project creator and contributors, thankfully I don't have to even make a function call. Well, enough of that.

    #datastructure   #pager   #newfeature   #service   #tapestry5  
  • 2018.02.18 AD at 20:40 EST
    Mark Espinoza

    RequireJS Bug? Tweak needed.

    As the site gets bigger, looks like some fixes are needed. In this case I'm using some duct tape. Increasing the timeout in RequireJS for when loading resources. This tends to happen when I clear my cache for testing purposes or when the server is slow, or just restarting. Need a better fix for this eventually.

    #javascript   #timeout   #tapestry5   #requirejs   #bug  
  • 2018.02.17 AD at 23:30 EST
    Mark Espinoza

    Cigars from Poland

    Wife back from Poland. Thank you.

    #cigar   #montecristo  
  • 2017.12.16 AD at 10:35 EST
    Mark Espinoza

    Hibernate mappings (part 1)

    Some hibernate mappings on a Postgres database as they have worked for me. I'll explain the options and the parent/child relationships in a later post. (edited: needed to escape the < and >)
    /* One to One *************************/
    /* Parent Blogger */
    @OneToOne(cascade= CascadeType.ALL)
    @JoinColumn(name = "blogger_stats_id")
    private BloggerStats bloggerStats;

    /* Child BloggerStats */
    @OneToOne(mappedBy = "bloggerStats")
    private Blogger blogger;

    /* One to Many ************************/
    /* Parent/child relationship is switched */
    /* Parent BloggerDocument */
    @ManyToOne(optional = false)
    @JoinColumn(name = "blogger_id")
    private Blogger blogger;

    /* Child Blogger */
    @OneToMany(mappedBy="blogger", cascade=CascadeType.ALL)
    private Set<BloggerDocument> bloggerDocuments = new HashSet<>();

    /* Many to Many ***********************/
    /* Parent Blogger */ @ManyToMany
    private Set<BloggerGroup> bloggerGroups = new HashSet();

    /* Child BloggerGroup*/
    private Set<Blogger> bloggers = new HashSet ();

    #hibernate   #manytomany   #onetoone   #onetomany  
  • 2017.12.09 AD at 11:38 EST
    Mark Espinoza

    What? Snow? Here?

    Forecast was for snow the first night. It snowed, then more in the morning so time to get the kids out and take advantage of it. Hope we get more, hope there's not any ice.

    #snowman   #snow   #snowbeer  
blog Index