sum("CAST(total AS float)")
average("CAST(total AS float)")total dataType is String.
| require 'roo' | |
| require 'axlsx' | |
| require 'fileutils' | |
| class XlsScript | |
| attr_accessor :file_path | |
| def initialize(file_path) | |
| @file_path = file_path |
| /*Geo map for COLOMBIA WITH COORDS https://developers.google.com/chart/interactive/docs/gallery/geomap*/ | |
| function drawVisualization() { | |
| var dataTable = new google.visualization.DataTable(); | |
| dataTable.addRows(3); | |
| dataTable.addColumn('number', 'LATITUDE', 'Latitude'); | |
| dataTable.addColumn('number', 'LONGITUDE', 'Longitude'); | |
| dataTable.addColumn('number', 'Votantes', 'Value'); // Won't use this column, but still must define it. |
| select.form-control + .chosen-container{ | |
| display: block; | |
| width: 100% !important; | |
| } | |
| select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
| display: block; | |
| width: 100%; | |
| height: 34px; | |
| padding: 6px 12px; |
| { | |
| "check_for_rvm": true, | |
| "run_rspec_command": "bundle exec /Users/esbanarango/.rbenv/shims/rspec {relative_path} -f d" | |
| } |
<input> with attribute required
This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.
How to show a spinner only when the required validations pass? (Without using any validation plugin, only the required attribute).
Form with a required input
= form_for @person, remote: true do |f|
= f.text_field, :first_name, required: trueThis a solution for a problem that I recently faced.
Let's say we have these three classes Store, PaymentMethod and StorePaymentMethodSetting. A store may have multiple payment methods and these payment methods are similar between the stores. So here we have a HABTM (has and belongs to many) relationship between the Store and the Payment Method. I didn't use HABTM relationship, instead, I used has_many :through relationship, that's because I needed to use the relationship model (StorePaymentMethodSetting) as an independent entity to set the availability of a payment method in a store. Although I would always recommend using has_many :through instead of has_and_belongs_to_many, you never know if in the future you'll need the relationship model to have some attributes.
So here comes the problem, I wanted to update the availability of a payment method through the payment method itself. I mean, I didn't wanted to have
#BDNG
Biblioteca Digital de Nueva Generación
###Búsquedas
La aplicación de búsquedas de BDNG está compuesta por dos partes, aplicación Front-end (JavaScript) y Back-end (xQuery). Se recomienda tener conocimiento previo de xQuery para poder entender mejor la estructura y funcionamiento del Back-end.
Aquí algunos links que pueden ser de gran utilidad.
| CREATE FUNCTION `lat_lng_distance` (lat1 FLOAT, lng1 FLOAT, lat2 FLOAT, lng2 FLOAT) | |
| RETURNS FLOAT | |
| DETERMINISTIC | |
| BEGIN | |
| RETURN 6371 * 2 * ASIN(SQRT( | |
| POWER(SIN((lat1 - abs(lat2)) * pi()/180 / 2), | |
| 2) + COS(lat1 * pi()/180 ) * COS(abs(lat2) * | |
| pi()/180) * POWER(SIN((lng1 - lng2) * | |
| pi()/180 / 2), 2) )); | |
| END |