miércoles, 24 de octubre de 2012

Mostrar texto antes o después de un número en una celda mediante un formato de número en Excel

Suponga que desea crear una oración gramaticalmente correcta a partir de varias columnas de datos para un envío masivo de correo, o dar formato a una serie de números con texto sin afectar a las fórmulas que utilizan dichos números. Hay varias formas de combinar texto y números.


Si una columna que desea ordenar contiene números y texto (como Producto nº 15, Producto nº 100, Producto nº 200), puede que no se ordene como esperaba. Puede utilizar un formato de número para agregar texto sin cambiar la forma en que se ordenan los números.
  1. Seleccione las celdas a las que desea dar formato.
  2. En la ficha Inicio, en el grupo Número, haga clic en la flecha y, a continuación, haga clic en Más.
  3. En la lista Categoría, haga clic en una categoría y, a continuación, haga clic en un formato integrado similar al que desea usar.
  4. En la lista Categoría, haga clic en Personalizada.
  5. En el cuadro Tipo, modifique los códigos de formato de número para crear el formato que desea usar.
Para mostrar el texto y los números de una celda, escriba los caracteres de texto entre comillas ("") o ponga delante de los números una barra invertida (\). Modificar un formato integrado no implica que se quite el formato.
PARA MOSTRARUSE ESTE CÓDIGO
12 como Producto nº 12"Producto nº " 0
12:00 como 12:00 a.m. ESTh:mm a.m./p.m. "EST"
-12 como $-12,00 Defecto y 12 como $12,00 Exceso$0,00 "Exceso";$-0,00 "Defecto"

martes, 23 de octubre de 2012

Administer Ubuntu Server 12.04 using VNC


Once you've installed Ubuntu Server you will need a mechanism to be able to administer it. One way is to Install Putty. Putty gives you a "Command Line" interface and so you'll need to learn a few Linux commands in order to be able to administer your server this way. Some people find this prospect rather too daunting and would rather use a graphical user interface (GUI) instead. As a result many people actually install Ubuntu Desktop instead of installing Ubuntu Server since the desktop version of Ubuntu has the GUI built in. There is a better way however, and that is to install VNC. VNC provides a "virtual desktop" so it is more lightweight than a full blown desktop installation.
NOTE: If you're jumping into this guide here then it's worth mentioning that this guide has been tested on Precise Pangolin 12.04LTS, Lucid Lynx 10.04LTS, Karmic Koala 9.10, 9.04 Jaunty, and 8.10 Intrepid. However, at the time of writing VNC is quite flaky on Precise Pangolin 12.04LTS (although it is getting better all the time) and so I don't particularly recommend you attempt to install it on this version of Ubuntu. You might want to head over to the forums for the latest views on VNC on 12.04.
So to perform the installation of VNC you can either type the following commands from a Putty session or, if you've got a screen and keyboard attached to your server, then you can use the command line itself.
First off you need to type:
sudo apt-get update
You'll be prompted for a password. This is the password you created when you installed Ubuntu. Ubuntu tends to prompt for a password each time you issue a "sudo" command.
TIP: If you're going to be following this guide step by step using Putty then you can save yourself some typing by simply highlighting each command below, right-clicking on it and selecting Copy. Then toggle over to your Putty Session and right-click once more. The command you've just copied from here will be automatically pasted into your Putty Session.

Install the Gnome components

First off we need to install the Gnome components for our virtual desktop. So type the following command (or copy it!):
sudo apt-get install gnome-core
when prompted type Y and then press [Enter]. This will install the gnome desktop components.

Install a Virtual Desktop using VNC

Now we've installed the gnome components for the desktop we need to install VNC to be able to interact with it. So type:
sudo apt-get install vnc4server
when prompted type Y and press [Enter]. This will install VNC Server which is required for running the virtual desktop on the server. Next type:
vncserver
You'll then be prompted to create and verify a new password. Once you've entered it you'll see the following screen:
VNC Created
We now need to kill the session we just created and make a tweak to the startup script for VNCServer to make it work properly. If we don't perform this step then all we will see is a grey cross-hatched screen with an "X" cursor and/or a grey screen with a Terminal Session, depending on the Ubuntu version. Not very useful!
You're probably wondering why we just created a session and then killed it before we'd actually used it? Well, creating the session for the first time automatically generates the file we now need to edit.

So, type the following command to kill the session:
vncserver -kill :1
Now type the following command to open up the file we need to edit:
vim .vnc/xstartup
The modifications we need to make to this file depend on the version of Ubuntu we're using so make sure you follow the correct section:

Ubuntu versions up to and including 9.10 Karmic Koala

Scroll down to the line which currently reads #unset SESSION_MANAGER and press the [Insert] key once (this will switch us into "edit" mode) and then remove the #
Do the same for the line after that. Plus change that line to read as follows:
exec sh /etc/X11/xinit/xinitrc
Note the "sh".
Change the xterm -geometry line as below and once you've made these changes the file should look like this:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec sh /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

Ubuntu Versions 10.04 Lucid Lynx & Maverick Meerkat 10.10

Change the file as above but note the last two lines are different in these versions of Ubuntu:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec sh /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &

Ubuntu Version Precise Pangolin 12.04LTS

Change the file so it looks like this:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#x-terminal-emulator -geometry 1280x1024+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
So, we've unmasked the unset SESSION_MANAGER line, added the gnome-session --session=gnome-classic & lineand masked the last two lines out.

All Versions

When you're done editing the file for your particular version of Ubuntu press the [Esc] key once and type the following:
:wq
This should save the changes and bring you back to the command line. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.
Next type the following command to create the VNC Session once more:
vncserver -geometry 1280x1024
where 1280x1024 is the resolution of your DESKTOP COMPUTER. It has nothing to do with the resolution of the server itself. This command will create a new VNC session on your server. Note: For versions of Ubuntu prior to Precise Pangolin 12.04LTS add a -depth 24 argument so the command should read vncserver -geometry 1280x1024 -depth 24
Next, download and install TightVNC onto your desktop computer. When you launch it type the "X Desktop name" in the VNCServer box. See the DOS-type screenshot above for the name of your "X Desktop name". So, in my case I'd typeMyMediaServer:1 in the VNC Server Listbox. See below.
VNC Startup 
then click Connect, enter the password you created when you typed the vncserver command the first time round and you should then see a screen like this (Note that on Precise Pangolin 12.04LTS the screen is blue and that error message doesn't appear):
VNC First Time
Click the Delete button on the error message which is displayed and you now have a nice shiny desktop view onto your server!
Incase you're wondering how what we've just installed differs to simply installing the full blown Desktop version of Ubuntu then connect a screen to your server now and you'll see it's still sitting there on a black screen with a flashing cursor waiting for you to type your username in. What we've just installed is just a "virtual desktop" onto your server. Neat eh!
Currently this "virtual desktop" runs in a window on your Windows desktop. If you want to switch to "Full Screen" mode, right-click on the TightVNC icon on the taskbar on your windows desktop and select Full screen from the menu. ClickOK on the next message. Now it's as tho you're actually sitting in front of your server. Very cool!
To switch out of Full Screen mode and return to Window mode press Ctrl-Esc on your keyboard to bring back your Windows Desktop taskbar. Then right-click on the TightVNC icon on the taskbar and uncheck the Full Screen option.
I know a lot of people wouldn't bother installing a virtual desktop on their servers (and I've no doubt any Linux veterans reading this will be scoffing that I've done so) but I was a total Linux newbie when I started this project and the thought of administering everything using the command line was simply too daunting a prospect. Even tho I now feel much more comfortable with Ubuntu I still find it really handy to just nip into the Ubuntu desktop and tweak something.
When you reboot the server you'll discover that you are unable to re-launch the VNC session and you'll receive a "Failed to connect to server" error message. This is because the vncserver -geometry 1280x1024 -depth 24 command we typed above is not persistent. To solve this we need to ensure that VNC is run on boot: How to run VNC on startup

The Synaptic Package Manager is not installed by default in Lucid or Karmic

At the time of writing the Synaptic Package Manager does not get installed by default in Lucid or Karmic when you install the core gnome desktop. The Synaptic Package Manager is a great tool which makes adding and removing applications a breeze. So we'll simply install it manually by typing the following two commands in a Terminal/Putty session:
sudo apt-get update
sudo apt-get install synaptic
When you now go into your server desktop via VNC you'll find the Synaptic Package Manager under the System ->Administration menu.

How to prevent Gnome starting on the server on boot

On Ubuntu versions 10.10 (Maverick Meerkat), 11.04 (Natty Narwhal), 11.10 (Oneiric Ocelot) & 12.04 LTS (Precise Pangolin) gnome is automatically started on boot once the above instructions have been followed. So, if you connect a monitor to your server you will see the GUI sitting there waiting for you to log in. You can prevent this happening by carrying out the following tweak:
So, issue the following command to open up the relevant script:
sudo vim /etc/init/gdm.conf
You want to mask out the few lines which start the service ie. start on ((filesystem.... so the first few lines of the script should look like this once you've edited it:
# gdm - GNOME Display Manager
#
# The display manager service manages the X servers running on the
# system, providing login and auto-login services

description "GNOME Display Manager"
author "William Jon McCann <mccann@jhu.edu>"

#start on ((filesystem
# and runlevel [!06]
# and started dbus
# and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
# or stopped udev-fallback-graphics))
# or runlevel PREVLEVEL=S)

stop on runlevel [016]

emits login-session-start
Save your changes then reboot the server and that log-in screen should no longer appear.

lunes, 22 de octubre de 2012

To import Outlook PST files in Thunderbird:

sudo apt-get install readpst
readpst -r nameofyourPSTfilehere
 
 
 
 
t is in situations like this that I really appreciate my virtual Ubuntu!
I was preparing an old hard disk for reuse, I mean it was really old, 7 years old minimum. I found a PST-file on it from when I used Microsoft Outlook, and I got curious, what old emails would I find there?
Oh but behold, Thunderbird required Microsoft Outlook to import the PST-file, so what to do :-S? Ubuntu please rescue me! Ta-daaa, after some search I found a command utility called readpst, which can convert a PST-file to a folder hierarchy of plain text-files, one for each email in the PST-file, thank you Ubuntu (well actually Linux command utilities in general)!
First of all you might not have readpst installed, but that’s only an apt-get-call away, running the following command from the terminal:
> sudo apt-get install readpst
It doesn’t really matter if you already have the utility installed or not, you can use the command above to confirm whether the utility is installed and if it isn’t, well then you saved yourself a bit of time since it will be installed icon smile Importing a PST file to Thunderbird without using Outlook
My first few attempts with readpst didn’t turn out so well, but after some fine-tuning I came up with the following set of options for the readpst command:
> readpst -D -M -b -o pst thomas.pst
I will just briefly walk through the command options:
  • The -D option tells readpst to include deleted emails
  • The -M option tells readpst to include attachments in the mail-files and not as separate files in the file system
  • The -b option tells readpst to omit the RTF version of the email, which would otherwise be included as attachment in the mail-files
  • The -o pst option specifies where the output goes
  • And last but not least include your PST-file which needs to be converted
Voila! That was a huge step in the right direction, after running the command above I had a folder structure mirroring the original folder structure from the PST-file, well at least I assume that it’s pretty close to the same. However in the conversion all the email-files were given a number and nothing else, no extension, nothing!
I renamed one file from 1 to 1.eml and dragged it into a folder in Thunderbird installed on my native Windows 7, and the email was imported to Thunderbird, the email even got all of it’s attachments intact, super! I could just drag’n'drop import all my emails.
My next problem turned out to be, how on Earth do I add the eml-extension to all of these files? Should I do it manually? No no no, not in a million years, Ubuntu, rescue me again, please!
I needed to find a way to recursively scan through all the folders created by readpst and add the eml-file extension to the name, after a bit of Googling I found a shell script for recursion (sorry for my ignorance, not a master of shell scripting, not yet at least). I found the shell command for renaming, funny enough it’s called rename, and it allows you to use Perl regular expressions when searching for files to rename, sweet!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
rename_fun()
{
   # For each folder do
   for i in `ls -ltr | grep '^d'| awk '{print $8}'`
   do
      # Output the folder's name, to track progress
      echo $i;
 
      # Move down into the sub-folder
      cd $i;
 
      # Add the eml-extension to all files with numeric names
      rename 's/([0-9]+)$/$1.eml/' *
 
      # Recurse deeper down into the folder structure
      rename_fun
 
      # When done move up from the sub-folder
      cd ..
   done
}
 
# Call to rename files
rename_fun
WARNING: The script is not child-safe, start from the wrong working directory in the prompt and suddenly you have added the eml-extension for a whole lot of files, which were never supposed to be changed. Furthermore it assumes that no mail folders use spaces in the folder name, I only had to folders which contained a space in the name, so I opted for the lazy solution: I removed spaces from my mail folders.
The only setback about this setup, is that I had to manually drag’n'drop the converted emails into my Thunderbird, that did take me some time, but I ran out of good ideas to how I could get the eml-files into Thunderbird in a smarter way, if you know just how to do that, then please add a comment below, thank you in advance!
It goes with the story to tell, that these emails turned out to be from the period of 2000 – 2004 and they were not that interesting actually, so perhaps this was just a waste of time for me, but I thought it might help someone else. Feel free to comment on this post, good ideas and constructive critique are always welcome!
I have listed some references below, which helped me in the right direction, I thank everyone who has unwillingly or unknowingly contributed to set my curiosity at rest! Among the links below you will also find a Thunderbird plugin, but according to the comments it doesn’t work, and I didn’t try. I decided to pursue the readpst solution instead based on the Ruby project at Google Code, which by the way didn’t work for me either.
 

miércoles, 10 de octubre de 2012

Openbravo ERP 2.50 installation steps in ubuntu (default installation) backup

Hi all, there are n number of ways presented in openbravo community to try or work with Openbravo ERP. but i felt any of them were too big for novices. So i ve presented my small complition (CCP:Cut,Copy,Paste) version of installing Openbravo in Ubuntu. There is a virtual box appliance that is far more easier to install than this. but lemme get to its disadvantages in a later post. 


1. Adding canonical partner repositories. (this is not present by default)
$ sudo gedit /etc/apt/sources.list

2. In the file that opens up add the following lines,
deb http://archive.canonical.com/ubuntu karmic partner
deb-src http://archive.canonical.com/ubuntu karmic partner

3. Installing the application
$ sudo apt-get update
$ sudo apt-get install openbravo-erp

4. This will install openbravo cluster,apache tomcat,postgres. Openbravo uses its own properties so the post numbers are not the default ones.

5. To run the application, type the follwing in the browser menu.
http://localhost/openbravo 
user credentials:
username: Openbravo
password: openbravo

6. Other Options:
6.1. creating backup:
$ sudo /etc/init.d/openbravo-erp stop
$ cd /opt
$ tar cvzf OpenbravoERP-2.50.tar.gz OpenbravoERP-2.50

6.2. Restoring to the backup:
$ sudo /etc/init.d/openbravo-erp stop
$ cd /opt
$ rm
$ tar xvzpf OpenbravoERP-2.50.tar.gz
$ sudo /etc/init.d/openbravo-erp start

6.3. Uninstall
There are two options available to uninstall. we can update the database to the recent level or leave it to the last compiled state.
6.3.1 uninstall maintaining the database
$ sudo apt-get remove openbravo-erp

6.3.2 uninstall without maintaining the database
$ sudo apt-get remove --purge openbravo-erp

6.4 Startup Options
Openbravo is configured to automatically start at run-time. but in case its not in a dedicated server, we can change those options...

6.4.1 To disable startup at boot time:
$ update-rc.d -f openbravo-erp remove

6.4.2 Manually starting openbravo: 
$ sudo /etc/init.d/openbravo-erp start

6.4.3 Enable start up at boot time:
$ update-rc.d openbravo-erp defaults


There you go...he OB world will open for you..:)

lunes, 1 de octubre de 2012

Creando un mirror de bases antivirus para Kaspersky (cualquier versión o todas)


Hola Comunidad! pretendo mostrarles en este post cómo crear un mirror para poder actualizar los antivirus de Kaspersky. Para ello nos vamos a auxiliar de la herramienta de actulización que nos brinda KAV Labs: Retranslator for Linux. Para ver los diferentes productos que brindan podemos acceder a http://support.kaspersky.com/sp/updater
También se pueden descargar versiones para FreeBSD
La utilidad de actualización fue diseñada para efectuar una descarga centralizada de las actualizaciones de bases de amenazas conocidas y módulos de aplicaciones de Kaspersky Lab y guardarlas en una carpeta individual. Por medio de esta utilidad se puede descargar actualizaciones de productos de Kaspersky Lab que tenga instalados en su red u ordenador doméstico. La utilidad permite guardar las bases y los parches  descargados en: una carpeta local, una carpeta de red conectada como un disco al sistema de archivos del ordenador, o en una unidad flash.
La herramienta Retranslator se puede bajar directamente de la web a través dehttp://utils.kaspersky.com/updater/retranslator_5.0.0.9/Linux/retranslator-5.0.0-9.tar.gz
También se debe descargar la Tabla de Contenidos, que es un PDF que contiene todos los productos de KAV Labs hasta la fecha. Cada producto tiene asociado los componentes que requieren para que puedan actualizarse; esto le permite al retraslator elegir a que productos van disponibles para actualizar desde nuestro mirror.
Bueno una vez descargado el retraslator, lo descompactamos en algún directorio de nuestro Server o PC:
tar -xvzf nombre_del_fichero.tar.gz
Advertencia: El nombre del archivo varía dependiendo de la versión.
2) Si usted tiene un sistema de 64 bits se pone ia32 (conjunto de librerías para aplicaciones de 32 bits en un sistema de 64 bits), de lo contrario se producirá un error / Retranslator:. 7:. / Retranslator.bin no encontrado
apt-get install ia32-libs

Luego accedemos al directorio retraslator y a los ficheros retraslator y retraslator.bin le damos permisos de ejecución
chmod 755 retranslator
chmod 755 retranslator.bin
Editamos el fichero de configuración: retraslator.conf
nano retraslator.conf
Este fichero tiene explicado cada uno de las opciones disponibles, veamos un ejemplo:
A continuación especifico donde voy a guardar las bases, o sea donde voy a crear el mirror
RetranslationPath=/var/www/ftp/Antivirus/updates/KAV/
Con RetranslateComponentsList selecciono los componentes de los productos que van a estar diponibles en nuestro mirror. Veamos algunos ejemplos que nos se recomiendan a la hora de configurar los componentes:
    - Los componentes deben ser listados en cualquier orden, sin espacios, usando el símbolo de coma para separarlos.
    - Si ejecuta la utilidad sin especificar los componentes, ninguna  base  será  descargada.
    - Si planifica actualizar Kaspersky Administration Kit desde ésta carpeta y después actualizar las aplicaciones anti-virus desde la carpeta de acceso común del Servidor de Administración, entonces el valor del parámetro RetranslateComponentsList  debe incluir los componentes de tales aplicaciones antivirus y los de Kaspersky Administration Kit.
Recordar que la lista de componentes se extrae del PDF que se habló más arriba. Por ejemplo para KAV Winworkstation 6.0.4.x solamente quedaría de la siguiente forma:
RetranslateComponentsList=UPDATER,KDB,ARK,RM,ADBU,AH,APU,AS,BB2,CORE,BLST2,KAV2006EXEC,WMUF,WA,EMU,PAS,ASTRM
Por defecto el retranslator descarga las bases de los servidores de KAV Labs, pero podemos especificar otro origen para ello modificamos las siguientes opciones:
UseUpdateServerUrl=yes
UseUpdateServerUrlOnly=yes
UpdateServerUrl=http://antivirus.uclv.edu.cu/update/kaspersky/updates/
Para conexiones lentas se recomiend tener un valor alto de la variable ConnectTimeout por ejemplo 300
Para que el actualizador no muestre información del proceso en la pantalla:
KeepSilent=no
La utilidad viene configurada para no usar servidor proxy, pero si lo necesita habilítelo mediante:
UseProxy=yes
ProxyAddress=http://usuario:el_pass@192.168.0.20:3128
Tenemos la posiblidad de ejecutar un script o comando después de terminada la acualización mediante:
PostRetranslateCmd=/root/scripts/retranslator/compress.sh
Con la opción anteriror ejecuto un script para compactar las bases recién acualizadas.
El fichero de reporte (log) se especifica con al opción ReportFileName=
Use ReportLevel=4 para obtener un fichero de log detallado.
Les adjunto mi fichero de configuración para que vean como es todo con más detalles.
Finalemente podemos agragar una tarea al crontab para que se ejecute cuando deseemos, por ejemplo:
crontab -e
y agregar lo siguiente:
0 11 * * * /scripts/retranslator/retranslator
Lo anterior significa que se correrá el script todos los día de la semana a las 11:00 am y se encuentra ubicado en /script/retranslator
Luego reiniciar el crontab:
/etc/init.d/cron restart