jueves, 6 de agosto de 2009

PostgreSQL Database Cluster Initialisation Failed Solution

PostgreSQL Database Cluster Initialisation Failed Solution

The problem is that Vista has some safety features associated with setting permissions on the Program Files folder. Basically, even if you are an admin, you can’t change permissions on some folders like Program Files and Windows folder itself. This causes initdb to be unable to create some folders and the database cluster. What this means for you is that you need to install PostgreSQL in another folder that is not inside Program Files.

By the way, if you have forgotten your Postgres account password while installing the first time, just open a Command Prompt in Vista (If you don’t know how, Google for it). Then type the command “net user”. You will see a list of users on your computer. Find Postgre’s account. It’s usually “postgres“. Then you need to change its password by typing “net user postgres new_password” where new_password is… well, a new password for the account. You will be needing that postgres account during install. You will need admin privileges to do this change however.

Firstly, uninstall any failed installations. Use the Control Panel or the PostgreSQL installer in the install folder.

During the install, you will be prompted to choose where you want to install the program. Just select a location in another place. Like “C:\PostgreSQL” or something similar. It may even be on your desktop. But not inside Program Files. Not inside Windows folder. However, it’s not as easy. Bear with me.

After the install, you will still see that darned error message (or something like non-fatal error occured). Do not despair! (For Windows Power Users, we are just assigning Full Control permission to Postgres account on the new PostgreSQL install folder). For other users, read on if you don’t know how to do it.

Go to where you just installed PostgreSQL. In this case, the C: drive. There, right-click on the folder (usually called PostgreSQL), and go to Properties – Security tab. Click on the Edit button. You will now see some usernames and other stuff. Click on the Add button. In the “Enter the object names to select” box, enter “postgres” and press Check. Postgres’ user account should appear there. Click on Ok.

Now from the “Group or Usernames” box, select the Postgres account. In the window below, with lots of checkboxes, assign permission “Full Control” in the Allow Column to it. Note, if you don’t want to allow full control, just give it read/write. But I just went ahead and gave it Full Control. (I was tired and annoyed. The “World’s most advanced open source database” had failed to install!). Click on Ok and wait a bit for permissions to be applied.

Then, just do a re-install. Do not uninstall anything. Just run the setup again. It’ll say that a PostgreSQL install folder already exists and other stuff. Just click on Next until the install finishes. If you see “file cannot be copied” errors, click on the “ignore” button when needed.

jueves, 9 de octubre de 2008

Piwik # Open source web analytics

piwik is an open source (GPL license) web analytics software. It gives interesting reports on your website visitors, your popular pages, the search engines keywords they used, the language they speak… and so much more.

piwik aims to be an open source alternative to Google Analytics.

piwik is different from the competition because:

  1. the features are built inside plugins: you can add new features and remove the ones you don’t need. If you are a developer, you can easily build your own plugins!
  2. you own your data. Piwik being installed on your server, the data is stored in your own database and you can get all the statistics using open APIs (publishing the data in many formats: xml, json, php, csv)
  3. (NOW AVAILABLE!!!) the user interface is fully customizable, you can drag and drop the widgets you want to display, create the reports you want

miércoles, 27 de agosto de 2008

Trabajando con punto flotante

MATERIA : Arquitectura de Computadores
NOMBRE : Jose David Romero de la Cruz
CODIGO : 94.514.156
TEMA : Números en punto flotante
CONTENIDO : Punto Flotante


Representación de los números en punto flotante
El punto flotante se utiliza para representar números no enteros, números muy grandes o números muy pequeños.
Un número en punto flotante se expresa como:
m x re
donde,
(m) es la mantisa y es un número de punto fijo
(e) es el exponente o característica y es un entero de punto fijo
(r) es la base. En los computadores personales se usa base 2.
La mantisa representa la magnitud del número. El exponente es la parte que representa el número de lugares a desplazar el punto decimal o binario.
Sí tenemos un número de punto fijo de la forma:
± (an-1 .... a0 . a-1 ….a-m)r
en forma de punto flotante será de la forma:
± ( . an-1 ....a-m)r x rn , la base generalmente se omite.
Con frecuencia la mantisa m se escribe con magnitud y signo de la siguiente forma, y en forma de fracción
M = (sm . an-1 … a-m)
donde, sm indica el signo (1 para una cantidad negativa y 0 para una cantidad positiva) y . an-1 … a-m representa la magnitud.
Un número de punto flotante está normalizado si el exponente se ajusta de modo que la mantisa tenga un valor distinto de cero en la posición más significativa.
Ejemplo:
El número +1010.0111 en representación normalizada en punto flotante da como resultado: (0.10100111) x 24
El estándar ANSI/IEEE 754-1985 define tres formatos para los números de punto flotante: Precisión sencilla: Utiliza 32 bits. Doble precisión: Utiliza 64 bits Precisión ampliada: Utiliza 80 bits.
Ejemplo
Un formato a 32 bits es el siguiente,
El exponente desplazado se obtiene adicionando 127 al exponente real y convirtiéndolo al binario correspondiente.
Pasos para convertir un punto flotante a binario
1. Convierta la parte entera a binario.
2. Convierta la parte la fracción a binario.
3. Ponga un punto decimal entre las dos partes.
Representar el numero 103.86 en binario

0.86 -> 1.72 -> 1.44 -> 0.88 -> 1.76 –> 1.52 -> 1.04

1.103 = 1 1 0 0 1 1 1
0.86 = 1 1 0 1 1 1

103.86 = 1 1 0 0 1 1 1, 1 1 0 1 1 1