Skip to main content

Posts

Showing posts from 2013

Protect your eyes with RedShift

If you are anything like me and spends a good amount of time on computer, your eyes may say you soon that "Hey! it's fantastic. Give me some comfort or else I'll take yours". You may soon face dry-eyes or sleeping dis-orders. Let's take some precautions to save them. Now I'm not gonna discuss something like don't stare without blinking your eyes or maintain some distance from monitor, but here is a way to optimize your monitors brightness automatically according to the time-of-the-day and temperature. Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night. To install it in Ubuntu: sudo add-apt-repository ppa:jonls/redshift-ppa sudo apt-get update && sudo apt-get install redshift To start the application, first find the coordinates of your location (lat:long). Then redshift -l lat:long (eg: redshift -l 17.033:55.20)

Java: Use BigInteger in for-loop

In my previous post , I mentioned a way to handle large integers by using BigInteger. Now I'm going to provide a very important usage of it. We often use for-loop. So here is the way to use it: Ordinary integers: for(int i = 1; i <= n; i++) {  //Task to do } BigInteger: for (BigInteger bi = BigInteger.valueOf(1);                 bi.compareTo(n) <= 0;                 bi = bi.add(BigInteger.ONE)) { //Task to do } here n is a BigInteger variable.

Java: BigInteger

Many of you might have wondered, as I did, how to deal with integers of say more than 50 digits or so. And might have thought about breaking the integer into parts or storing it in a string and parse letter-by-letter . Java provides a class for such large numbers: BigInteger . You can find it in the package: java.math.BigInteger We can do some operations like addition, subtraction, multiplication, division etc, but slightly in a different way. For detailed information on its usage, have a look at this .

Eclipse: No Applicable Items on File | New

Today I tried to a new project in eclipse and on clicking File>New>  I found <No Applicable Items> I'm not able to create any kind of project. Then I found a solution on ecipse discussion group. There are some selections in the IDE in the upper right corner; Java, JAVA EE and Resource etc. It was set to Java EE. When I selected JAVA, I can now create new projects again

OSX Mavericks for free

Today Apple released much awaited update cum upgrade OSX Mavericks as a free update. You can download it from App Store. Here is the list of new features: iBooks • Download and read books from the iBooks Store. • Pick up right where you left off. iCloud keeps your current page up to date across all your devices. • Swipe through Multi-Touch books with interactive features, diagrams, photos, videos, and more. • Keep multiple books open while using other apps — great for writing a paper or doing research. Maps • Send directions from your Mac to your iPhone and use voice navigation when you’re on the go. • Explore select cities in stunning, photo-realistic 3D with Flyover. • See detailed directions, real-time traffic, and alternate routes. • Find restaurants, stores, and other places of interest with local search in Maps. Calendar • Create new events in a snap with the new, streamlined event inspector. • Enter event locations fast with address autocompletion. • Add wa

New section on web development, plugins and templates

Hello guys, I planned to start this section a long back, but due to some of the reasons, which even I don't know, hadn't made it. From now onwards, along with the regular workarounds, tips and tuts, I would like to blog some of the good web development tutorials, plugins etc and also good templates I came across. So keep visiting...............

Ubuntu: Mount remote directories on a local machine

Today I'm searching for a way to mount a remote directory on my local machine, such that it acts like a local machine. The sole reason is to run the remotely compiled code locally. I've found a nice article on it and would like to blog it here. Here we go: Install SSHFS: sudo apt-get install sshfs Add root to the fuse group:  sudo adduser root fuse  Create the local backup director mkdir backup Then mount the remote /home directory to backup : sshfs -o idmap=user <username>@<remote system's ip>:/home backup Let's check if the remote directory got mounted to /backup : mount df -h To unmount the directory fusermount -u backup Check the backup folder to see your remote directory... Source : howtoforge

Java : Redirect/Write console output to a file

Sometimes we would like to save the output from console into a file and to do this we use some stream writer/reader to read from console and write to a file. But this can be done in much easier way as follows. Add the following code at the beginning of the program: PrintStream out = new PrintStream(new FileOutputStream("output.txt")); System.setOut(out); Now the default behaviour of out is changed to PrintStream out , and the output is redirected to the file provided above. Edit: To reset the standard behaviour, add the following code System.setOut(stdout);

Ubuntu : Bugs and workarounds

Quite often we ran into some bug on Ubuntu. Thanks to such a huge community which provides solutions to many of them. Today I found a thread which includes most of the bugs and their workarounds. Here is the link. Known Hardy bugs and workarounds

Ubuntu : Upgrade Git

Sometimes simply updating from "Ubuntu update" won't update/upgrade some of the required packages. We need to to it manually by adding necessary repositories. To upgrade git: sudo add-apt-repository ppa:voronov84/andreyv sudo apt-get update sudo apt-get upgrade sudo apt-get install git If the first command result in error "couldn't connect to host"

Ubuntu : Java alternatives

Ubuntu will include openJDK by default. If you install some other version or Sun JDK, then the first installation is set to be the default one. To check if there are any other java installations: update-java-alternatives -l Change the default to any of them: update-java-alternatives -s NAME-OF-IT

Ubuntu : Install Sun java 6

Ubuntu has dropped including Sun/Oracle Java in its repository, and added OpenJDK. But, the former is more reliable than latter, and is also must for some applications. Here is a way to add Sun java 6: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java6-installer Possible error : "couldn't connect to host" To make this version as default: here . If you want to install java 7, instead of last command try sudo apt-get install oracle-java7-installer If you are under proxy network or seen a error like Cannot add PPA: 'ppa:webupd8team/java'. Please check that the PPA name or format is correct. and if you are sure that the PPA is working, the try sudo -E add-apt-repository ppa:webupd8team/java and proceed with remaining commands.

Ubuntu : Error "couldn't connect to host"

This error will be resulted mostly because of the user permissions. To go through it, we need the simulate the initial login mode: sudo -i Now run the commands which resulted in the above error, but without prefixing with 'sudo'. Remember to go out of this mode after running your commands. To go out: exit

Ubuntu : Adding a new repository (PPA)

To add a repository ppa: sudo add-apt-repository ppa:user/ppa-name sudo apt-get update Sometimes adding a repository may result in error related to missing key. Then copy that key and run following command sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com KEY Do this for each of the missing keys. Now re-run the above two commands. If you are under proxy network or seen a error like Cannot add PPA: 'ppa:user/ppa-name'. Please check that the PPA name or format is correct. and if you are sure that the PPA is working, the try sudo -E add-apt-repository ppa:user/ppa-name

Ubuntu: Set Network proxy system-wide including Terminal

Set the proxy in "Network Proxy" setings and click "apply system-wide", and also at the following locations. Some terminal applications need them. sudo gedit /etc/apt/apt.conf.d/95proxies Acquire::http::proxy "http://username:passwd@proxy:port/"; Acquire::ftp::proxy "ftp://username:passwd@proxy:port/"; Acquire::https::proxy "https://username:passwd@proxy:port/"; sudo gedit .bashrc export http_proxy=http://username:passwd@proxy:port export https_proxy=http://username:passwd@proxy:port export HTTP_PROXY=http://username:passwd@proxy:port export HTTPS_PROXY=http://username:passwd@proxy:port Requires both CAPITALS and small ones. Some applications accepts only CAPITALS.

Openlogic : Open Source Software Database

Here is a open source software repository, which contains almost every version of the packages. This will be useful for all those who need any older version of the package, which sometimes is difficult to find. So, I'm sharing the link here: http://olex.openlogic.com/ Type the package name in search field and select the version you need.

Ubuntu : Mount a volume with ROOT privileges

My system is having multiple internal hard disks and due to some memory concerns I have to work on the second drive(hdd2). Then on visiting "/mnt/hdd2", I found entire drive  is protected by root. To change the privileges, I tried the normal way: sudo chmod 755 /mnt/hdd2 Result : NO CHANGE. Then tried sudo chmod a+x /mnt/hdd2 Result : NO CHANGE. No I googled I find: sudo chmod -R 755 /mnt/hdd2 Result : To my surprise NO CHANGE Here is the solution: sudo chown -R chaithanya:chaithanya /mnt/hdd2 Result : SUCCESS ('chaithanya' is the username).

Setting up / Working with Android Source code

1. Install Ubuntu 10.04, as the Android root is built on it. 2. Update the system - Run Update manager and install new packages 3. Update the system settings: Proxy (IF REQUIRED) Adding Repository 4. Install sun java 6 Install java Change the default version . 5. Installing required packages: sudo apt-get install git-core gnupg flex bison gperf build-essential \zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \libxml2-utils xsltproc 6. Upgrade git 7. Installing Repo: mkdir ~/bin PATH=~/bin:$PATH curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repo 8. Initialising a Repo client: mkdir WORKING_DIRECTORY cd WORKING_DIRECTORY repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 If any error saying "HTTP request failed", open file "~/bin/

Clean-up GRUB entries

Whenever a kernel update is installed, your system adds an entry into GRUB. And while booting you can see a very long list, depending on how many updates you have installed. Here is a simple way to clean the GRUB. Open Synaptics package manager. Remove "linux-image-2.6.xxxx" and "linux-headers-2.6.xxxx" corresponding to old kernel images. Update the grub using: "update-grub" If you wish to set a background image for your GRUB, then goto "/etc/grub.d/" and open the theme file(debian_theme) and set "use_bg=false" to "true". Change the WALLPAPER, to point to the desired image(Better use .png file). To apply the changes to the grub: "update-grub"

SVN Error: "OPTIONS of 'https://…' could not connect to server (…)"

Today when I tried to download source-code of an application from a repository on googlecode, an error saying "could not connect to server xxxx.googlecode.com" occurred. I thought the repository might have been down and not available for download. Then I tried the same URL in web browser and it worked. On searching for a while, I found that this problem is created by proxy settings. SVN needs the proxy settings, apart from that you applied system-wide settings. Then I came to know a solution which worked perfectly. Here it is: svn --config-option servers:global:http-proxy-host=MY_PROXY_HOST --config-option servers:global:http-proxy-port=MY_PROXY_PORT checkout http://xxxx.googlecode.com/yyyyy/ If the proxy server needs authentication, then try this: svn --config-option servers:global:http-proxy-host=MY_PROXY_HOST --config-option servers:global:http-proxy-port=MY_PROXY_PORT --config-option servers:global:http-proxy-username=USERNAME --config-option servers:global:http

Problems importing Android Source Code into Eclipse

Errors on the project build path when using Eclipse When I debug the framework source using Eclipse, there are some errors on the project build path. Error messages I saw are the following : Project 'Android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar' Project 'Android' is missing required library: 'out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar' Solution: Goto Project>Properties and libraries section and edit first one to "out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar"  and remove second one. Missing required library when import the android source 4.0 to Eclipse After this, the build path errors were gone, but I got about 200 errors referring to missing types. This could only be another classpath problem for Eclipse. Here are the extra libraries, that we have to add to the .classpath file: <c

System running in low graphics mode (nVidia)

This problem can be occurred at two instances. 1. Fresh installation: 1. Download the driver from nVidia website 2. Copy the file to the disk. (It looks like "NVIDIA-Linux-x86_64-319.17.run", depends on your version) 3. Now just type the following command from terminal:     sudo sh ./NVIDIA-Linux-x86_64-319.17.run 4. Follow the on-screen instructions and finally reboot. 2. Problem after upgrade: 1. Login into command prompt 2. Run the following command:     sudo sh ./NVIDIA-Linux-x86_64-319.17.run 3. It will ask to delete previous installation. Accept all the prompts and also the one to edit xconf file. 4. Finally it will reboot and system boots normally. After successful boot, you can configure your driver in the System>Preferences section. Other work-arounds: 1. When prompted the low graphics mode, select the "Restart X" option. This will work in some cases. But every time you boot, perform the same. 2. Also try blacklisting "nouveau

Setting JVM Heap size at runtime

To set the JVM heap size, compile the program normally. For example, consider Runtime.java program. Compilation: javac Runtime.java Now, to set minimum heap size(let, 16 MB) required by JVM, run the program as follows : java -Xms16m Runtime  We can also restrict maximum size(let 512 MB) utilized by JVM: java -Xmx512m Runtime  Both these options can also be combined to specify upper and lower bounds of JVM heap size: java -Xms16m -Xmx512m Runtime Now you can run a program that requires huge computational space.

Fotor Windows 8 app - photo editing tool

Looking for a app can do your work better with little/no effort, then here it is. Fotor is the best all-in-one photo editing application! Perfectly combine the windows 8 user experience with cutting-edge tools including Basic Editing Tools, Brilliant Visual Effects, Frames, 1-Tap Enhance, Collage, Text, Tilt Shift and Raw Converter, all bundled together in one powerful package!  Fotor Windows 8 app - photo editing tool Features : Collage :  Enjoy the freedom to arrange your pictures however you want with three different modes of collage: Template Collage, Photo Stitching and Shuffle Collage. Add Text : Input plain text or choose a stylish text template, personalize your photos by adding your own commentary, thoughts and messages for others to see, or just add notes to help you remember.  Raw Converter : RAW converter with tone mapping supports over 100 camera RAW formats. Import the RAW files and Fotor will take care of the rest. Powerful Editing : Fotor contain

Fresh Paint - Windows 8 app

I recently found this great app, really superb. Give it a try. Here is the official description: Meet Fresh Paint – a delightfully realistic and fun painting application for you and your family. Fresh Paint is an easy-to-use, free app that includes oil paint and all the tools you need to paint. Whether you are an aspiring artist, parent or child (or child at heart), Fresh Paint will help you unleash your inner creativity. We believe that brilliant, creative ideas can come from anyone, anytime. It’s time to set your creativity free. Welcome to Fresh Paint – the canvas for your big ideas. Features Experience highly realistic oil paint. It works just like real oil on a canvas, but just a little easier. Paint without the mess, clean-up and costly supplies. Help your kids be creative and explore their imagination. Blend and mix paints to get just the colour you want. Turn your photos into paintings with Fresh Paint. Import a photo, and then just brush and blend the colour

Dial-up connection using Command prompt

Connecting to internet using mobile partner or some other program is simple. But it consumes your system resources(around 200 MB of RAM). You can simply save your resources by using command prompt. This method is applicable only on Windows platform. First, install the device driver and create the dial-up connection, or just install the mobile partner(or software that came along with your modem) and connect using it(it will automatically create the dial-up connection). now you can exit that program. Here is the procedure to connect using command prompt: Open command prompt Type the following command rasdial "CONNECTION NAME" Ex: rasdial "TATA DOCOMO INTERNET" To disconnect, rasdial "CONNECTION NAME" /Disconnect You can also automate this process by creating batch file. Connect Open any text editor and copy the following code :Redial rasdial "CONNECTION NAME" if %errorlevel% == 0 exit goto Redial; Replace the CONNECTI

Keyboard keys not working

Recently I faced an issue with my laptop keyboard. Some of the keys are not working. As it is still under warranty, I thought of replacing the keyboard. When I contacted customer support, after listening to the problem he asked whether I tried DRAINING. Then he explained me the procedure, and guess what - it's working perfectly again. Here is the procedure of DRAINING: First shut down the laptop/notebook Remove the battery Also unplug the adapter Now press and hold the power button for about 25-30 seconds Insert the battery again Now power on the laptop by pressing power button(normal booting) Now your keyboard will work again normally. If the problem still persists, consider replacing the keyboard.

Porting LEWA ROM to any device(NOOBS guide)

PREREQUISITES : adb- This will help you out in deadly conditions winRAR - For opening zip files Notepad++ - For editing text ROMS YOU WILL NEED : Base ROM : CM7/MiUi/old Lewa(didn't tried on stock rom) For Your Device LewaOS ROM : Get it from official site. STEPS TO PORT : Open both ROMs using winRAR in two windows..No Need To Extract Go to '/system' and delete '/system/app', '/system/framework' and '/system/media' folder from Base ROM (CM7) Copy '/system/app' , '/system/framework' and '/system/media' folder from LewaOS to Base ROM. Copying can be done by simply drag and drop between the winRAR windows   Go To '/system/bin' of Base ROM --Copy all files present in '/system/bin' to LewaROM. --Now from LewaROM copy all files from '/system/bin' folder to '/system/bin' of Base ROM --This replaces all existing files of same name and adds missing files   Go To '/system/e

No bootable device Insert bootable device

Don't get panic when you see this thing, and also don't consult customer care or some other repair shop to waste some bucks. Usually this error will be found when you made a unsuccessful attempt of dual booting your Mac with Windows. To fix this error, restart your Mac and hold down  option key, after hearing chime on booting. If you don't want to install windows, then select the Mac Recovery partition. Then from the menu on the top, select the boot disk option and select the drive in which Mac is present. Restart and enjoy... If you wish to install Windows, then insert bootable disk and select the Windows partition that you had created using boot camp, and proceed with installation. In both cases you will be able to boot normally.

Windows 8 Metro Apps Proxy settings

Case 1: If you are on a internet connection that doesn't require any proxy settings, everything works fine. Case 2: If your internet connection requires some proxy settings(without authentication), then try this method: Open internet explorer and set the proxy under Internet Options>Connections>Lan Settings. Now open Command Prompt with Administrative privileges(On start screen type "command prompt", right click on the command prompt app and click on "Run as administrator" which is visible on the bottom of the screen). Now type the following command and press enter. netsh winhttp import proxy source=ie Restart the PC and check out. Case 3: If your internet connection requires some proxy settings with username and password, then try this method: Install fiddler Now please install this addon Open fiddler and click on Win8 config, then click "Excempt All" Restart your system Set the proxy details in proxyfier or proxyfire Alwa

Activate Windows 8 Enterprise Using key

I tried to activate my Windows 8 Enterprise, and to my surprise I can't find a way to enter the product key. I later found this method to be useful. First open the command prompt. To do so, press Windows + r key and type cmd and press enter, or just press Windows key and type command prompt and hit it. Now type the following command and press enter: SLUI.EXE 3 Now you will see a window prompting you to enter the key. Enter the key and press activate. Bingo...

Windows 8 - Safe mode

Safe Mode is a great way to get into your system when something won't allow you to start up normally. Troubleshooting becomes a breeze when corrupted drivers and files aren't loaded that prevents a system from functioning. It used to be as easy as pressing F8 when the system starts up, but doing so with Windows 8 will take you to Automatic Repair Mode. The trick to getting back to good old fashioned Safe Mode? Hold down the Shift key and press F8 while booting up. This takes you to the Recovery mode. Select "advanced options," then "troubleshoot," then the "advanced options" again (there are a lot of advanced options). Select  Windows Startup Settings  and finally the  Restart  button. This will reboot the computer and give you the option to boot into Safe Mode. If you need to get into Safe Mode from within Windows, open the dialog box (the Windows key + R) and type " msconfig " (no quote marks). Select the  Boot  tab and check the

Shutdown shortcut for Windows 8

Create a shortcut on your desktop (right-click, go to  New,  then  Shortcut ). Enter "shutdown.exe /s /t 00" as the location of the item, and press  Next . Now name the shortcut (prefereably "Shutdown") and press  Finish . Right-click the shortcut, and navigate to  Properties . Choose  Change Icon  in the Shortcut tab, and then  OK  to leave the warning box. Choose an icon of your choice from the list. In the screenshot above, you'll see we chose a Power button. Right-click the shortcut again, and select  Pin to Start . You can place the icon on your Start screen wherever it's convenient. Clicking it will instantly shut down your computer. For shutdown : shutdown.exe /s /t 00 For restart : shutdown.exe /r /t 00 For Hibernating: shutdown.exe /h

Boot directly to the desktop in Windows 8

One of biggest complaints about Windows 8 is that it boots straight to the Start screen—an annoyance for many committed desktop users. To boot into the Desktop directly, just follow this simple procedure. Go to the start screen and type in schedule to search for Schedule tasks in Settings. Click on Task Scheduler Library to the left, and select Create Task . Name your task something like "Boot to desktop." Now select the Triggers tab, choose New, and use the drop-down box to select starting the task "At log on." Click OK and go to the Actions tab, choose New, and enter "explorer" for the Program/Script value. Press OK , save the task, and restart to test it out!

Windows 8 : Customise the Start screen

The Start Screen is full of nice, big, chunky tiles that represent all your apps. The tiles are easy to see in small groups, but what if you have hundreds of apps installed? Most will be hidden from view, unless you want to do a lot of scrolling. Enter the new semantic zoom feature. If you’re using a touch display, squeeze the Start screen with two fingers to receive a bird’s eye view of your entire screen contents. And the feature is also available to mouse and keyboard users: Simply hold down the Ctrl button, and use your mouse wheel to zoom in and out. Also holding Ctrl button and pressing + or – will work. Categorize your apps  Your Start screen can become a cluttered mess if you collect too many apps and other elements that have been pinned to the screen as tiles, so take advantage of built-in organization tools that let you divide everything into labeled groups. First, drag all the tiles you want to assign to a single group to the far right-hand side of your St

Windows 8 Shorcuts

Using Windows 8 is painful unless you are on a touch screen device. If you feel Windows 8 is really complicated and it’s hard to find the things on it, then you must try some shortcuts instead of moving your mouse here and there and keeps on clicking to find them. Here is a list of shortcuts you might find useful: Press the Windows key to enter the tiled Start screen. When on start screen, to search a setting or file or app, just type its name. If you are in Desktop mode, just press Windows Key and start typing. Windows Key + C: Displays Charms menu. Windows Key + X: Brings up a menu of advanced system options, including Windows Control Panel, Command Prompt, Task Manager and File Explorer. Windows Key + I: Displays the Settings menu for the current app. For example, if you’re in Internet Explorer 10, this key shows Internet options. If you’re on the Start menu, it shows general OS settings. Windows Key + Q: Brings up the apps search menu that allows you to search yo