Monday, August 14, 2017

install debian 9 pendrive java web sql nginx jetty9 phpmyadmin mariadb mercurial git, agosto 2017



Infraestructura de Desarrollo en un pedrive, portable, economico ( the cheap way )



1. Pendrive de 16gb espacio, 100Mbps velocidad de transferencia.

2. Bajar con torrent, es mucho mas rapido, y menos carga para los servidores que nos proveen estas facilidades

https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current-live/amd64/bt-hybrid/debian-live-9.1.0-amd64-lxde+nonfree.iso.torrent

3. Con la .iso o .img se puede llevar el instalador a un pendrive de al menos 4gb de espacio.

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/bsdinstall-pre.html

# dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync
 En este caso con el debian queda algo asi:

#dd if=firmware-9.0.0-amd64-DVD-1.iso of=/dev/sdb bs=512; sync;

4. Una vez que booteamos de este pendrive,
F12: en algunas maquinas con alternative boot del F12
ESC: otras maquinas

Pero a partir de UEFI,
en mi caso particular, en las  5 o 7 tipos de maquinas distintas que probe,
portatiles y de escritorio,
necesite entrar a la BIOS
y cambiar a UEFI and Legacy

( es muy probable que encuentre la forma de no modificar el UEFI, en algun momento, por algo esta )

5. Para empezar, perfiero dejar todo eun una sola particion, en el disco pendrive de 16gb
     Ojo NO en la opcion disco mas grande
     Sino en la opcion disco completo y poder seleccionar el de 16gb

6. Cuando logramos bootear el linux, instalador es practicamente intuitivo.
 - Yo prefiero instalarlo todo por defecto,
     excepto que
     prefiero LXDE,
     sin impresora
     y con ssh

7. Permito instalar el Grub, y listo, a rebootear.

8. Una vez que booteo con el sistema nuevo instalado
    Verifico tener internet

    $ip addr 

    me dara si detecto las placas de red eth y wifi
    y si tiene asignada una ip

9. edito el archivo de configuracion

/etc/apt/source.list

 deb http://security.debian.org/debian-security stretch/updates main contrib non-free
 deb http://deb.debian.org/debian/ stretch main contrib non-free
 deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
 deb http://deb.debian.org/debian/ stretch-backports main contrib non-free

10. Actualizo la lista de soft disponible

 # apt -y update; apt -y upgrade; sync;

11. Instalo el soft base para desarrollo, tomando en cuenta programar de forma simple para alumnos que recien comienzan:

#apt -y install openjdk-8-jdk mercurial git medit chromium mariadb-client mariadb-server php-fpm phpmyadmin nginx jetty9

12. Configuro el Mysql

# mysql -u root -e " CREATE USER 'educacion'@'%' IDENTIFIED BY 'educacion'; GRANT ALL PRIVILEGES ON *.* TO 'educacion'@'%' WITH GRANT OPTION;"

13. Configuro el phpmyadmin

#vi /etc/nginx/sites-available/default



# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;

location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}

14. Link Simbolico de phpmyadmin en el directorio donde levanta la web el Nginx

#ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin



15. Restarteo el Nginx

#systemctl restart nginx

16. Verifico

http://localhost/phpmyadmin

17. Busco el NetBeans  

https://netbeans.org/downloads/

Instalo la version con Apache Tomcat, no utilizo el Glassfish porque es muy pesado, para desarrollo en un pendrive. ( tomando en cuenta que las maquinas en las que a veces trabajo tienen poca potencia, otras no )




18. Ajuste de la version, que algun bug puede tener: Hay que Comentar una linea ( con el caracter # )

/usr/lib/jvm/default-java/jre/lib/accessibility.properties

#assistive_technologies=org.GNOME.Accessibility.AtkWrapper



Friday, September 2, 2011

Wednesday, May 13, 2009

ruby on rails, googlebot(at)googlebot.com, No HTTP_REFERER, canonical and consistent websites



When you have an exception from the system, something like:


Subject: [ERROR] ships#flag_choice (ActionController::RedirectBackError) "No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env[\"HTTP_REFERER\"]."


A ActionController::RedirectBackError occurred in ships#flag_choice:

No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].




Is your chance to make a better website, a browseable website for robots.



Here you have:

app/controllers/application.rb

before_filter :load_url_back

def flag_choice
set_locale(params[:id])
session["lang"] = "#{params[:id]}"
#redirect_to :back
redirect_to params[:url_back]
end

def load_url_back
@url_back = "http://" + request.env["HTTP_HOST"]
+ request.env["REQUEST_URI"]
end


apps/views/layouts/application.html.erb

<%= link_to(image_tag('ingles.png'),
:action => 'flag_choice', :id => 'en_EN',
:url_back => @url_back ) %>
<%= link_to(image_tag('esp.png'),
:action => 'flag_choice', :id => 'es_AR',
:url_back => @url_back ) %>





Now we have consistent links that can be saved in any place, and consulted without history of browser navigation. This makes your links independent from where you came from.
And in the controller you are working in a request that just need canonical information from the HTTP Request.

Monday, May 11, 2009

ruby on rails can't convert Symbol into String date_select, i18n

config/locales/es-ar.yml

"es-ar":
hello: "Hola mundo"

date:
formats:
default: ""
long: ""
short: ""
order: [ :day, :month, :year ]
...

Friday, May 8, 2009

ruby on rails, ActiveResource::Base, paginate, WillPaginate, RESTful xml resource and paginate

This sample assume that you have a service in the server that respond .xml


class NoteIntranet < ActiveResource::Base
self.site = INTRANET_CREDENTIALS[:site]
self.element_name = 'note'
cattr_reader :per_page
@@per_page = 20
def self.paginate(*args)
options = args.pop
@@per_page = options.delete(:per_page) || @@per_page
WillPaginate::Collection.create((options.delete(:page) || 1), @@per_page) do |pager|
all_elements = self.find(:all, options)
result = all_elements[pager.offset, pager.per_page].to_a
# inject the result array into the paginated collection:
pager.replace(result)
unless pager.total_entries
# the pager didn't manage to guess the total count, do it manually
pager.total_entries = all_elements.size
end
end
end

end


In the controller you may have conditions that are defined in the service, an example is a filter:


@notes = NoteIntranet.paginate(:page => params[:page], :params => { :title => params[:title] })


In the server service, in the controller you have:


@notes = Note.paginate(:page => params[:page], :conditions => ["title like '%?%'",params[:title]] )


This idea came from Gasper - Luis Guardiola