yet another blog about computer, technology, programming, and internet

Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Tuesday, November 24, 2009

Changing Screen Resolution in Ubuntu under VirtualBox

Tuesday, November 24, 2009 Posted by Ismail Habib , , , 15 comments
This problem has caused me a relatively severe headache today. I'm doing a project which require me to use a Linux OS. Since I don't have Linux in my office PC, I decided to install one (Ubuntu 9.10) in a VirtualBox instead of creating a double booting configuration. The installation procedure was easy and painless, but then the problem is coming. The installed Ubuntu does not have any option to increase the screen resolution other than 800x600 and 640x480.

I tried to install the suitable driver with no result except destroying my X Window which forces me to reinstall the Ubuntu again (thank God I use virtual machine...). Then I started looking around for a solution and several forums and websites point me to this:

  • Choose Devices -> Install Guest Additions... on the VirtualBox menu
  • It will mount a CD which will appear on the Desktop
  • Go to your terminal (Applications -> Accessories -> Terminal)
  • Go to the CD directory by typing "cd /media/cdrom0" (without the quotes)
  • Type "sudo sh ./VBoxLinuxAdditions-x86.run", again, without the quotes. At the first try I couldn't find this file instead just a directory "OS2". If you experience the same thing, this is probably because you set your VirtualBox OS type as "Ubuntu" instead of "Linux 2.6". In this case, shut down your VirtualBox, change the OS type and redo the whole stuffs from the beginning
  • Restart your VirtualBox


Now, this has successfully gave me another resolution, which is 1024x768. Not bad, but I'm rather greedy and I want something more! (Hey, my PC could do better!). Continue with this:
  • Go to the terminal again
  • Edit the xorg.conf by typing "sudo gedit /etc/X11/xorg.conf" (yes, no quotes)
  • If you can find some already existing screen resolution, then you can add more, otherwise you can include something like this:
Section "Screen"
        Identifier "Screen0"
        Device     "Videocard0"
        DefaultDepth     24
        Subsection "Display"
                Viewport   0 0
                Depth     24
                Modes     "1280x1024" "1024×768"
        EndSubSection
EndSection

  • Be really careful when you're doing this. It is always nice to make a backup beforehand
  • Restart your VirtualBox and enjoy the new screen resolution


Reference:
1. http://www.mikesouthby.co.uk/2009/11/virtualboxubuntu-9-10-changing-screen-resolution/
2. http://www.mjmwired.net/linux/2009/09/15/default-xorg-resolution/

Saturday, November 14, 2009

Improving a Scanned Hand-Drawing

Saturday, November 14, 2009 Posted by Ismail Habib , 17 comments
I did a lot of digital drawing and painting as a hobby. One of the most common problem I faced is the lack of quality of the scanned lines from the scanned drawing. Thus, an improvement on the scanned drawing is required before doing anything else. Before we start, I should warn you that this is the way that I found works, doesn't mean that there is not other way to do it. I'm using Photoshop and Corel Draw to do this, but I suppose any other application with similar features should work fine.

I prefer to trace a scanned hand-drawing before doing anything else. Tracing is nice because with tracing I can have an output in form of vector. Thus, further improvement could be made easily. However, tracing a scanned hand-drawing often caused many detail loss. Increasing trace resolution wouldn't help since the output will not posses simple, clear, and solid lines.

To overcome this situation, I propose to do a preprocessing for the scanned hand-drawing. I'm using a self hand-drawing with a manga-ish style. Forgive the quality, I'm only an amateur :)



Once you scan your hand-drawing, we need to adjust the color intensity. I'm using "Level" feature of Photoshop and adjust accordingly.



The next step is to apply a filter called "Photocopy" from Photoshop. I choose this because it will make the lines bolder and flatten (is this even the correct word?) the color.



The resulting image is good enough for tracing. I import the image and do the tracing with Corel Draw.



The result is clean and artistic. You can always make further adjustment easily since it is in form of vector.

Tuesday, June 24, 2008

Modifying Google Translation Button to Open Translation in New Tab/Window

Tuesday, June 24, 2008 Posted by Ismail Habib , , , 61 comments
The translation button from Google has proved to be very useful in most situation (by me), especially since the language detection was introduced. However, I feel that there is something lacking. The problem is that the translation generated replaces the current active window/tab while sometimes I prefer to have another window/tab open. The translation button itself is a JavaScript, so we can play with is just a little bit. Here is the original code for translation button (I use the code for translation into English):

javascript:
var t = ((window.getSelection&&window.getSelection()) || (document.getSelection&&document.getSelection()) || (document.selection&&document.selection.createRange && document.selection.createRange().text));
var e = (document.charset || document.characterSet);
if (t!='') {location.href='http://translate.google.com/translate_t?text=' + t + '&hl = en&langpair=auto|en&tbb=1&ie=' + e;} else {location.href='http://translate.google.com/translate?u=' + escape(location.href) + '&hl = en&langpair=auto|en&tbb=1&ie=' + e;};

In order to make the translation to be opened in a new window/tab, we just have to make a bit change in it:

javascript:
var t = ((window.getSelection&&window.getSelection()) || (document.getSelection&&document.getSelection()) || (document.selection&&document.selection.createRange && document.selection.createRange().text));
var e = (document.charset||document.characterSet);
if (t!='') {var myWindow=window.open('http://translate.google.com/translate_t?text=' + t + '&hl=en&langpair=auto|en&tbb=1&ie='+e,'Translation','')} else
{var myWindow=window.open('http://translate.google.com/translate?u=' + escape(location.href) + '&hl=en&langpair=auto|en&tbb=1&ie=' + e,'Translation','')};

If you hate this kind of stuff, just drag and drop the link below to your browser toolbar:
Translate to English

I hope this is useful. Please let me know if you have a better idea. Obviously, any questions are welcome.

edited: thanks for the suggestion

Related Posts

Sunday, June 08, 2008

Creating Thumbnails from a Video

Sunday, June 08, 2008 Posted by Ismail Habib , 16 comments
Usually when you want to share a video, people often ask for screenshots. Sometimes it is better to give several small thumbnails rather than just one big screenshot. This simple tutorial will tell you how to do such thing with ease.

First, you will need the Media Player Classic (MPC). It is a free software that you can get from sourceforge. If you are using Windows XP then you just have to download it here.

Now you already have the MPC, follow these instruction:
  • Extract the zip file and run the mplayer.exe
  • Open the video you'd like to use as a source
  • Click on File -> Save Thumbnails

  • On the dialogue box, specify your output filename and type (jpg or bmp). You can also specify the number of thumbnails you want to make by setting the number of rows and colums. You can also specify the witdh of the output file.
  • Press Save and leave everything else to MPC
  • Now you have your thumbnails

Important note:

If you get the error message "Get Current Image Failed, hr = 8000ffff", do this following:
  • Click View -> Options
  • Open Playback -> Output

  • Change the DirectShow Video from Overlay Mixer to anything else (I have tried VMR7 windowed and VMR9 renderless and it's work perfectly)
  • Click OK
  • Restart your MPC

Thursday, May 29, 2008

Setting up an FTP Server Behind NAT (Network Address Translation)

Thursday, May 29, 2008 Posted by Ismail Habib , 69 comments
Before starting, I assume that you have enough knowledge about FTP, active and passive mode in FTP, and NAT (Network Address Translation).

My home LAN (Local Area Connection) is consisted of several computers connected to The Internet via a router with a single IP Address, therefore obviously NAT is required. With NAT, there are two types of IP Address, local and global address(es). The computers in my network use local addresses which are only recognized inside my network. On the other hand, the router uses both address, so that it is possible to reach the router from local network or from the internet. I want to use one of my computer as an FTP server that can be accessed from outside my local network. The problem is that with only local address, the computer I used for FTP server couldn't be accessed from outside the local network.



In active mode, client is the one responsible in opening ports for data transmission. However, in passive mode (which is more popular), this responsibility is taken care by server. This is a similar problem from the previous one. The ports which are opened by the server are only available for those in the local network since it is using a local address.

Solution: Port Forwarding

In order to make the local FTP server available for anyone connected to the internet, a port forwarding must be applied to the router. For active mode, you just simply add port 21 (the default port for FTP) and forward it to the FTP server address. For passive mode, the same thing also have to be applied. In addition, several other ports are also need to be opened for data transmission.

Example:
I'm using the very common router (LinkSys WRT54GL) with local address 192.168.1.1. I want to open the port 21 and another ports from 60000-60050 for data transmission (this is actually up to you, pick anything above 1024). Open the router's interface from browser: http://192.168.1.1. Open the Application & Gaming -> Port Range Forward and fill in as follow (192.168.1.100 is my FTP Server's local address).



FTP Server Application

Another important thing that you need to do when using passive mode is setting up the FTP Server application itself. I think most of the FTP server application supports the usage of FTP server behind NAT. I'm going to use the free FileZilla FTP server as an example. In order to make the FTP Server works, you need to let it know about its global address. If you have a fixed address then you just have to tell the application about it, otherwise you will need another tool to retrieve the global address such as the one provided by FileZilla: http://ip.filezilla-project.org/ip.php.

To set up the FileZilla FTP server, open the Edit -> Settings menu and choose "Passive mode settings". If you have a fixed IP address (like in my example is 202.169.1.1), fill in the "Use the following IP" field, otherwise (or if you're not sure), just tick the "Retrieve external IP address from" and fill it with "http://ip.filezilla-project.org/ip.php". Tick both "Don't use external IP for local connections" and "Use custom port range". Fill the port range with the same range that you have filled in the router settings.

Tuesday, May 06, 2008

Sharing Internet Connection using WiFi (Windows XP)

Tuesday, May 06, 2008 Posted by Ismail Habib , 65 comments
Here is the situation, you have two (or more) laptops (or PC) with WiFi capabilities. You don't have any router, switch, hub, or whatsoever. Just a single Internet port enough for one of your computer. Don't be worry, because you still can share the Internet connection by using ad-hoc network.

First, you need to pick one of those computers as a "server". Connect it to the Internet using the usual way. Next, open Control Panel>Network and Internet Connections>Network Connections. Open the Wireless Connection Properties. Change tab to Wireless Networks then click Add... button. Under the Association tab, input your Network Name as you like. Clear the The key is provided for me automatically check box and select the This is a computer-to-computer (ad hoc) network check box. Fill in the Network Key along with the confirmation with a 13-digit password and then press OK. Press OK once again to close the dialog box. Now you have finished with the first computer.

For the other computer, check for available wireless network. Usually a notification balloon will pop up and you can just simply click on it or just go to the Network Connections, right click on the Wireless Network Connection and click on View Available Wireless Networks. Select your network, and click connect button on the lower right corner. Input the Network Key and press connect once again.

If the first computer is using a PPPoE connection to gain access to the Internet don't forget to allow other computers to use it. You can do it by accessing the Network Connections, then open the properties of the connection. Open Advanced tab, check the Allow other network users to connect through this computer's Internet connection and set the Home networking connection to Wireless Network Connection.

In my experience, this network is not very stable. Not really sure what is the cause, but still good enough for a temporary solution.