Thứ Sáu, 28 tháng 12, 2012

Thêm Eclipse 3.8.1 vào Desktop Entry cho Ubuntu

Eclipse is a very popular IDE for almost all purposes. Although the Ubuntu Software Center lets you install Eclipse with one click, many users like to do a manual installation instead. Also, at the time of this post, the Software Center still offers Eclipse 3.8.1, so if you want to install an up-to-date version, you have to choose the manual way. This is how it's done:

  • Make sure you have installed a Java JDK (search for "java" in the Software Center).
  • Download an Eclipse SDK archive that fits your machine's architecture (x86 for 32 bit, x86_64 for 64 bit).
  • Navigate to the downloaded archive and extract it. You should get a folder named "eclipse".
  • Open a terminal and type "sudo mv /path/to/eclipse /opt" and enter your password when prompted. Now the extracted folder is moved to your system-wide /opt folder.
  • Final Step: creating a desktop shortcut. Type: 
  • sudo gedit /usr/share/applications/eclipse.desktop
  • Enter your password when prompted. An editor window is opened. Insert the following:
[Desktop Entry]
Name=Eclipse 3.8
Comment=Java IDE
Exec=/opt/eclipse/eclipse
Icon=/opt/eclipse/plugins/org.eclipse.sdk_3.8.1.v201209141540/eclipse256.png
Type=Application
Categories=Development


Save the file and exit the editor. Now you can start eclipse using the dash.
You can install other versions the same way, just download the archive you want. For example, the current official version 4.2 is available under http://www.eclipse.org/downloads/. I prefer the 3.x series, as it is less resource-hungry and responds quicker. You even can have two or more versions of Eclipse at the same time, as each installation only operates inside its folder. Just remember to rename the install folders accordingly.

Dynamic Languages Toolkit - môi trường phát triển Eclipse cho Perl, Python và PHP

Sử dụng bộ công cụ ngôn ngữ động (DLTK) để tạo IDE của riêng bạn
Matthew Scarpino, Java Developer, Eclipse Engineering, LLC

Frequently used acronyms DLTK: Dynamic Languages Toolkit- Bộ công cụ ngôn ngữ động.
GPL: GNU Public License- Giấy phép công cộng GNU.
IDE: Integrated Development Environment- Môi trường phát triển tích hợp.
JRE: Java Runtime EnvironmentMôi trường thực chạy Java.
MVC: Model-View-Controller- Mô hình – Khung nhìn – Điều khiển.
SWT: Standard Widget Toolkit- Bộ công cụ tiện ích tiêu chuẩn.
UI: User Interface- Giao diện người dùng.
Tạo ra một dự án trình cắm thêm.
Cấu hình trình soạn thảo và các công cụ văn bản DLTK.
Thêm các lớp để kiểm soát tô mầu theo cú pháp trong trình soạn thảo văn bản.
Bật các tùy chọn ưa thích của người sử dụng.
Tích hợp trình thông dịch kịch bản lệnh trong môi trường phát triển.
Thêm một bàn điều khiển tùy chỉnh để giao tiếp giữa bàn làm việc (workbench) và trình thông dịch.


Tóm tắt: Eclipse đã tỏ ra rất giầu khả năng để xây dựng các công cụ cho các ngôn ngữ biên dịch như các ngôn ngữ lập trình C và Java™, nhưng lại ít cung cấp sự hỗ trợ cho các ngôn ngữ kịch bản lệnh như Perl, Python và PHP. Đối với các ngôn ngữ này và các ngôn ngữ tương tự, Bộ công cụ ngôn ngữ động (DLTK) của Eclipse đã xuất hiện để ứng cứu. Ta sẽ đi từng bước qua quá trình xây dựng một IDE dựa vào DLTK và khám phá các mã mẫu cho mỗi bước.

Trước khi bạn bắt đầu

Về hướng dẫn này
Hướng dẫn này cho biết DLTK của Eclipse mang lại khả năng xây dựng các công cụ phát triển dành cho các ngôn ngữ kịch bản lệnh như thế nào. Nói cụ thể, nó giải thích cách làm thế nào để triển khai thực hiện tô mầu theo cú pháp, các tùy chọn ưa thích của người sử dụng và tích hợp trình thông dịch vào trong một dự án dựa trên trình cắm thêm.

Các mục tiêu
Hướng dẫn này giải thích — từng bước một — làm thế nào để xây dựng môi trường phát triển dựa trên DLTK. Các thảo luận sẽ giới thiệu DLTK bằng cách tập trung vào một dự án trình cắm thêm thực hành dựa trên ngôn ngữ tính toán số Octave. Các chủ đề được trình bày bao gồm:

Các điều kiện cần có trước
Hướng dẫn này được viết cho các nhà phát triển Java đã quen với Eclipse và quan tâm đến việc xây dựng các công cụ cho các ngôn ngữ động, ví dụ như PHP, TcL, Ruby và Python. Nó giả thiết bạn có một sự hiểu biết cơ bản về các trình cắm thêm và các công cụ phát triển dựa trên Eclipse nói chung.

Các yêu cầu hệ thống
Để xây dựng dự án ví dụ trong hướng dẫn này, bạn cần một máy tính có cài đặt bản Eclipse (V3.4 hoặc mới hơn) và một môi trường thực chạy Java hiện tại (Java Runtime Environment-JRE). Bạn cần phải cài đặt một phiên bản mới nhất của DLTK, mà chúng tôi mô tả trong phần "Cài đặt DLTK". (Xem Tài nguyên để tìm các liên kết tải về Eclipse).

Source: http://www.ibm.com/developerworks/vn/edu/os-eclipse-octave/index.html

Thứ Năm, 27 tháng 12, 2012

Setting Up Virtual Hosts for XAMPP


Running a Web server on your desktop computer is a great way to speed up Web site development. By previewing your Web pages directly through a Web server on your own computer you can test out server-side programming like server-side include files, form processing scripts, or database-driven Web pages. However, there’s one problem associated with running a server on your own computer: by default, you only have a single "domain"–http://localhost/–so if you work on more than one Web site you put them all under "localhost" in different directories. This isn’t very real world and can cause problems when using server-side includes and root-relative links. Fortunately there’s a better way.
For information on setting up XAMPP, visit the XAMPP instructions page.

Virtual Hosts

Virtual Hosts give you the ability to "host" more than one Web site and domain on your computer. With a virtual host you can have separate local domain names for each of your Web sites: for example, http://clientA/ for one site and http://clientB/ for another. When you type the URL for the Virtual Host in your Web browser, the browser doesn’t go out onto the internet to find the site, but instead asks for the proper file from the Web server running on your computer. Not only does a Virtual Host let you run multiple Web sites on your computer, but it also lets you store the files for those sites anywhere on your computer and not just in the C:\XAMPP\htdocs folder.
Adding a Virtual Host is a 2-step process:
  1. Add a new entry to your computer’s hosts file.
    hosts file can be used to point requests for a domain to a particular IP addressin other words, it lets you re-direct communications to a particular domain. In the case of a virtual host, it can tell the computer to NOT go out on the internet when you type a particular URL like http://clientA/, but instead look for that particular domain on your own computer.
  2. Edit the Apache configuration file to accept Virtual Hosts and define the particular Virtual Hosts you want to setup on your computer.
    The first step above, merely redirects requests from a particular domain to your computer, but this step prepares the Web server on your computer for handling those requests. In this step, you not only provide the name of the Virtual Host, but also tell Apache where the files for the site are located on your computer.

Detailed Steps

  1. Launch Notepad and open the hosts file located at C:\windows\system32\drivers\etc\hosts. (You may not be able to see the windows folder–some files are hidden by default under Windows. Here are instructions to make those files visible.)
    On Vista, you’ll also need to have access to change the hosts file. To do that, launch Notepad by right clicking on Notepad from the Start menu and choosing "Run As Administrator." This will give you permission to edit and save the file.
  2. At the end of that file type:
    127.0.0.1      clientA.local
    127.0.0.1 is how a computer refers to itself—it’s an IP address that points back to the computer, kind of like a computer’s way of saying "ME." The second part (clientA.local) is the "domain" of the virtual host. To visit this domain in a Web browser you’d type http://clientA.local. You don’t have to add the .local part to the hosts files—you could just as easily add 127.0.0.1 clientA and access the site in your Web browser withhttp://clientA—but I find it helpful for differentiating between a real Web site out on the Internet like clientA.com, and the test sites I have running on my own computer.
  3. Save and close the hosts file.
    That finishes the first part of this task. You’ve prepared your computer to handle requests to http://clientA.local. Now you need to tell the Web server, Apache, how to handle those requests.
  4. In Notepad open the Apache configuration file located at C:\xampp\apache\conf\extra\httpd-vhosts.conf
  5. At the bottom of that file add:
    NameVirtualHost *
      <VirtualHost *>
        DocumentRoot "C:\xampp\htdocs"
        ServerName localhost
      </VirtualHost>
      <VirtualHost *>
        DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website"
        ServerName clientA.local
      <Directory "C:\Documents and Settings\Me\My Documents\clientA\website">
        Order allow,deny
        Allow from all
      </Directory>
    </VirtualHost>
      
    The first five lines of code turn on the Virtual Host feature on Apache, and set up the C:\xampp\htdocs folder as the default location for http://localhost. That’s important since you need to be able to access the XAMPP web pages at http://localhost/ so that you can use PHPMyAdmin.
    The stuff in yellow represents a single Virtual Host. You’ll add one chunk of code just like this for each Virtual Host (or Web site) on your computer
    You’ll need to modify the stuff highlighted in blue. The first item — DocumentRoot — indicates where the files for this site are located on your computer. The second part–ServerName — is the name you provided in step 2 above: the virtual host name. For example, clientA.local. The third item — the <Directory> part — is the same path you provided for the DocumentRoot. This is required to let your Web browser have clearance to access these files.
  6. Save and close the Apache configuration file, and restart Apache from the XAMPP control panel.
  7. Start a Web browser and type a URL for the virtual host. For example: http://clientA.local/.
    You should now see the home page for your site.

More Virtual Hosts

If you want to add additional Virtual hosts add the proper entry to the hosts file and add another block of text like that in yellow above to the Apache configuration file. For example, say you had another Web site for ClientB. You’d add 127.0.0.1    clientB.local in the hosts file and the C:\xampp\apache\conf\extra\httpd-vhosts.conf would look like this:
NameVirtualHost *
  <VirtualHost *>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
  </VirtualHost>
  <VirtualHost *>
    DocumentRoot "C:\Documents and Settings\Me\My Documents\clientA\website"
    ServerName clientA.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientA\website">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
<VirtualHost *>
    DocumentRoot "C:\Documents and Settings\Me\My Documents\clientB\website"
    ServerName clientB.local
  <Directory "C:\Documents and Settings\Me\My Documents\clientB\website">
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
  

More Information


Source: http://sawmac.com/xampp/virtualhosts/

Thứ Tư, 26 tháng 12, 2012

Cài đặt DUC (No-IP) cho Ubuntu


How to install No-IP Linux Dynamic Update Client (DUC) on your Ubuntu 12.04 LTS.

Installing the Linux Dynamic Update Client (DUC) on Ubuntu is a very simple task.  The DUC package is already included in the source tree for most distributions of Ubuntu Linux; however, newer Ubuntu versions might need to use wget to install the DUC. You can try apt-get if this does not work please install the DUC with the steps listed under "How to install No-IP Linux Dynamic Update Client (DUC) on your Ubuntu 12.04 LTS."

From a command prompt you just need to enter this command:
  • sudo apt-get install noip2
Earlier distributions may need to replace the "noip2" with just "no-ip"

After entering the command, you will be prompted for the root/admin password for that machine.  If all goes well the package will be downloaded and installed on your computer.  On most systems you will then be prompted for your No-IP.com account information.  If so:
  1. Enter your username or email address
  2. Enter your password
  3. Leave 30 as the default for update interval
  4. Enter in a host name that exists in your account (do not leave this blank)
  5. Enter your network device name (example: eth0)

Thats it, the software will then configure itself and will launch at the next restart of the computer.  Below is a Youtube video created by one of our users that demonstrates the installation and setup.

http://youtu.be/dj5IwcJGyyE


How to install No-IP Linux Dynamic Update Client (DUC) on your Ubuntu 12.04 LTS.

You will be able to install No-IP.com’s DUC in just a few minutes with terminal. Once you have opened up your terminal window you will need to login as the “root” user. You can become the root user from the command line by entering "sudo -s" followed by the root password on your machine.
  1. cd /usr/local/src/
  2. wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
  3. tar xf noip-duc-linux.tar.gz
  4. cd noip-2.1.9-1/
  5. make install
You will then be prompted to login with your No-IP.com account username and password.

If you get "make not found" or "missing gcc" then you do not have the gcc compiler tools on your machine. You will need to install these in order to proceed.

To Configure the Client:

As root again (or with sudo) issue the below command:
  • /usr/local/bin/noip2 -C (dash capital C, this will create the default config file)
You will then be prompted for your username and password for No-IP, as well as which host names you with to update. Be careful, one of the questions is "Do you wish to update all hosts". If answered incorrectly this could effect host names in your account that are pointing at other locations.

Now the client is installed and configured, you just need to launch it. Simply issue this final command to launch the client in the background:
  • /usr/local/bin/noip2
Read the README file in the no-ip-2.1.9 folder for instructions on how to make the client run at startup. This varies depending on what Linux distribution you are running.

NOTE:  When installing via apt-get you may not always get the most recent version of the Linux DUC.  Our website will have the most recent version and it can take a few weeks after we release a new version for it to show up on apt-get.
Thank You

Source: http://support.no-ip.com/customer/portal/articles/363247-installing-the-linux-dynamic-update-client-on-ubuntu

Thứ Ba, 25 tháng 12, 2012

Cài đặt Synaptic Package Manager cho Ubuntu

Mở Terminal gõ:

sudo apt-get upgrade
sudo apt-get install synaptic

Cài đặt máy ảo VMware Player trên Ubuntu 12.04 (Precise Pangolin)


VMware Player 5.0 has been released and this brief tutorial is going to show you how to install it in Ubuntu 12.04 (Precise Pangolin).
This release brought many changes, including a fix to this annoying error that was found in earlier versions. "Unable to start services. See log file /tmp/vmware-root/mdconfig-23331.log for details"
If you have been following our tutorials installing VMware Player, you’ll notice that we used a work-around to resolve the bug above. Now you won’t have to apply that patch. Just download VMware Player 5.0 package and install.
Objectives:
  • Install VMware Player 5.0 in Ubuntu 12.04 (Precise Pangolin)
  • Enjoy!
To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to install these packages.
sudo apt-get install build-essential linux-headers-`uname -r`

vmplayer_precise_1

After that go and download VMware Player package from this site. You must be logged-in in order to download it. If you don’t have an account, register first and go download the packages.

After downloading the package, change to your download folder (cd ~/Downloads) and run this command to make the file executable.
chmod +x VMware-Player-5.0.0-812388.i386.bundle

vmplayer_precise_2

Finally, run the commands below to install VMware Player.
sudo ./VMware-Player-5.0.0-812388.i386.bundle

vmplayer_precise_3

Follow the wizard until you finish installing. After installing, go to Dash and search for VMware Player.

vmplayer_precise

Thứ Hai, 24 tháng 12, 2012

Thay đổi Default URL trong PhoneGap

Thay đổi đường dẫn đến file index.html thành URL ở file MyPhoneGapActivity.java trong thư mục src

Thứ Bảy, 22 tháng 12, 2012

Cài đặt Infinity Conky cho Ubuntu/ Linux Mint



Đầu tiên cần phải cài đặt Conky mới nhất bằng cách chạy dòng lệnh sau trong Terminal:

1
sudo apt-get install conky conky-all

Tiếp theo là script để giúp conky tự chạy khi đăng nhập hệ thống:

1
2
wget -O .start-conky http://dl.dropbox.com/u/37774222/LinuxViet/script/.start-conky
chmod +x .start-conky
 
Để kích hoạt, các bạn vào Dash và gõ Starup Applications, mở nó lên sau đó nhấn Add. Cửa sổ mới mở ra, kích vào nút Browservà duyệt đến thư mục USERNAME, bặt hiển thị file ẩn bằng phím tắt Ctrl + H. Sau đó chọn .start-conky và OK để kết thúc.


1. Cài đặt Infinity Conky cho giao diện Unity, Gnome Classic, Mate:

Các bạn chạy lần lượt những lệnh sau nhé!

1
2
wget -O conky-infinity-unity-1.zip http://url.linuxviet.info/conky-infinity-unity-1.zip
unzip conky-infinity-unity-1.zip
 

2. Cài đặt Infinity Conky cho giao diện Gnome shell và Cinnamon:

Thực những lệnh:

1
2
wget -O conky-infinity-gs-1.zip http://url.linuxviet.info/conky-infinity-gs-1.zip
unzip conky-infinity-gs-1.zip
 

3. Tùy chỉnh kích thước Infinity Conky:

Để tùy chỉnh lại kích thước của Infinity Conky, các bạn tìm đến dòng 40, 41 sau khi chạy câu lệnh:

1
sudo gedit ~/.conkyrc
 

Chúc các bạn thành công nhé!

(Theo Noobslab.com)

Hướng dẫn cài lại grub cho ubuntu

Giả sử máy bạn đã cài ubuntu , sau đó lại cài window 7 chẳng hạn
khi khởi động lại thì chẳng còn thấy ubuntu ở đâu mà chỉ có win 7

lý do :
- ubuntu cài trước nên grub chiếm mbr của hardisk
- window cài sau nên boot loader của window chiếm mbr , dĩ nhiên là nó đánh bật grub đi
- vì window hơi "dốt" nên menu khởi động nó ko cho ubuntu vào

bây giờ các bạn muốn dùng được cả ubuntu và win 7 thì sao ?

đơn giản là cài lại grub lên mbr

cách làm :

- bỏ đĩa cài ubuntu vào cd room, hoặc usb chứa ubuntu boot được (tham khảo thêm cách tạo boot linux từ USB)
- ubuntu boot từ cd room hoặc usb xong , vào terminal gõ lệnh sau


Bash Code:
sudo -i
mount /dev/sda5 /mnt
grub-install --root-directory=/mnt /dev/sda
sau 0.5 giây nếu ko trục trặc gì thì nó sẽ thông báo : finish installtion. No error reported !

vậy là ok ! . tháo usb,cd room ra. khởi động lại máy sẽ thấy grub, tuy nhiên vẫn chưa có window 7 trong grub ,cứ từ từ khoai sẽ nhừ

bạn vào trong ubuntu, gõ lệnh update grub trong terminal

Bash Code:

sudo update-grub

chú ý :

nếu ko biết phân vùng cài ubuntu tên gì thì có thể xem danh sách các phân vùng bằng cách gõ lệnh như sau


Bash Code:
fdisk -l

Sau đó nhìn sang cột system xem cái nào là kiểu linux thì đó chính là phân vùng cài ubuntu

Bash Code:
sudo fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0f700f70

Device Boot Start End Blocks Id System
/dev/sda1 * 1 9378 75328753+ 7 HPFS/NTFS
/dev/sda2 9379 38913 237239887+ 5 Extended
/dev/sda5 9379 13136 30186103+ 7 HPFS/NTFS
/dev/sda6 13137 25930 102767773+ 7 HPFS/NTFS
/dev/sda7 25931 35923 80268741 7 HPFS/NTFS
/dev/sda8 35924 38629 21735913+ 83 Linux
/dev/sda9 38630 38913 2281198+ 82 Linux swap / Solaris