Friday, September 4, 2015

First Taste of iOS, Swift and Xcode

Beyond the basics that can be found on many resources on the net with better quality, here is my founding about some details that take a little more time to found them:


  • Show Document Outline, it is on left bottom of the standard editor of the story board. Here you can find constraint and views elements.
  • Auto Syncing of View and its Controller, it can be enabled on top of assistant editor. On manual mode it appear as square with line in between that in Automatic mode is as 2 joined circle, like assistant editor icon.
  • When using Ctrl + Drag to align horizontally or vertically, it align according to current position of element, so if it is inserted in the center at first, the spacing is zero, then it will go exactly in the center, but if not, it will go according to that space.
  • Don't remove or rename an action method in the code, it should be updated in the Connections Inspector in utilities pane as well.

Monday, June 15, 2015

Verioning by Git Branchs

Version 0.1:

Create a branch (version)
git checkout -b 0.1.x

Do something / Commit / Push

git checkout master
git merge 0.1.x


Version 0.2:

git checkout -b 0.2.x

Do changes / Commit / Push

git checkout master
git merge 0.2.x

Wednesday, May 27, 2015

Groovy: Overloading [] and dot .

class Konf {
    // Initializing overloader
    static {
        // . read
        Konf.metaClass.getProperty = { String prop ->
            println "getProp $prop"
            this."${prop}"        
        }
        // . assignment
        Konf.metaClass.setProperty = { String prop, val ->
            println "setProp $prop $val"            
            this.metaClass."${prop}" = val
        }
    }
    // [] read
    def getAt( String key ) {
        println 'getAt'
        this."${key}"    
    }

    // [] set
    def putAt( String key, val ) {
        println "putAt $key $val" 
        this.metaClass."${key}" = val
    }

    def clear() {

    }
}

Sunday, May 24, 2015

Restore MySQL Replication Failure

RESET SLAVE

START SLAVE UNTIL SQL_AFTER_MTS_GAPS

SET @@GLOBAL.slave_parallel_workers = 0

START SLAVE SQL_THREAD


Saturday, April 18, 2015

Enable/Disable Windows Network Interface

Disable
netsh interface set interface name="Local Area Connection" admin=disabled

Enable
netsh interface set interface name="Local Area Connection" admin=Enabled

Reset
netsh interface set interface name="Local Area Connection" admin=disabled & netsh interface set interface name="Local Area Connection" admin=Enabled

Wednesday, April 8, 2015

Spring Roo 1.2.4, Spring Security 3.1

Customizing voters:

public class MyRightVoter extends RoleVoter implements AccessDecisionVoter
{
    public int vote( Authentication authentication, Object object,
Collection attributes )
    {}
}

Defining proper access decision manager and adding customized voter to it:
* To override http decision manager beans must be added to applicationContext-security.xml and for method based in controller must be added in webmvc-config.xml and add to it.











Adding new decision manager for method and http handling:

* aspectj mode is used when want to add security to our aspects like roo generated aspect (new aspect should be defined to annotate security to methods), this mode should be defined in applicationContext-security.xml, this global definition doesn't require to reference acess-decision-manage, as the main one that is in use, defined in webmvc-config.xml


* It is possible to customize authentication to return customized authority of users by implementing getAuthorities() method.

 * Don't forget to add the following item to spring/webmvc-config.xml to use annotation in spring controllers

Tuesday, April 7, 2015

Get Relative Path of Application Context

def s = ctx.grailsLinkGenerator

s.contextPath

s.serverBaseURL


The service is in the following package :
org.codehaus.groovy.grails.web.mapping.LinkGenerator