Get 1000% ROI by building agile

We deliver complex software architecture solutions quickly so you can hit the market asap and get huge returns

Leverage our talented pool of developers and architects to craft a modern and beautiful, responsive, and realtime expert system to streamline your business processes.

We provide comprehensive management of your project throughout the entire software cycle, from planning and audit, to implementation, to deployment and operations.





git

Git Notes

A collection of git commands and scenarios

remote: error: File file.zip is 200.00 MB; this exceeds GitHub's file size limit of 100.00 MB
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/...'
$ git filter-branch --tree-filter 'rm -rf file.zip' a12345.HEAD
$ git push origin master --force

See entire post »

groovy

Java FTPSClient Implicit Mode 550 Error

execPBSZ(0)
execPROT("P")
import org.apache.commons.net.ftp.FTPSClient

new FTPSClient("TLSv1", true).with {
  connect "localhost", 990
  execPBSZ(0)
  execPROT("P")
  login "user", "pass"
  setControlEncoding("UTF-8");
  enterLocalPassiveMode()
  setFileType(FTP.ASCII_FILE_TYPE)
  setFileTransferMode(FTP.ASCII_FILE_TYPE)
  changeWorkingDirectory ("/home/user")
  def stream = new BufferedInputStream(
    new FileInputStream("file.txt"))
  if (stream.available() == 0) {
    throw new Exception("Cannot read local file stream!")
  }
  result = it.storeFile(destFilename, stream)
  stream.close()
  logout()
  disconnect()
}

See entire post »

grails groovy

Grails Config: Bootstrap.groovy

import grails.util.Environment

class BootStrap {
  def init = { servletContext ->
    println "Initializing..."
    if (Environment.current == Environment.DEVELOPMENT) {
      println "Development"
    } else if (Environment.current == Environment.TEST) {
      println "Test"
    } else if (Environment.current == Environment.PRODUCTION) {
      println "Production"
    }
  }

  /**
   * Note: this is not guaranteed to be called by the servlet container
   */
  def destroy = {
    printn "De-initializing..."
    if (Environment.current == Environment.DEVELOPMENT) {
    } else if (Environment.current == Environment.TEST) {
    } else if (Environment.current == Environment.PRODUCTION) {
    }
  }
}
import org.springframework.web.context.support.WebApplicationContextUtils

class BootStrap {
  def init = { servletContext ->
    def springContext = WebApplicationContextUtils.getWebApplicationContext(servletContext)
    println "Initializing..."
    def service = springContext.getBean("notificationService")
    service.sendAdminNotification("[UP] started")
  }

  /**
   * Note: this is not guaranteed to be called by the servlet container
   */
  def destroy = { servletContext ->
    printn "De-initializing..."
    def springContext = WebApplicationContextUtils.getWebApplicationContext(servletContext)
    if (Environment.current == Environment.DEVELOPMENT) {
    } else if (Environment.current == Environment.TEST) {
    } else if (Environment.current == Environment.PRODUCTION) {
      def service = springContext.getBean("notificationService")
      service.sendAdminNotification("[DOWN] destroyed")
    }
  }
}
import org.springframework.web.context.support.WebApplicationContextUtils
import org.springframework.cloud.CloudFactory
import org.springframework.cloud.CloudException

class BootStrap {
  def grailsApplication

  def init = { servletContext ->
    def springContext = WebApplicationContextUtils.getWebApplicationContext(servletContext)
    println "Initializing..."
    println "Datasource: " + grailsApplication.config.dataSource
    println "Mongo: " + grailsApplication.config.grails.mongo
    // Get bean ref
    def mongo = springContext.getBean("mongo")
    // Get cloud info
    def cloud = null
    def dbName = "mydb"
    try {
      cloud = new CloudFactory().cloud
      // Get database name for bound service
      def mongoInfo = cloud?.getServiceInfo('myservice-db')
      dbName  = mongoInfo?.database
      println "Got dbName from cloud info: " + dbName
    } catch (CloudException e) {
      println "ERROR getting cloud: " + e
    }
    def db = mongo.getDB(dbName)
    println "Got db: " + db
  }
}

See entire post »

camel groovy

Camel JSON Marshalling

// xstream default
from("direct:input")
.marshal()
.json()
.to("log:main?showBody=true")
{"map":{"entry":[{"string":"input3","list":{"string":[1,2]}},{"string":["input2","abc123"]},{"string":["input1","abcde"]}]}}
import org.apache.camel.model.dataformat.JsonLibrary

// ...

from("direct:input")
.marshal()
.json(JsonLibrary.Jackson)
.to("log:main?showBody=true")

See entire post »