3

Utilidad para redes wifi y Linux.

Posted by touzas on nov 26, 2008 in Linux

wifi-radar funciona muy bien cuando nos encotramos en un lugar donde no tenemos configurado nuestro acceso a internet. Probadla y veréis como os facilita mucho la vida.

wifi-radar

Etiquetas: ,

 
1

TextBox autoScroll to end.

Posted by touzas on nov 11, 2008 in Programación

Este código lo utilizo para que cuando tengo un textbox el cual quiero que tenga scroll automático hacia el final del contenido del mismo.

using System.Runtime.InteropServices;
private void setStatus(string data){
this.tbLog.Text += data + Environment.NewLine;
ScrollTextBoxEnd(this.tbLog);
}
private void ScrollTextBoxEnd(TextBox tb) {
const int WM_VSCROLL = 277;
const int SB_BOTTOM = 7;

IntPtr ptrWparam = new IntPtr(SB_BOTTOM);
IntPtr ptrLparam = new IntPtr(0);
SendMessage(tb.Handle, WM_VSCROLL, ptrWparam, ptrLparam);
}

[DllImport("User32.dll", CharSet = CharSet.Auto, EntryPoint = "SendMessage")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

Espero que os sirva…

 
2

Instalación de FreeNX en debian 4.0

Posted by touzas on nov 11, 2008 in Linux

Siguiendo con temas relacionados con Linux, vamos a ver como se instala FreeNX en debian. FreeNX en un programa que nos permitirá abrir una sesion de X desde un sistema Windows a un sistemas Linux.

Pasos a seguir:
1.- Instalación de los paquetes:
openssh server
   libstdc++2.10-glibc2.2  (search for glibc)

2.- Instalación de FreeNX

wget http://64.34.161.181/download/2.1.0/Linux-NoXft/nxclient_2.1.0-17_i386.deb
wget http://64.34.161.181/download/2.1.0/Linux/nxnode_2.1.0-22_i386.deb
wget http://64.34.161.181/download/2.1.0/Linux/FE/nxserver_2.1.0-22_i386.deb

Instalación de los paquetes en el siguiente orden:

dpkg -i nxclient_2.1.0-17_i386.deb
dpkg -i nxnode_2.1.0-22_i386.deb
dpkg -i nxserver_2.1.0-22_i386.deb

Arrancamos el servidor ssh y el servidor de FreeNX:

etc/init.d/ssh start
/etc/init.d/nxserver start

Y listo. Nos conectamos con el cliente para windows y a trabajar.

 
3

Una sola Instancia de la aplicación.

Posted by touzas on nov 3, 2008 in Programación

Este código se utiliza para comprobar que hay una sóla instancia de la aplicación arrancada en el sistema

—————————————————————————-
public class instance {
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]

public static bool estaArrancado() {
Process currentProcess = Process.GetCurrentProcess();
string fileName = currentProcess.ProcessName
Process[] procesos = Process.GetProcesses();
foreach (Process process in procesos) {
if (process.ProcessName != fileName) { return true; }
}
return false;
}
}

 
3

How to create a self-signed SSL Certificate …

Posted by admin on nov 3, 2008 in Linux

 1.- Generate a Private Key
#openssl genrsa -des3 -out server.key 1024

Generating RSA private key, 1024 bit long modulus
…………………………………………………++++++
……..++++++
e is 65537 (0×10001)
Enter PEM pass phrase:
Verifying password – Enter PEM pass phrase:

2.- Generate a CSR (Certificate Signing Request)
#openssl req -new -key server.key -out server.csr

Country Name (2 letter code) [GB]:ES
State or Province Name (full name) [Berkshire]:Galicia
Locality Name (eg, city) [Newbury]:Coruña
Organization Name (eg, company) [My Company Ltd]:Touzas
Organizational Unit Name (eg, section) []:IDi
Common Name (eg, your name or your server’s hostname) []:ssl.touzas.es
Email Address []:touzas at gmail dot com
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

3.- Remove Passphrase from Key
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
ls -l
-rw-r–r– 1 root root 745 Jun 29 12:19 server.csr
-rw-r–r– 1 root root 891 Jun 29 13:22 server.key
-rw-r–r– 1 root root 963 Jun 29 13:22 server.key.org

4- Generating a Self-Signed Certificate
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=ES/ST=Galicia/L=Coru\xF1a/O=Tozas/OU=IDi/CN=ssl.touzas.es/Email=touzas at gmail dot com
Getting Private key

 

Etiquetas: , , ,

Copyright © 2010 Javier Lema. All Rights Reserved.
Theme by Lorelei Web Design.