Skip to content

Instantly share code, notes, and snippets.

@phpleo
phpleo / php en Ubuntu (instalacion)
Created December 6, 2010 02:42
Instalando SQL-Lite
$ sudo aptitude install php5-sqlite
@phpleo
phpleo / FilterCode.cs
Created December 16, 2010 20:16
Extrayendo el texto de un PDF con IFilter, se usa "Adobe PDF IFilter v6.0" con un proyecto en ASP MVC 2
///
/// Sample library for using IFilter to read text from any registered filter type.
///
/// Helpful links:
/// http://msdn.microsoft.com/en-us/library/ms691105(VS.85).aspx
/// http://ifilter.codeplex.com/
/// http://www.pinvoke.net/default.aspx/query/LoadIFilter.html
///
/// Code here is taken from a combination of the project located at http://ifilter.codeplex.com/
/// as well as definitions taken from p-invoke.net. License is MS-PL so enjoy.
@phpleo
phpleo / 1
Created December 19, 2010 01:52
Instalacion de apache2 en Ubuntu 10.10. Primero se instaló php y luego apache.
$ sudo aptitude install php5 php5-cli php-pear php5-gd php5-xsl php5-curl php5-mysql libapache2-mod-php5
[sudo] password for ...:
Se instalarán los siguiente paquetes NUEVOS:
apache2-mpm-prefork{ab} libapache2-mod-php5 php5
0 paquetes actualizados, 3 nuevos instalados, 0 para eliminar y 46 sin actualizar.
Necesito descargar 2947kB de archivos. Después de desempaquetar se usarán 8020kB.
No se satisfacen las dependencias de los siguientes paquetes:
apache2-mpm-prefork: Entra en conflicto: apache2-mpm que es un paquete virtual.
@phpleo
phpleo / 1
Created December 26, 2010 17:45
Instalando xdebug en ubuntu via aptitude para PHP5
// instalación
$ sudo aptitude search php5-xdebug
@phpleo
phpleo / gist:766472
Created January 5, 2011 15:42
Insertar un registro si no existe
-- http://stackoverflow.com/questions/639854/tsql-check-if-a-row-exists-otherwise-insert
IF NOT EXISTS (SELECT * FROM Bookings WHERE FLightID = @Id)
BEGIN
--UPDATE HERE
END
ELSE
BEGIN
-- INSERT HERE
END
@phpleo
phpleo / 1.sql
Created January 10, 2011 16:57
tsql: actualizar registro con condicional (UPDATE CASE WHEN)
UPDATE Proyecto.Proyecto
SET Estado = CASE WHEN EnEjecucion = '1' THEN 'e' ELSE NULL END
@phpleo
phpleo / 1.sql
Created January 10, 2011 16:58
tsql: Creando una tabla temporal y llenandola con registros de una tabla existente
-- Crear tabla temporal con los valores actuales del campo EnEjecucion
-- eliminando si existe
IF OBJECT_ID( N'tempdb..#ProyectoEnejecucionEstado') IS NOT NULL
DROP TABLE #ProyectoEnejecucionEstado;
GO
-- creando la tabla temporal
CREATE TABLE #ProyectoEnejecucionEstado (
CodigoProyecto CHAR(6),
@phpleo
phpleo / 1.js
Created January 11, 2011 16:21
Para que MeioMask acepte () espacio y - sin quitarlos del campo de texto
// http://www.meiocodigo.com/projects/meiomask/
// alterando la configuracion de meio mask para
// usar () espacio y - en las cajas de texto
$.mask.options = {
attr: 'alt', // an attr to look for the mask name or the mask itself
mask: null, // the mask to be used on the input
type: 'fixed', // the mask of this mask
maxLength: -1, // the maxLength of the mask
defaultValue: '', // the default value for this input
@phpleo
phpleo / gist:1010313
Created June 6, 2011 14:02
Recorer checkbox en gridview
// http://www.codeproject.com/KB/webforms/SelChkboxesDataGridView.aspx
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow row = GridView1.Rows[i];
bool isChecked = ((CheckBox) row.FindControl("chkSelect")).Checked;
if (isChecked)
{
// Column 2 is the name column
@phpleo
phpleo / gist:1053272
Created June 29, 2011 06:33
Instalar JDownloader Ubuntu 11.04
sudo add-apt-repository ppa:jd-team/jdownloader
sudo apt-get update && sudo apt-get install jdownloader