Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Wednesday, 18 February 2015

My tools for competitive programming in java

Many programmers prefer to compete in online programming competitions by submitting solutions using Java. But one might wonder what tools are best for competitive java programming. Here i am revealing the tools i use for competitive java programming :


  1. Eclipse
  2. Vrapper
  3. Java SE Development kit (jdk)
  4. TCF Terminals
Features/benefits of this configuration are :
  • All benefits of Eclipse such as :
    • Code Recommenders
    • Intelligent importing
    • Error highlighting
    • Warnings
      and much more.....
  • Enhanced efficiency with VI editor capabilities added to eclipse via Vrapper
    Vrapper can be installed inside eclipse as a plugin and it is one of the best plugins to add VI features to eclipse. Having Vrapper means you have all the power of VI editor.
  • By ensuring the that jdk is installed you can run the 'javac' command and 'java' command right from the command prompt or terminal.
  • By using the terminal for compilation and execution gives you the power of directing stdin input from a file and also stdout output to a file. These features are not yet available in eclipse luna. Ironically this feature is very helpful in studying large outputs and inputs and debugging.
Steps for using the environment
1. Create a new java project with any name.
2. In package explorer, right click on its 'src' package and add new class to it. In the New Java Class dialog make sure to set package field empty i.e. default package.
3. Now write your program in the class created in step 2.
4. To run this program make sure jdk is installed properly and the 'javac' command runs properly in the terminal/ command prompt. Now open the terminal/command prompt, compile and run the program using the following command :
javac Solution.java && java Solution <in.txt> out.txt
where  Solution.java is the file name in which code is written and the second command 'java Solution' (where Solution is the name of the class in .java file) runs the compiled program taking input from 'in.txt' in the same folder where Solution.java exists and writes output to out.txt in the same folder

Note that this environment can be setup on all popular OS platforms.

Wednesday, 19 February 2014

Running 32-bit eclipse ADT in 64-bit ubuntu 12.04

Here are the steps to safely install Android SDK on ubuntu 12.04 and avoid any errors.
1. Install eclipse Android SDK on 64-bit linux as directed                   at https://developer.android.com/sdk/installing/index.html.
Now eclipse will run fine but when we try to launch AVD emulator it may throw an error :
Cannot run program “ xx/sdk//tools/emulator”: java.io.IOException: error=2, No such file or directory
Info :
This is very common on 64-bit linux with a very simple solution.
mentioned at https://wiki.debian.org/Multiarch/HOWTO
solution according to them is :

Installing Android SDK compat libraries


Some users using the Android SDK might encounter problems when trying to run build-tools or platform-tools on amd64 bit platform. As replacement for ia32-libs, users should be fine just installing the following libraries:
dpkg --add-architecture i386
aptitude update
aptitude install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386
 But this is not the solution for ubuntu 12.04 users
 because "--add-architecture" is not supported with the dpkg version (1.16.1.2 (amd64)) supplied with ubuntu 12.04. Thus we have to do the same thing in another way. Here is how :
Solution :
make sure the only file present in /etc/dpkg/dpkg.cfg.d/ is "multiarch"
ls /etc/dpkg/dpkg.cfg.d/
if output is multiarch, execute the following commands as it is else replace "multiarch" with the name of file present in that directory.
sudo sh -c "echo 'foreign-architecture i386' > /etc/dpkg/dpkg.cfg.d/multiarch"
The above commands will add i386 architecture (alternate command to "dpkg --add-architecture i386") . The rest commands are the same (you can use aptitude instead of apt-get if you have aptitude installed)

sudo apt-get update
sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 
 Run the above commands and you're done! The emulator should work fine now.

Tried On : Ubuntu 12.04 + eclipse+ADT Build : v22.3.0-887826
May also work on : Ubuntu 12.04 and later versions , but note that for versions later than 12.04 , the first official solution mentioned in this post is easier.

Featured Post

PHP EmailMessage class for extracting attachments

Hi, recently I had to create a php program which fetches emails with attachments (including inline). I searched a lot and succeeded with h...