Thursday, February 10, 2011

How To view clipboard data

How To View & Manage Clipboard In Windows 7 & Vista.

When you copy or cut or move data, it is held temporarily in an invisible portion of memory. This is called as the ClipBoard. Windows XP had clipbrd.exe referred to as the Clipboard Viewer or the ClipBook Viewer, which could be used to see what was saved on your clipboard. If you try to search for this exe file in Vista or 7, you will be unable to find clipbrd.exe.

In XP this file was situated in C:\Windows\System32\clipbrd.exe. It is now missing as a part of the Vista installation. You can try to copy it from an XP installation, if you have access to it, and paste it in your Vista/7, System32 folder. In most cases this is know to work.

But if it does not or if you are confronted with a message of sorts : Entry Point Not Found, then you may try to run it in XP/SP2 compatibility mode.
If it still does not help, I'd suggest you download this freeware application Clipboard Viewer.
ClipViewer
This application allows you to look inside your Windows clipboard.

If you really need a more advanced tool to Manage your Windows Clipboard, you may use freeware ClipMagic.
ClipMagic
ClipMagic is a powerful Clipboard Extender and Information Manager for storing Images and Text, either automatically or manually in a categorized format, with details of the URL if the text is from an Internet site. It lets you edit, merge and manage your clips.
Incidentally, Clip.exe is a different file, which is a part of Microsoft Word/Office Clip Organizer. It is a cmd command. And rdpclip.exe is the main executable for File Copy, which allows you to copy and paste between server and client. Vista's Snipping Tool may also be considered as a variation of sorts. It lets you copy any portion of any screen, make notes and then copy it to the Clipboard as a graphic, save it as a graphics or an html file and/or send it by email. But you cannot view the clipboard with it.

How To Install and Configure FTP Server in Amazon EC2 instance

 Install and Configure FTP Server in Amazon EC2 instance


For many users, running FTP Sever in Amazon EC2 instance is headache at the first time. You need to experiment before being able to transfer data. The main problems are Ingress firewall in Amazon environment and NAT traversal.
Here I’m using vsftp (vsfptd) Server, which is one of the most popular and easy to configure. The instance is running from base Fedora 4 AMI but the setup should be identical to other Red Hat based distros.
Install vsftpd FTP server, if not installed earlier:
# yum install vsfptd
Its upto you which FTP method i.e. Active or Passive you want to use. The problem with active mode is that your computer is sending a request out of port 21 when all of a sudden, the server attempts to initiate a request with your computer on port 20. Since communication on port 21 does not imply communication on port 20, it appears as if some unauthorized host has attempted to initiate a new connection with your computer. Kind of sounds like a hack right? Your firewall may think so too (or your NAT router may have no idea to which computer to route the request). Active mode is not used as default method of ftp transfer in many clients these days.
On the other hand, as the Ingress firewall is running in AWS, from the firewall’s standpoint, to support passive mode FTP the following communication channels need to be opened:
FTP server’s port 21 from anywhere (Client initiates connection).
FTP server’s port 21 to ports > 1023 (Server responds to client’s control port).
FTP server’s ports > 1023 from anywhere (Client initiates data connection to random port specified by server).
FTP server’s ports > 1023 to remote ports > 1023 (Server sends ACKs (and data) to client’s data port).
That second part is the problem: FTP server listens on a random port and hands that back to the client, so the client initiates a connection to a random server port, which you must allow.
Opening up all ports > 1023 isn’t so good for security. But what you can do is allow the ports through the distributed firewall and then setup your own filtering inside your instance. Instead, you would better open a fixed number of ports (such as 1024 to 1048) and configure your FTP Server to only use that ports.
Check whether required ports are open or not in your EC2 security group. (if you are unaware about security group, it should be ‘defaul’ unless you created a new one).
# ec2-describe-group
This command will print all ports which are currently open. If you dont find port 20,21,1024-1048 then you need to open these ports but if you dont find the command itself i.e.
# ec2-describe-group
-bash: ec2-describe-group: command not found

You need to install ec2 command line tools. You can find them here and the instructions to setup/configure can be found here.
Open the ports now:
# ec2-authorize default -p 20-21
# ec2-authorize default -p 1024-1048

Here, ‘default’ is the name of security group. You can also open ports for specific IPs. For ease of use, you better install ElasticFox, a firefox extension to manage EC2 stuff. you can find more about it here.
At this moment, you can start your FTP server and if you try to connect it, the process will get failed. By checking logs, you should find something like:
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/" is current directory.
Command: TYPE A
Response: 200 Type set to A
Command: PASV
Response: 227 Entering Passive Mode (216,182,238,73,129,75).
Command: LIST
Error: Transfer channel can't be opened. Reason: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Error: Could not retrieve directory listing

Time to configure vsftpd.conf file:
# vi /etc/vsftpd/vsftpd.conf
---Add following lines at the end of file---
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=Public IP of your instance

Put public IP of your EC2 instance and then Save the file. Now restart the server:
# /etc/init.d/vsftpd restart

How to Show color in font dialog c#

Type: System.Boolean
true if the dialog box displays the color choice; otherwise, false. The default value is false.
The following code example uses ShowDialog to display a FontDialog. This code requires that a Form has already been created with a TextBox and button placed on it. It also requires that the fontDialog1 has been created. The Font contains the size information but not the color information.

C#

private void button1_Click(object sender, System.EventArgs e)
 {
    fontDialog1.ShowColor = true;

    fontDialog1.Font = textBox1.Font;
    fontDialog1.Color = textBox1.ForeColor;

    if(fontDialog1.ShowDialog() != DialogResult.Cancel )
    {
       textBox1.Font = fontDialog1.Font ;
       textBox1.ForeColor = fontDialog1.Color;
    }
 }