Skip to content

Instantly share code, notes, and snippets.

@miguelcperez
miguelcperez / Week6
Last active July 9, 2018 15:04
Mongo for Developers - Homework week 6
Homework 6.1
- Which of the following statements are true about replication in MongoDB? Check all that apply.
* The minimun sensible number of voting nodes to a replica set is three. True
* MongoDB replication is synchronous. False
* By default, using the new MongoClient connection class, w = 1, j = 1. False
* The oplog utilizes a capped collection. True
- Enter into the folder sites-available.
* cd /etc/apache2/sites-available
- Add this text and create your site conf file.
* sudo nano site.dev.conf
<VirtualHost *:80>
ServerName site.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/project_name/public
* sudo apt-get remove package_name
* sudo apt-get purge package_name
* sudo apt-get clean package_name
Check the file/directory permissions
$ tail -f /var/log/apache2/access.log /var/log/apache2/error.log
@miguelcperez
miguelcperez / animateSVG.html
Created March 3, 2017 21:49
SVG Animation Elements
<!--/********** Animation Element **********/-->
<!-- 1. animate -->
<svg width="120" height="120" viewPort="0 0 120 120" version="1.1">
<rect x="10" y="10" width="100" height="100">
<animate attributeType="XML" attributeName="x" from="-100" to="120" dur="10s" repeatCount="indefinite"/>
</rect>
</svg>
<!--
<VirtualHost *:80>
ServerName blog.app
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/blog/public
<Directory /var/www/html/blog/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
@miguelcperez
miguelcperez / AgeCalculator.txt
Last active July 3, 2017 04:25
Oracle Age Calculator Function
TRUNC((trunc(sysdate-fechanacimiento) )/365.25),0)
trunc(trunc(trunc(sysdate-fechanacimiento) - (365.25 * TRUNC(trunc(sysdate-fechanacimiento) )/365.25,0)))/ 30.4375)
@miguelcperez
miguelcperez / EnviarCorreo.cs
Last active February 14, 2024 13:26
Envío de correo electrónico ejecutado en segundo plano - C# .Net
using (StreamReader reader = new StreamReader(Server.MapPath("~/Views/Shared/Correo.html")))
{
body = reader.ReadToEnd();
}
body = body.Replace("{usuario}", usuario); // reemplazar valores en el correo (Correo.html)
var message = new MailMessage();
message.To.Add(new MailAddress("contacto@mail.com"));// correo destino // message.To -> destinatarios visibles entre ellos | message.Bcc -> destinatarios no visibles entre ellos
message.From = new MailAddress("admin@mail.com", "Administrador de Sistemas"); // Remitente del mensaje
@miguelcperez
miguelcperez / post_tag.sql
Last active March 19, 2018 20:47
Query Posts relacionados por TAG
SELECT c.post_id, c.post_c FROM (
SELECT b.post_id, COUNT(b.post_id) AS post_c FROM(
SELECT post_id, tag_id FROM post_tag
WHERE tag_id IN (SELECT tag_id FROM post_tag WHERE post_id = 1)) AS b
GROUP BY b.post_id
) AS c
WHERE c.post_c >= 2
@miguelcperez
miguelcperez / txt
Created April 19, 2019 02:36
double tab container logic
// Create FlavorTab by flavor and country (Bottler)
newFlavorTab = new sap.m.TabContainerItem('flavorTab_' + countryItemKey + '_' + flavor.FlavorCode, {
name: flavor.FlavorDescription,
modified: false,
content: [
new sap.m.Table('flavorTable_'+ countryItemKey + '_' + flavor.FlavorCode ,{
columns: [
new sap.m.Column({
header: new sap.m.Label({