Publicidad

loading...

viernes, 14 de agosto de 2015

Timeout Access

crear un formInactiveShotDown


Option Compare Database
Option Explicit
'  frmInactiveShutDown v2.3 for MS Access from Peter's Software
'    v3.0 Access 2010 64-bit compatibility
'    v2.3 includes a "On Error GoTo 0" at the bottom of the timer routine
'
'  Copyright: Peter's Software 2001-2010 :: http://www.peterssoftware.com
'
'  Description:
'    A form that monitors user activity and automatically shuts down the application after
'    a specified period of inactivity.
'
'  This module was created by:
'
'    Peter's Software
'    info@peterssoftware.com
'    http://www.peterssoftware.com
'
'  Special thanks to
'    Stefano Sarasso
'
'  This form and associated code are distributed as freeware
'
'  Usage
'
'    Import the form frmInactiveShutDown into your application and open it hidden at application startup.
'
'    Set the inactivity period by adjusting values in the form OnOpen event procedure.
'
'    Optionally include the basISDOptionalModule to take advantage of a global variable that is set
'    to True when an Inactive Timeout occurs.
'


'* Set this constant to True if you want the ISD form to pop up in front of other
'* application windows when an Inactive Timeout occurs.
Const conPopUpISDFormForeground = True

Const conSeconndsPerMinute = 60
Dim sngStartTime As Single
Dim ctlSave As Control
Dim intMinutesUntilShutDown As Integer
Dim intMinutesWarningAppears As Integer
Private Const SW_RESTORE = 9
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const SWP_SHOWWINDOW = &H40
Private Const HWND_TOP = 0
Private Const HWND_TOPMOST = -1

'v3.0 - Access 2010 64-bit compatibility
#If VBA7 Then
    Private Declare PtrSafe Function SetForegroundWindow& Lib "user32" (ByVal hwnd As LongPtr)
    Private Declare PtrSafe Function IsIconic Lib "user32" (ByVal hwnd As LongPtr) As Long
    Private Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As LongPtr, ByVal nCmdShow As Long) As Long
    Private Declare PtrSafe Function SetWindowPos Lib "user32" (ByVal hwnd As LongPtr, ByVal hWndInsertAfter As LongPtr, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
#Else
    Private Declare Function SetForegroundWindow& Lib "user32" (ByVal hwnd As Long)
    Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
#End If
Private Function xg_CallIfPresent(pstrFunctionNameAndParms As String) As Integer
'* Call a function using the Eval function.
'* This method allows us to call a function whether it exists or not.
'*
'* Returns
'*   1 - Function found, executed, and returns True
'*   2 - Function found, executed, and returns False
'*   3 - Function not found
'*   99 - Other error

Dim intRtn As Integer

On Error Resume Next
If Eval(pstrFunctionNameAndParms) Then
    If err <> 0 Then
        Select Case err
        Case 2425, 2426
            intRtn = 3     '* The function is not found
        Case Else
            MsgBox "Error in xg_CallIfPresent when calling '" & pstrFunctionNameAndParms & "': " & err.Number & " - " & err.Description
            intRtn = 99     '* Other error
        End Select
        err.Clear
    Else
        intRtn = 1  '* Function evaluates to True
    End If
Else
    intRtn = 2  '* Function evaluates to False
End If

Exit_Section:
    On Error Resume Next
    xg_CallIfPresent = intRtn
    On Error GoTo 0
    Exit Function
Err_Section:
    Beep
    MsgBox "Error in xg_CallIfPresent: " & err.Number & " - " & err.Description
    err.Clear
    Resume Exit_Section

End Function



Private Sub Form_Close()
On Error Resume Next
ctlSave = Nothing
err.Clear
On Error GoTo 0
End Sub

Private Sub Form_Open(Cancel As Integer)

'* Set this variable to the number of minutes of inactivity
'* allowed before the application automatically shuts down.
intMinutesUntilShutDown = 2
'intMinutesUntilShutDown = 120

'* Set this variable to the number of minutes that the
'* warning form will appear before the application
'* automatically shuts down.
intMinutesWarningAppears = 1
'intMinutesWarningAppears = 2

Me.Visible = False
sngStartTime = Timer
End Sub

Private Sub Form_Timer()
'**********************************************************************
'* This timer event procedure will shut down the application
'* after a specified number of minutes of inactivity. Inactivity
'* is measured based on how long a control remains the ActiveControl.
'**********************************************************************
Dim sngElapsedTime As Single
Dim ctlNew As Control
Dim i As Integer
Dim FN(20) As String
On Error Resume Next

'If Time() > #5:00:00 PM# Then  '* Uncomment this to have ISD start at a particular time of day
Set ctlNew = Screen.ActiveControl
If err <> 0 Then
    '* No activecontrol
    'pddxxx need to use datediff("s" ... here because timer resets at midnight
    ' find difference in seconds
    sngElapsedTime = Timer - sngStartTime
    err.Clear
Else
    If ctlNew.Name = "InactiveShutDownCancel" Then
        '* The warning form has appeared, and the cancel button
        '* is the active control
        sngElapsedTime = Timer - sngStartTime
    Else
        If ctlNew.Name = ctlSave.Name Then
            '* Still at same control
            sngElapsedTime = Timer - sngStartTime
        Else
            '* Some change has occured, we're at a new control
            Set ctlSave = ctlNew
            sngStartTime = Timer
        End If
        If err <> 0 Then
            Set ctlSave = Screen.ActiveControl
        End If
    End If
End If
err.Clear
'Else
'    sngElapsedTime = 0
'End If

Set ctlNew = Nothing

Select Case sngElapsedTime

Case Is > ((intMinutesUntilShutDown - intMinutesWarningAppears) * conSeconndsPerMinute)
    '* Make the warning form visible if it is not already visible.
    If Me.Visible Then
    Else
        Me.Visible = True
       
        If conPopUpISDFormForeground Then
            '* Un-minimize Access application if it is minimized
            If IsIconic(Application.hWndAccessApp) Then
                ShowWindow Application.hWndAccessApp, SW_RESTORE
            End If
            '* Make it the foreground window - open it in front of other application windows.
            SetForegroundWindow (Me.hwnd)
        End If
       
        '* Open it on top of other modal windows.
        SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW
    End If
Case Else
    '* The next line can be commented out if the form is opened hidden
    'Me.Visible = False
End Select

Exit_Section:
    On Error Resume Next
    On Error GoTo 0
End Sub


Private Sub InactiveShutDownCancel_Click()
sngStartTime = Timer
Me.Visible = False
End Sub





-------------------------------------------------------------------------------------
crear un modulo llamado  basISDOptionalModule




Option Compare Database
Option Explicit
'* This module can be used with the Inactive Shut Down Form. It is optional. Excluding this
'* module will not cause a compile error.
'*
'* The purpose of this module is to allow for all forms in the database to close when an Inactive
'* Timeout occurs. If a form has some prompt for user input in the form BeforeUpdate or Close event procedure
'* then the Inactive Shut Down Form will not be able to shut down the application. By checking the
'* value of the variable below in this situation, code that prompts for user input can be bypassed
'* and the form can be automatically closed. The variable is set to True when an Inactive Timeout
'* occurs.
'*
'* Ex.:
'*
'* Private Sub Form_Close()
'* If gintInactiveTimeout then
'*     '* Skip the prompt for user input and close the form
'* Else
'*     '* Prompt the user for some information
'*     If MsgBox("Some prompt for user input", acYesNo) = acYes Then
'*         '* Some code might run here
'*     Else
'*         '* Some other code might run here
'*     End If
'* End If
'* End Sub

'* This is the global variable used by the Inactive Shut Down Form:

Public gintInactiveTimeout As Integer



Function isd_SetInactiveTimeoutVar(blnTrueOrFalse As Boolean) As Integer
'* This routine is used to set the value of the global Inactive Timeout variable
If blnTrueOrFalse = True Then
    gintInactiveTimeout = True
Else
    gintInactiveTimeout = False
End If
End Function

sábado, 20 de diciembre de 2014

Change User Password 'postgres' in Ubuntu

Change User Password 'postgres' in Ubuntu

  
Whenever we install postgresql in Ubuntu is assigned a random user 'postgres' password and this must be changed manually post-installation. This is not a bug in the installer, it is a default security behavior installer. Cambiano password To change the password in a default installation or because they simply forgot the password and there are no more users the following is done in a terminal: 1) impersonating the user 'postgres'. $ Sudo su postgres 2) Run the utility $ psql psql currently are connecting to the database using the user 'postgres' with this user can change passwords of many users even the same 'postgres'. Now let's change the password, run on the command line present the following sequence where 'passwd' is the new password (single quotes must be used): alter user postgres with password 'passwd'; If the response program with the message 'ALTER ROLE' the password has been changed successfully. To exit the utility can type: \ q to exit the user 'postgres' type the following: exit Done. The password has been changed successfully. Testing the Connection To test the connection you can use the same utility 'psql' as follows: psql -U postgres -W Press ENTER and enter the new password (once You should have changed it in the example above, if you did not password it is 'passwd').

jueves, 14 de noviembre de 2013

modelado de datos SQL Power Architect PostgreSQL MySql Oracle, MS SQL Server

SQL Power Architect  PostgreSQL MySql  Oracle, MS SQL Server y muchas más

sql_power_arqui

  El SQL Power Architect herramienta de modelado de datos que fue creada por los diseñadores de almacenamiento de datos y tiene muchas

características únicas dirigidas específicamente para el arquitecto de almacenamiento de datos. Permite a los usuarios de la herramienta ingeniería inversa de bases de datos existentes, realizar perfiles de datos en bases de datos de origen y generar automáticamente los metadatos de ETL.

Algunas Características de SQL Power Architect.
* Permite acceder a las bases de datos a través de JDBC.
* Puedes conectarte a múltiples bases de datos al mismo tiempo.
* Compara modelos de datos y estructuras de bases de datos e identifica las discrepancias.
* Drag-and-drop de las tablas origen y las columnas en el área de trabajo.
* Ingeniería directa/inversa para PostgreSQL, Oracle, MS SQL Server y muchas más.
* Todos los proyectos se guardan en formato XML.
* OLAP modelos de esquema: cubos, medidas, dimensiones, jerarquías y niveles.

SQL Power Architec edición Community es gratuita bajo licencia Open Source GPL v.3.
SQL Power Architec es una herramienta ideal para grupos de desarrollo donde se pude realizar el modelado de datos y poder así tener documentado el modelo de datos de todas la s aplicaciones que se desarrollan.

Arquitectos de datos, DBA's, analistas y diseñadores cuentan con herramientas de modelado de datos para facilitar y simplificar sus esfuerzos de modelado de datos, maximizando el uso de sus recursos. SQL Power Architect permite que estos recursos altamente técnicos realicen esta parte más compleja de su trabajo en una fracción de tiempo.

Además, SQL Power Architect tiene la capacidad de tomar snapshots de las estructuras de base de datos, permitiendo a los usuarios desarrollar modelos de datos DW mientras trabaja sin conexión.

Si usted está construyendo un almacén de datos o usando modelos de datos para comunicar las reglas de negocio, SQL Power Architect le facilita y automatiza sus esfuerzos en el modelado de datos.



Lo puedes descargar en:  
http://www.sqlpower.ca/page/architect_download_os 

crear pestañas o tabs html javascript

Crear pestañas o tabs html js


primeramente  debemos crear una carpeta donde guardaremos nuestro proyecto luego guardar dentro de esta nuestros archivos css, js y html :

el contenido de los archivos jquery.css, jquery.js, jqueryui.js, lo puedes encontrar en la siguiente direccion:


copia el contenido de dichos enlaces y guardalos en la carpeta en con el nombre endicado antes del signo  igual de arriba (=) ahora lo hacemos ver con nuestro codigo html, el cual es basico asi que lo puedes modificar si deseas:

 HTML:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>
 <link rel="stylesheet" href="jquery.css" />

    <script src="jquery.js"></script>

   <script src="jqueryui.js"></script>

  <script>
  $(function() {
    $( "#tabs" ).tabs();
  });
 </script>
<body>

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">pestaña 1</a></li>
    <li><a href="#tabs-2">Pestaña 2</a></li>
    <li><a href="#tabs-3"> Pestaña 3</a></li>
    <li><a href="#tabs-4"> Pestaña 4</a></li>
  </ul>
  <div id="tabs-1">
   <select><option value= 1>1</option>
   <option value=2>2</option></select>
  </div>
  <div id="tabs-2">
    <p>..example 2</p>
  </div>
  <div id="tabs-3">
 
   modifica
 
  </div>
  <div id="tabs-4">
  .......Ejemplooooo</div>
</div>

</body>

</html>

sábado, 19 de octubre de 2013

Tablas con estilo cebra CSS RESOLVED

Efecto de cebra a tabla html sencillo
Como lograr el codiciado efecto de cebra en una tabla de html pues es muy simple solo debes aplicarle una hoja de estilo en cascada CSS y listo 
Veamos el código html primero:
<html>
<head>
 <link rel="stylesheet" href=" https://copy.com/cupE2GfCrFvb" />
<title>Efecto de zebra</title>
</head>
<body>
    <table id="miTabla">  
           <tr> <td>Columna 1</td>       
                <td>Columna 2</td>   
           </tr> 
           <tr> <td>Fila 1 columna 1</td> 
                <td>Fila 2 columna 2</td>
                  
           </tr>
           <tr> <td>Fila 3 columna1</td>
                <td>Fila 4 columna 2</td>
          </tr>    
          <tr>  <td>Fila 5 columna 1</td>
                <td>Fila 6 columna 2</td> 
          </tr>
          <tr>  <td>Fila 7 columna 1</td>  
                <td>Fila 8 columna 2</td>
         </tr>
    </table>
</body>
</html>

 Y nuestro css para crear el efecto de cebra, usaremos el id de nuestra tabla el cual es #miTabla (se usa el “#” debido  haremos referencia al id si tuviéramos que hacer referencia a alguna class seria “.”), veamos como creamos el efecto de cebra:

tr:nth-child(odd)   (es para las filas impares)
tr:nth-child(even)  (es para las filas pares):

//1.CSS-------------------------------------------à
@charset "utf-8";
/* CSS Document */
#miTabla tr:nth-child(odd) {
   background-color: #999;
   color:;
 }
#miTabla tr:nth-child(even) {
   background-color: #CCC;
   color:#FFF;
}

Demo (Descargar)

viernes, 18 de octubre de 2013

Whoops, looks like something went wrong [SOLVED]. [RESUELTO]

"Whoops, looks like something went wrong " mensaje mostrado al borrar la cache de symfony2, solucionar esto es sencillo, tan solo hay que aplicar las siguientes lineas desde la terminal del SO:

php app/console cache:clear (ENTER)

luego 
rm -fr app/cache/*  (ENTER)
finalmente escribimos:
rm  -fr app/logs/* (ENTER)
 espero les sirva....

Obtension del usuario logeado automático en Symfony2

obtener el usuario  logueado en el sistema para guardarlo automáticamente en tu entidad se puede hacer lo siguiente:  desde el controller que desea  capturar el usuario esta la acción:

 public function createAction(Request $request)
    {
        $entity  = new SignosVitalesSuministrados();
        $request=$this->getRequest();
    //-- ---------------------------------------obtencion del usuario logeado
        $username = $this->get('security.context')->getToken()->getUser();
        $usuario = $username->getUsername();
        $entity->setUsuario($username);
   //-- .------------------------------------------------------------------hasta aqui 
        $form = $this->createForm(new EjemploType(), $entity);
        $form->bindRequest($request);
        if ($form->isValid()) {
            $entity->setFecha(new \DateTime("now"));  
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();
            return $this->redirect($this->generateUrl('ejemplo_show', array('id' => $entity->getId())));
        }
        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

Fecha automática Symfony2


primero debemos tener el campo Feecha en la entidad que se desea guardar el dato, lo define type datatime,
Ahora  asegúrarse  que en el form y view  este invisible el input del campo fecha, ir al controller de la entidad  en la acción createAction quedara de la siguiente manera:
 public function createAction(Request $request)    {
        $entity  = new Example();
        $request=$this->getRequest();
        $form = $this->createForm(new ExampleType(), $entity);
        $form->bindRequest($request);
        if ($form->isValid()) {
            $entity->setFecha(new \DateTime("now"));
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();
            return $this->redirect($this->generateUrl('example_show', array('id' => $entity->getId())));
        }
        return array(
            'entity' => $entity,
            'form'   => $form->createView(),

 );
    }

ahora si el sistema ingresara a la DB la fecha actual automatica, solo hay que tener en cuenta que debemos configurar entidad, fomr y views


miércoles, 16 de octubre de 2013

La Ingenieria Inversa Symfony2

La ingeniería inversa es la forma cómoda y rápida de  ingresar a la base de datos del proyecto en Symfony2:

1.-                                                php app/console generate:bundle 

2.- Luego hay que tener la base de datos normalizada.

3.-  Configurar parámetros de conexión de  database en el archivo parameters.ini alojado enRoot_Symfony_directory_project/app/config/parameters.ini o  se puede buscar en la URL: http://localhost/Symfony/web/app_dev.php/_configurator/step/0 


4.-  Mapear la data base:

     php app/console doctrine:mapping:convert xml ./src/Ejemplo/EjemploBundle/Resources/config/doctrine/metadata/orm --from-database --force 

5.- Importar el mapeo que  acaba de hacerse :

php app/console doctrine:mapping:import EjemploBundle annotation 

6.-Generar las entidades de la base de datos (recuerdar que hay que  volver a cambiar Ejemplo por el nombre del  Bundle)

php app/console doctrine:generate:entities EjemploBundle 

7.- Generar el crud,  se genera tantos como se necesiten :


php app/console doctrine:generate:crud

lunes, 7 de octubre de 2013

[RESOLVED] Call to undefined function pg_query(), Wamp Server PostgreSQL

[RESOLVED] Call to undefined function pg_query(), Wamp Server PostgreSQL
al instalar nuestro querido servidor de Prueba localhost, y tratar de empezar a conectar nuesto PHP con el gran Gestor de DB PostgrSQL, notamos un error muy comun que seria Call to undefined function pg_query() el cual se soluciona  haciendo lo siguiente:
1..- activamos las extensiones de nuestro php.ini que trae el WampServer, y las extensiones que debemos habilitar son:  php_pgsql.dll ,php_pdo_pgsql.dll   estas extensiones se habilitan quitandole el punto y coma (;) que tiene delante del nombre (Ejemplo: ;php_pdo_pgsql.dll quitamos el ; que hay delante y queda asi:   php_pdo_pgsql.dll), guardamos los cambios en el php.ini.
2.- vamos a la siguente ruta:
      C:\wamp\bin\php\php5.4.3
Ubicamos la libreria llamada:  libpq.dll  la Copiamos (Ctrl+c), nos dirijimos a la siguiente ruta:
     C:\wamp\bin\apache\apache2.2.22\bin 
y pegamos el archivo que acabamos de copiar (Ctrl +v).

Luego de seguir estos pasos reinicia el WampServer, y estara listo para usar  PHP+PostgreSQL.

espero les sirva.....

tabla dinamica jquery clonar y remover ( clone() remove()

PivotTable jquery clone () remove () ..
Then leave one example of a table where you add and delete rows dynamically, with the help of jquery:



     
jquery.js = http: //code.jquery.com/jquery-1.9.1.js
    
jqueryui.js = http://code.jquery.com/ui/1.10.2/jquery-ui.js

copies the contents of such links and save them in the folder with the same name endicado before above (=) sign now we see with our html code or can download the complete example from: https://copy.com/iKMBz8EoHUNU ):
at the end of this entry is the functional demo of the table ...

html
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = utf-8" />
<Title> Untitled Document </ title>
</ Head>

<Body>
</ Body>
</ Html>
<Html>
<Head>

   
<Script src = "jquery.js"> </ script>

 
<Script src = "jqueryui.js"> </ script>

      
<Script>
$ (Function () {

    
$ ( "#tabs") .tabs ();

  
});

  
$ (Function () {

 
// Clone the hidden row that has the base camps, and added to the end of the table

 
$ ( "# Add"). On ( 'click', function () {

  
$ ( "# Tbody table tr: eq ()") clone () append ( '<td class = "delete"> <input class = "a" type = "button" value = "-" /> </.. td> ') appendTo ( "# table.");

  

 
});

  
// Event to select the row and deletes

 
$ (Document) .on ( "click". "Delete" function () {

  
var parent = $ (this) .parent ();

  
$ (Parent) .remove ();

 
});
});

 
</ Script>


            
<H1> Example </ h1>
<Table border = "1" id = "table">

 
<- Header table ->

 
<Thead>

  
<Tr>

   
<Th> Value </ th>

   
<Th> Name </ th>

   
<Th> </ th>

   
<Th> & nbsp; </ th>

  
</ Tr>

 
</ Thead>

<! - Body of the table with fields ->

 
<Tbody>

 
<! - Row basis to clone and added to the end ->

  
<Tr id = "row-based">

   
<Td> <input id = "value" name = "value []" type = "text" /> </ td>

   
<Td> <select id = "" name = "name []">

     
<Option value = "" disabled = "disabled" selected = "selected"> Select ... </ option>

     
<Option value = "FR"> FR </ option>

     
<Option value = "FR"> FC </ option>

                                       
<Option value = "PA"> PA </ option>

                                       
<Option value = "Glisemia"> Glisemia </ option>

                           
</ Select>

   
</ Td>

  
</ Tr>
<- Order code: Base Row ->

  
</ Tbody>
</ Table>
<! - Button to add rows ->
<Input type = "button" class = "a" id = "add" value = "+" />

     
</ Body>
</ Html>

Demo Funcional:  (Descargar Demo))

Valor Nombre