NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| require 'eventmachine' | |
| require 'socket' | |
| require 'kgio' | |
| server = Kgio::TCPServer.new('0.0.0.0', 4242) | |
| module Dispatch | |
| def notify_readable | |
| io = @io.kgio_tryaccept or return | |
| EventMachine.attach(io, Server) |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| import com.marcnuri.transporte.rest.service.CriteriaJpaRepositoryFactoryBean; | |
| import org.eclipse.persistence.config.BatchWriting; | |
| import org.eclipse.persistence.config.PersistenceUnitProperties; | |
| import org.eclipse.persistence.logging.SessionLog; | |
| import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration; | |
| import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | |
| import org.springframework.orm.jpa.JpaTransactionManager; |
| # script used in consul to check if mysql is primary master and asynchronous slave | |
| # v.0.1 - lefred 2018-02-16 | |
| SLAVEOFDC="dc2" | |
| SLAVEUSER="async_repl" | |
| SLAVEPWD="asyncpwd" | |
| # check if we are the primary one | |
| ROLE=$(mysql -h 127.0.0.1 -BNe "select MEMBER_ROLE from performance_schema.replication_group_members where MEMBER_HOST=@@hostname") |
| import numpy as np | |
| import statsmodels.formula.api as sm | |
| def backward_elimination(X, y, sl): | |
| """ | |
| X: the data matrix with the independent variables (predictors) | |
| y: the matrix of the dependent variable (target) | |
| sl: statistical level, by default the user should add 0.05 (5%) | |
| """ | |
| X = np.append(arr=np.ones((len(X),1)).astype(int), values=X, axis=1) | |
| while(True): |