Skip to content

Instantly share code, notes, and snippets.

View laminr's full-sized avatar

Thibault de Lambilly laminr

View GitHub Profile
@laminr
laminr / sqlServerStats.sql
Created October 10, 2013 07:01
Count the number of user, stock procedure, triggers, table, vue; clé primaire
-- Comptage du nombre de procédure stockée Utilisateur
select count(*) 'Procédures stockées' from sysobjects where OBJECTPROPERTY(id, N'IsProcedure')=1 and OBJECTPROPERTY(id, N'IsMSShipped')=0
go
-- Comptage du nombre de triggers sur des tables Utilisateur
select count(*) 'Triggers' from sysobjects where OBJECTPROPERTY(id, N'IsTrigger')=1 and OBJECTPROPERTY(parent_obj, N'IsMSShipped')=0
go
@laminr
laminr / phpSessionUsage
Created September 7, 2013 10:05
PHP Session usage
<?php
// On démarre la session
// (ceci est indispensable dans TOUTES les pages de notre section membre, mais une seul fois pas page -si on fait des includes....)
// TOUJOURS AU TOUT DEBUT DE LA PAGE
session_start ();
// pour une page de connection
$_SESSION['login'] = $_POST['login'];
$_SESSION['pwd'] = $_POST['pwd'];
?>
@laminr
laminr / DirfileListInFile
Created September 4, 2013 13:39
Lister les fichiers d'un répertoire dans un fichier
Lister les fichiers d'un répertoire dans un fichier:
Dos: dir > file.txt
@laminr
laminr / emailFactory
Created August 24, 2013 15:46
Sending email with Gmail in Java
/*
// Maven package
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
*/
package com.xxx.commons;
@laminr
laminr / SqlServerIfExists
Created June 19, 2013 15:36
Test d'existance d'une table, procedure, function, vue et colonne de table
IF EXISTS (
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'RTO_REFERENTIELS' AND TABLE_NAME = 'TR_MAPPING_TO_TSO_METHODE_RMOM'
)
DROP TABLE [RTO_REFERENTIELS].[TR_MAPPING_TO_TSO_METHODE_RMOM]
GO
-- VUE
IF EXISTS (SELECT TABLE_NAME, TABLE_SCHEMA FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA = 'UTI_REFERENTIELS' AND TABLE_NAME = 'VR_OUVRAGE_UTI_ASTEC')
@laminr
laminr / GregorianCalendarAdd
Created June 2, 2013 08:49
Addition sur date Java
// Initialisé à la date et l'heure courrante.
GregorianCalendar calendar = new java.util.GregorianCalendar();
// Initialisé avec une instance de Date.
calendar.setTime( maDate );
/* sur le champs "jour" (7 jours plus tôt) : */
calendar.add (Calendar.DATE, -7);
/* sur le champs "mois" (5 mois plus tard) : */
@laminr
laminr / DateToLocalString
Created June 2, 2013 08:45
Conversion Date en String selon le pays
/*
http://java.developpez.com/faq/java/?page=langage_chaine#LANGAGE_STRING_conversion_string
*/
// IMPORT
import java.util.Locale;
import java.text.DateFormat;
// 1. Choix de la langue
Locale locale = Locale.getDefault();
@laminr
laminr / jQuery DatePicker en Francais
Created May 30, 2013 19:08
Passage du jQuery datepicker en francais
/* French initialisation for the jQuery UI date picker plugin. */
/* Written by Keith Wood (kbwood{at}iinet.com.au),
Stéphane Nahmani (sholby@sholby.net),
Stéphane Raimbault <stephane.raimbault@gmail.com>
https://github.com/jquery/jquery-ui/tree/master/ui/i18n
*/
jQuery(function($){
$.datepicker.regional['fr'] = {
closeText: 'Fermer',
@laminr
laminr / CSS effet creusé
Created May 13, 2013 10:22
CSS effet creusé
<a class="emboss lightAgain" title="Lorem ipsum">Lorem ipsum</a>
<a class="emboss darkAgain" title="Lorem ipsum">Lorem ipsum</a>
.emboss {
font-size:4em; padding:50px; font-weight:bold; background:#0A539C; display:block; font-family: arial, sans-serif;
}
.lightAgain { color:#FFFFFF; position:relative; }
.lightAgain:before {
content: attr(title);
position:absolute;
@laminr
laminr / EntityManagerFactory Singleton
Created April 22, 2013 13:44
Singleton for EntityManagerFactory
// Getting the EntityManagerFactory from a singleton in the PersistenceManager class
public class PersistenceManager {
public static final boolean DEBUG = true;
private static final PersistenceManager singleton = new PersistenceManager();
protected EntityManagerFactory emf;
public static PersistenceManager getInstance() {