Showing posts with label How to. Show all posts
Showing posts with label How to. Show all posts

Saturday, September 15, 2012

[How to] Install Linux on Android?

As both the Linux and Android OS are open sourced, developers have enjoyed success in porting Linux on to Android and vice versa. Lots of efforts are still going on in this space. Canonical has been busy working on Ubuntu on Android which enables Android devices to run Ubuntu. “Linux on Android” is another awesome project which helps you to install and run a wide range of Linux distros on your Android device. An Android app has been released as part of this project which will guide you through the installation process. I tried it out myself on my Galaxy S2 and the process was very straight forward. Using this app, you will be able to install any distro as this just ‘chroot’ into the Linux image. This technique will run a virtual Linux on top of the Android OS without disturbing your Android OS. You could still use other apps installed on your Android device. We could replace Android with Linux completely but then you wouldn’t be able to use your Android phone as a phone anymore.

Pre-requisites:

  • Android 2.1 or higher. You need to have at least 3.5 GB of free space on your SD card. You can run Linux from internal SD cards as well.
  • Root access. You must have an Android device with Root access.
  • Support for Loop devices. Your Android OS must support loop devices. The stock image on Galaxy S2 didn’t have the support for loop devices. I have flashed the MIUI ROM with a kernel which supports loop devices. 

Steps to install Linux on Android

  • Download and install “Complete Linux Installer” app from Play store. Also, install VNC Viewer and Terminal App from Play store.
  • Launch the application “Complete Linux Installer”. This will guide you through the download links for different Linux distros.
  • Download the image and place it on your sdcard. By default, the launcher looks for the image directly on the sdcard (for ex: /sdcard/ubuntu). This can be configured from the launch menu. You can create a new launch configuration by specifying the image location and a name to it.
  • Select the configuration which you want to launch. This will open up the Terminal app with the chosen Linux image (say Ubuntu) mounted. If everything goes well, you should see this message “root@localhost:/#” on the terminal. This terminal will act like a Ubuntu command line. You can connect to the GUI from any of your favorite VNC viewer app (either on the same device or other devices).
    • You will be prompted for the root password, screen size and other options while mounting the Linux image.
    • If your kernel doesn’t support loop devices, you will get appropriate messages in this phase.
    • If you don’t have sdcard on your device, you might get some mount errors. You can ignore the errors (close the terminal) and re-connect to the mounted device again.
  • You are done. I have tried both LXDE and Unity desktops on S2 and both worked reasonably well.

Terminal Emulator with Ubuntu mounted

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - LXDE desktop

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - LXDE desktop

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device - Unity

VNC Viewer app running on Galaxy S2 connected to Ubuntu running on the same device

VNC Viewer running on Mac connected to Ubuntu on Android

VNC Viewer running on Mac connected to Ubuntu on Android

More information about “Linux on Android” can be found here.

-- Varun

Thursday, February 24, 2011

[How to] Setup a Personal Project Repository for free

If you are working on an open source project, there are many places where you can host your project. Some of the popular ones are Google Code, Github, etc. Google Code includes SVN and Mercurical as SCM system. However, if you are working on a personal project and don’t want to open your code yet, there are very limited options left for you. One of the popular free hosts is Beanstalk which offers you 100 MB space, 1 user and 1 repository. Github offers private repository but its little expensive. Here is a tip for you to setup your private repository using free cloud-based file hosting services like Dropbox, SugarSync, etc. Note: I will be using SVN for explanation in this post. You can use any versioning system of your choice.

Personal Project Repository on the Cloud

Setup private repository on the cloud

  • Create your SugarSync account. Setup an account with Dropbox or SugarSync (Referral links). Dropbox offers 2 GB free storage where as SugarSync provides 5 GB and you can sync multiple folders with SugarSync. The rest of this post assumes that you have a SugarSync account and have installed SugarSync desktop application. Note: Both Dropbox and SugarSync have their in-built versioning system but you can not enjoy all the features of an SCM like branching, merging, etc.
  • Creating the repository. Create a folder named “Repositories/<your_repo_name>” within your synced folder. Then, create a SVN local repository in the same folder. You can use any of the SVN clients to do this. I have used TortoiseSVN to create repository.
  • Committing the code. Now that the local repository is ready, you can start committing the code / any file to the repository just like any other repository. The only difference will be accessing the repository via file:// protocol. As you commit the files, the repository will be synced on the cloud. It is important to understand that only the committed files will be synced on the cloud.
  • Syncing Work / Home setup. If you are working on multiple computers, you can setup SugarSync / Dropbox sync from all the machines. If you commit on one computer and then commit on another before SugarSync/ Dropbox has synced the files, you may end up with a corrupted repository. To maintain the sanity of the repository, please ensure that the files are synced before committing the files. 
  • Team Collaboration.  There are two options for you to collaborate with your team. Frist and the simplest one is to share the repository folder in Windows. Your peers can also access the shared repository via file:// protocol. The second option is to setup a local SVN server using tools like VisualSVN Server. This will help you setup a repository as well as providing HTTP access to your repository. There is also a third option but I don’t recommend using that. You can share the repository as a folder on SugarSync / Dropbox. Your peers will be able to sync the folders locally and commit the changes to their repository and it will be synced on the cloud. Be aware that using this method may corrupt your repository.

-- Varun

Tuesday, January 25, 2011

[How to] Setup Google I/O style animated Countdown clock

Google has just launched the Google I/O 2011site and the registrations will commence soon. The agenda shows that a lot of interesting sessions have lined up for the event. To add to all these fun, Google has added a cool animated clock on the home page which will count down to the event date. Vic Gundotra from Google tweeted about the event page on his twitter few hours back. As soon as I saw the animation, I got excited and started digging into the implementation details of the same. To my surprise, Google has not obfuscated their JavaScript as they generally do with their animated doodles. Hence, reverse engineering the counter became an easy task. I have setup a count down clock for the ICC Cricket World Cup 2011 which is happening in India next month. Check it out here.

Countdown clock on Google I/O 2011 site

Steps to setup the counter

  • Box2D JavaScript port has been used to bring in the explosion effect. Box2D is a 2D rigid body simulation library for games. You can use it to make objects move in believable ways and make the game world more interactive. More info here.
  • Download all the necessary JavaScript files – base.js, box2d.js, io.js
  • Change the variable “countdownTo” to the date you are counting down to.
  • Include the JavaScript files in the HTML file and write script to initiate the counter. Smart developers always look at the source. You can look at the source of the demo page here. Or, visit this page to have a look at the HTML used in the demo page.

-- Varun

Thursday, December 30, 2010

[How to] Change the boot screen animation on Android

Smartphones are getting smarter day-by-day with cool new features. Still the best part of any Smartphone is its support for personalization. Android allows you to personalize almost anything and everything on your device. Boot screen animation is no exception. If you are bored with the default boot screen animation on your Android device, you can change it to the one you like. Here is a short tutorial to create new animations or use your favorite video as a boot screen animation. Android boot animation is stored as a zip file (uncompressed) containing the sequence of images used for the animation and a text file containing the meta-information.

 Boot screen animation Sample desc file - desc.txt

Steps to create boot screen animation

  • Preparing the image sequence. Create the animation using multimedia software like Flash. Turn the animation into a sequence of images and name them as “boot_0001.png”, “boot_0002.png”, etc. Flash has the capability to generate image sequence for the animation. To use a video sequence as animation, extract the image sequence from the scene using tools like FFmpeg for windows.
  • Place the images in two directories – part1, part2. The sequence copied inside part1 will be played only once where the one in part2 will be played on a loop until the booting is complete. (This is the commonly used configuration and can be altered via the meta data file)
  • Preparing the meta data. Create a text file and name it as “desc.txt”. This file contains two or more lines of information.
    • First line contains three numbers - width, height and the frames per second. Ex: 480 800 32
    • All the lines except the first one will start with the letter “p” indicating that it is a part of the animation. The line contains three items – count (number of times this part is repeated), pause (number of ms to pause after the last frame of this part), and the path to the directory. Ex: p 1 0 part1. Sample description file is shown in the screenshot above.
  • Packaging & installing the animation. Now that the images and meta-info file are ready, we need to package them into a zip file named “bootanimation.zip”. Note: There must be no compression. Once the zip file is ready, push the file to /data/local/. “adb push bootanimation.zip /data/local/.”. Reboot your device to see the new animation.

-- Varun

[via @xda-developers]

Saturday, December 18, 2010

[How to] Setup a mobile version for your blogger blog

Google is taking its battle with Wordpress to the next level with the introduction of mobile optimized blogs. Undoubtedly Wordpress is the supreme full-featured blogging platform when compared to Google’s Blogger but Blogger is closing that gap by adding lots of features this year. Some of the cool features introduced this year include static pages, real-time stats, dynamic template, spam filtering, etc. The latest addition to that pack is Mobile templates (Available only in Beta). Enabling this feature will offer a mobile optimized version of your blog.

How to enable mobile templates

  • Open http://blogger.com from your browser. Go to the dashboard. It will list all your blogs.
  • A popup will appear asking you to enable Mobile templates. Click on “Turn on mobile templates”
  • Alternately, you can click on the “Settings” option of the blog and go to the tab “Email & Mobile” to enable / disable the mobile templates.
  • You can access the mobile version by pointing your mobile browser to “<blog_address>/?m=1” (Ex: http://blog.varunkumar.me/?m=1). QR code for the same will be shown as soon as you enable the mobile templates.

Blogger Mobile Template

Blogger Mobile Template

How to setup a custom sub-domain

  • After enabling the mobile template, you may want to setup a custom sub-domain to point to the mobile version. Most of the sites use m. as the sub-domain.
  • You can achieve this by setting up an URL forwarding from your domain manager. If you have bought the domain from godaddy.com, you can follow the instructions here.
  • Add sub-domain ‘m’ and forward it to your mobile blog address.
  • Now, share this mobile address with your readers.

Forwarding Sub-domain-- Varun

Monday, November 29, 2010

[How to] Lock applications on your Android device

Smartphones are getting smarter day-by-day with cool new features but the major concern with them is the privacy. From your smart phone, you might want to access your personal mail accounts, bank accounts. etc. Are they safe? Though Android supports different ways of screen locking security options (Pattern, Pin, Password), they work as a master key for the entire device. ES Security Manager is a free app which helps you to keep your private data and apps safe.

ES Security Manager

ES Security Manager - Pattern

Steps to password protect your app

  • Install ES Security Manager from the Android market. If you use App Brain for managing your applications, install it from here.
  • Open the application. It offers three services:
    • Application Protector – Adds password to protect app privacy.
    • Threat Detector – Detects if there are any threats on your system.
    • Remote Locker – When phone is lost, lock it remotely, get its location,contacts,SIM card info,SMS back.
  • Click on ‘Application Protector’. You can either use a password or a pattern to lock your application. Choose a password or pattern.
  • Lock the applications you wanted to protect. Whenever someone opens the locked application, he / she will be prompted to enter the password.
  • ES Security Manager helps you to keep your private data and apps safe.

-- Varun

Sunday, November 21, 2010

[How to] Install Android market on Emulator

Android Emulator is a virtual mobile that is packaged along with the Android SDK. It runs on your computer and can be used to prototype, develop and test applications without having to buy a physical device. Almost all of the hardware and software features of a typical mobile device are mimicked in the Android emulator. However, if you want to try out some apps from the Android market, you can’t do that with the emulator as it does not include ‘Android market’. Here is a step-by-step guide to enable Android market in the emulator.
Steps to enable Android market in the emulator
1. Download and install the latest Android SDK (Android 2.2, API 8, revision 2) from here. This comes up with all the tools needed for development and testing of your application. Make sure the driver ‘ADB interface’ is installed on your machine. In most of the cases, the driver will be installed directly once you plug-in the device. [The SDK installation location will be referred to as SDK_LOCATION in the rest of the article]
Android SDK Setup2. Next step is to create a Android Virtual Device. Select ‘Virtual Devices’ from the left pane of the Android SDK and AVD Manager. Create a new virtual device with the details mentioned in the screenshot below. The screen might be frozen for few minutes while the virtual device is being created. Android Virtual DevicesAndroid Virtual Device3. After the device is created, go to the location ‘%userprofile%/.android/avd’. You will find a folder named ‘DemoDevice.avd’. Copy the system image ‘system,img’ from ‘SDK_LOCATION/platforms/android-8/images’ to the folder 'DemoDevices.avd’.
4. Start the emulator specifying the partition size. From cmd: emulator –avd DemoDevice –partition-size 100. (100 MB will be allotted for user space). Emulator opens up and it looks like the one below. Note: If the command emulator is not recognized, add SDK_LOCATION/tools to the PATH variable.
Android Emulator 5. From cmd, execute ‘adb pull /system/build.prop .’. This will copy the file build.prop to your current working directory. Open it with your favorite text editor and change the property ‘ro.config.nocheckin=yes’. This is needed to fix the freezing of market downloads. Related article.
6. Now, we have to push back the modified build.prop. This is not as easy as pulling it out. First, you have to mount the /system partition in read-write mode. Check out this to know how to do that. After the partition is remounted, execute the adb push command to push back the build.prop ‘adb push build.prop /system/.
7. The next thing is to install the Market application. Download ‘Vending.apk’ from this thread. Google Services framework is a pre-requisite for Android market. To get ‘GoogleServicesFramework.apk’, download upload.zip from here and extract the zip to find the .apk file inside /system/app. Download 'GoogleServcesFramework.apk' from here. Push both these .apk to the device. ‘adb push Vending.apk /system/app/.’ ‘adb push GoogleServicesFramework.apk /system/app/.’. Also, delete the  SdkSetup.apk from the device. ‘adb shell rm /system/app/SdkSetup.apk’. Make sure the SdkSetup.apk is deleted otherwise the emulator will be reverted back to its original stage.
8. Close the emulator. Delete the images userdata.img, userdata-qemu.img and cache.img from ‘%userprofile%/.android/avd/DemoDevice.avd’. Start the emulator again from Android SDK and AVD Manager. Android Market will be available on the emulator now. On opening the market, you will be prompted to connect with your Google account. Connect with your Google account and install your favorite apps on the emulator.
Android emulator with Android MarketConnecting to Android market with Google AccountAndroid Market Terms of ServiceTop free games on Android marketSolitaire installed from Android Market
Note: Installation of apps from Android market seems to be very slow in the emulator. Market app crashed couple of times before I get the chance to install the apps. Also, I could not find the most popular Android game ‘Angry Birds’ in the market. Installing the same from its .apk didn’t work either. I am trying to tweak the emulator to make it work smoothly with Android Market. If you have any tips for the same, please post them as comments here.
Update: Uttam Hoode has tried this approach with Android 2.3 SDK and it worked fine.
-- Varun

Friday, November 19, 2010

Auto-Tweet your Google Reader Shared Items without using any third-party services

Google Reader is one of the most popular Atom and RSS feed aggregator service from Google. It allows you to share the articles you like with your friends (followers). You may want to link your Twitter account with Google Reader so that whenever you share something, the same will be shared on your Twitter stream as well. I wrote a script back in Jan 2009 to semi-automate the same. But, the script has stopped working as Twitter supports only OAuth authentication now. There are lots of third-party apps / plugins available to do the same. But, you will have to connect to those services with your Google / Twitter credentials. Here is a simple way to auto-tweet your Google Reader Shared Items without using any third party service.

Steps to Auto-Tweet your Google Reader Shared Items

1. Feed Discovery. Whenever you share items on Google Reader, you will have a Public atom feed associated with your account. To know your feed URL, go to “Your stuff” > “Shared Items”. “Your Shared Items” page will open up. Click on the “show details” link at the right top corner. Details will show the Feed URL associated with your shared items. Note: Make sure your items are public. Click on the “sharing settings” to change the settings of your shared items.

Feed Discovery Feed Discovery

2. Burning your Feed. The next step is to burn your feed. You can use Google’s FeedBurner. Go to http://feedburner.google.com. Copy / Paste the Feed URL (from step#1) in the ‘Burn a feed right this instant’ text box. Click on ‘Next’. In the next screen, FeedBurner will ask you to provide the feed title and an address for the feed. After providing the details, click on ‘Next’. FeedBurner will burn the feed for you. It will show a screen to setup FeedBurner stats. You can do it later. Click on ‘Skip directly to feed management’.

Burning the feedFeed Title & Address

3. Linking with your Twitter Account.  The last step is to link your Twitter to the feed which is just burnt. Go to the ‘Publicize’ tab and select ‘Socialize’ option from the sidebar. Click on ‘Add a Twitter account’ button. This will open the Twitter page asking you to sign in to Twitter if you have not signed in already. Then, it will ask you to authorize access to your Twitter account for Google. Allow access to Google. After adding the Twitter account, you can configure few settings like formatting options, item count, items filtering, etc. After choosing the desired setting, click on ‘Activate’ to activate the service. That’s all. FeedBurner will periodically check for new feeds from Google Reader shared items and post them on Twitter stream automatically. Note: Your twitter account is linked directly with the Google account without having to use any third-party service. FeedBurner - Socialize Settings

This is what I would recommend – Read it on Reader, Share it on Twitter. Enjoying reading and happy sharing.

-- Varun

Tuesday, November 16, 2010

[How to] Turn off Google Instant Previews

Google launched Instant Previews few days ago – a feature which adds screenshots along with the search results. Though they claim that Instant Previews will help the users to find the results more precisely, personally, I found this feature to be annoying. Unfortunately, there is no option available yet to turn off “Instant Previews”. Turning off “Instant” search feature has no effect on “Instant Previews” either. I am surprised that not many technical journalists have raised concerns about this UI clutter so far. I have written a simple script to toggle the Instant Previews.

Toggle Instant PreviewsHow to Install?

Compatible Browsers: Firefox 3+, Chrome 4+

Firefox

  • Install the GreaseMonkey add-on for Firefox from here and restart the browser.
  • Get the script by pointing your browser to this.
  • GreaseMonkey Installation dialog box will appear. Please click on the “Install” button.
  • You are all set to use the script. Open Google and perform a search. Click on the link “Disable Instant Previews” at the right top to disable the Instant Previews.

Chrome

  • Chrome has native support for GreaseMonkey scripts.No additional extensions are needed to use the script.
  • Get the script by pointing your browser to this.
  • You will be prompted with a security alert. Please click on the ‘Continue’ button.
  • The script will be installed as an extension. Open Google and perform a search. Click on the link “Disable Instant Previews” at the right top to disable the Instant Previews.

Please write to me if you find any issues with the script.

Update:

New version (V 1.1) is available now.

  1. Instant Previews will be disabled by default.
  2. Remember 'Instant Previews' setting across sessions. For e.g., if you have disabled the Instant Previews in the current session, the same setting will be remembered for the next session as well.

Userscripts.org seems to go down frequently these days. Here is an alternate link to the script.

-- Varun

Sunday, November 7, 2010

[How to] Use your Android Phone as a web cam for your laptop?

There are lots of applications available in the Android market to use your Android phone as a web cam for your laptop. Android application “USB Webcam” has been my personal favorite so far. But, the “USB Webcam” project is sort of dead now. “DroidCam Wireless Webcam” is another application which comes close to “USB Webcam”. It works over WiFi and streams your phone’s camera output to your computer. DroidCam allows you to configure the camera settings - Width, Height and Frame rate. However, the video quality of DroidCam is not as good as USB Webcam.

DroidCam

DroidCam Settings

Steps to setup your Android phone as a webcam:

  1. On your phone, install the application “DroidCam Wireless Webcam” from the Android market. The size of the application is around 100 KB.
  2. On your PC, download the latest version of Windows component from here. Extract the zip file and execute the installer file (DroidCam.exe). Admin privileges are required to install and register DroidCam windows driver. Open any application (for eg Skype) that uses WebCam. This will automatically start the windows component. You may have to disable your Firewall for the application to work.
  3. Open the application on your phone. Click on Connect > Add new PC. Specify the IP address of your PC and a human readable name for it. Save the settings and click on the name / IP address to connect to your PC.
  4. You are all set here. Any application which uses the camera will take the video feeds from the “DroidCam” windows component.

DroidCam supports Windows XP / Vista / 7 and also 64-bit Windows. It has support for Linux as well. MAC version will be available soon. Read more about DroidCam from here.

Similar apps: USB Webcam, IP Webcam (supports multiple view options)

-- Varun

Wednesday, November 3, 2010

[How to] Use your favorite video as Live Wallpaper in Android

One of the coolest features of Android (2.1+) is its Live Wallpapers – richer, animated, interactive backgrounds on home screen. Android devices are shipped with few live wallpapers and you can download more from here. A live wallpaper is very similar to a normal Android application and has access to all the facilities of the platform: SGL (2D drawing), OpenGL (3D drawing), GPS, accelerometers, network access, etc. This article will help you to set your favorite video as a live wallpaper on your Android device.

Follow these steps

  • Video Live Wallpaper’ is the application which does the magic. The application can be installed from the market. It is available for free and it takes around 6.2 MB after installation. The application can not be moved to SD card.
  • After the application is installed, open Launcher (Home). Press Menu from the Launcher.
  • Select ‘Wallpaper’ > ‘Live wallpapers’ > ‘Video Live Wallpaper’. If you are not seeing this option on your device, please check if the application was installed properly.
  • Select the video file or directory you want to be used as live wallpaper. ‘Settings’ > ‘Video file or directory’. You can also configure other options like Swiping smoothness from the Settings screen.
  • Select the ‘Set wallpaper’ and your video will be used as live wallpaper.

Video Live Wallpaper

Live wallpaper settings

Favorite video as live wallpaper

If you are interested in creating your own live wallpaper, check out this sample.

-- Varun

Wednesday, October 27, 2010

[How to] Show QR codes for links in your web page

QR (Quick Response) code is a two-dimensional bar code consists of black rectangular modules arranged in a square pattern on white background. QR codes can digitally store more data than the standard barcodes. QR code was used for the first time in Japan in 1994 but it became popular only in the last 3-4 years. Thanks to the iPhones and Androids. Almost all the smartphones have QR code readers and the reading of codes takes just few seconds. We may soon see QR Codes storing addresses and URLs appearing in magazines, on signs, buses, business cards, etc. QR codes can be used on your web pages to improve the mobile experience of your users. Making each link on your page available as a QR code will allow the users to quickly navigate to that link on their mobiles.

QR Code QR Code used on Varun's ScratchPad

Steps to be followed to add QR code for the links on your web page:

1. Include the jQuery library (if you have not included already) and jQuery.cluetip plug-in from within the HTML <head> section. Download it from here. [JavaScript experts may want to try this asynchronously loading JavaScripts. Link.]

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
<script src="jquery.cluetip.js" type="text/javascript"></script>

2. Copy the following HTML snippet and paste it just before closing the </body> tag. The snippet uses Google charts for generating the QR code and the jQuery plug-in cluetip is used for showing the bubble.

<div id="divQR" style="background-color: #D9E6F7; border:4px solid #C1D9FF; text-align:center; display:none;
font-family:calibri;-moz-border-radius: 5px;-webkit-border-radius: 5px;width:200px;height:380px;padding:-5px;">
<img id="imgQR" src="" width="200" height="200" alt="" />
<p align="justify" style="padding-left:15px;padding-right:15px">QR code will be shown for each link on
hovering over it. Scan the QR code above using the Barcode Scanner from your smart phone, and the link
will be instantly accessible on your phone.
</p>
</div>

<script type="text/javascript">
$.fn.cluetip.defaults.dropShadow = false;
$.fn.cluetip.defaults.onActivate = function(e) {
if (e.length > 0) {
var anchor = e.context;
var link = anchor.href;
if (link.indexOf("javascript:") == 0)
return false;

$("#imgQR").attr("src", "http://chart.apis.google.com/chart?chf=a,s,000000&chs=200x200&chld=|2&cht=qr&chl=" + encodeURIComponent(link));
$("#imgQR").attr("alt", anchor.innerText);
return true;
} else
return false;
};
$("a").attr("rel", "#divQR");
$("a.qrLink").cluetip({local: true, hideLocal: true, showTitle: false, clickThrough: true});
</script>

3. Set the attribute class to “qrLink” for all the hyperlinks that you want to show as QR codes.

<a class="qrLink" href="http://blog.varunkumar.me" >Varun's ScratchPad</a>

4. Done. Hover over the hyperlinks to see their QR codes. Scan the codes from your mobile and navigate to the links quickly from your mobile.

Generate QR Code for hyperlinks on all the web pages

If you want to generate QR code for hyperlinks on all the web pages, use this GreaseMonkey script. It works only on Firefox as of now. Download and install GreaseMonkey add-on. Point your browser to this link. Now, the QR code will be shown on hovering over any of the hyperlinks on any web page.

-- Varun

Sunday, October 3, 2010

[How to] Filter out updates on Facebook News feed

Facebook is a social networking site as opposed to Twitter which to me is a broadcasting medium. But, Facebook has been widely used for broadcasting messages as well. Similar to the Twitter timeline, your Facebook news feed often gets flooded with updates carrying similar message. Facebook handles these cases to a greater extent than Twitter. Facebook tries to group messages based on the sender, application and other parameters (like events). If a person is spamming your news feed, you can hide the updates from that person. You can also hide the updates from a particular application. The only missing feature here is the ability to hide updates on a particular topic. That is where my script will be useful. It is an extension to the script written for Twitter.

Facebook menu showing 'Filters'. Two updates have been filtered out.Filters option on FacebookFeatures

  • Filter out topics. Filter out updates containing a set of words from your news feed (works on profile pages also). You can enter multiple words separated by a comma. This will prevent your news feed getting flooded with the similar updates.
  • Filtered count Indicator. The filtered updates are not gone for ever. You can clear the filters to view them. The number of updates filtered out will be shown intuitively on the ‘Filters’ menu itself.
  • Remember your settings. The script has the ability to remember your filter settings on the browser and will reload the same when you sign in again. Also, the script applies the filters on new incoming updates as well (with a max time lag of 15 secs).
  • Hide the ‘Likes’ from friends. (v 1.2) If you don’t care about what your friends are liking on Facebook or on other sites, you can use this feature to hide the ‘Likes’ on your news feed.
  • Hide the friend connection updates. (v 1.2) Whenever a friend of yours is connected to another person, Facebook will notify you about the new connection on your news feed. If you are not interested in knowing who has be-friended whom, you can disable the friend connection notification using this feature.
  • Hide the attachments. (v 1.2) Enabling this option will hide all the attachments on your news feed. This includes shared videos, photos, links, etc.
  • Hide Facebook Places. (v 1.3) Enabling this option will hide the check-ins from your friends.
  • Hide Facebook Questions. (v 1.3)
  • Hide Facebook Ticker Section. (v 1.4). Facebook added a new section called “Ticker” which shows all the activities of your friends. It pushes the information that are already available on your friends’ profile. This section adds too much of noise to your news feed. Use this option to fix the section.
  • Show only the filtered posts. (v 1.4) Enabling this option will show the posts which match the search text specified. This will be handy if you want to know what friends say on a particular topic. Thanks to Raghu for the idea.
  • Hide Unread Count. (v 1.5). Facebook added a new feature called “Smart Lists” and showed the lists on the news feeds page. The unread count of the lists / groups clutters the UI. Use this option to hide the unread count.

How to install?

Compatible Browsers: Firefox 3+, Chrome 4+

Firefox 3+

  • Install the GreaseMonkey add-on for Firefox from here and restart the browser.
  • Get the script by pointing your browser to this.
  • GreaseMonkey Installation dialog box will appear. Please click on the “Install” button.
  • You are all set to use the script. Refresh the Facebook homepage. ‘Filters’ menu will appear next to ‘Account’ menu.

Chrome 4+

  • Chrome has native support for GreaseMonkey scripts. No additional extensions are needed to use the script.
  • Get the script by pointing your browser to this.
  • You will be prompted with a security alert. Please click on the ‘Continue’ button.
  • The script will be installed as an extension. Refresh the Facebook homepage to see the ‘Filters’ menu.

The script might contain few minor UI glitches. Please let me know if you find any. If you feel some other feature is missing in Facebook, please reach out to me. I shall try to extend this script. If you are looking for a similar solution for Twitter, try this script

Update: A new version (v 1.2) is available with three new features – Hide the ‘Likes’ from friends, Hide the friend connection updates, Hide the attachments. You can download the script from here.

Update-1: A new version (v 1.3) is available with two new features – Hide updates from Facebook Places, Hide Facebook Questions. You can download the script from here.

Update-2: Version 1.4 is just released to Userscripts.org. Features included: Hide Facebook Ticker, Show only the filtered posts. You can download the script from here.

Update-3: Version 1.5 is just released to Userscripts.org. Features included: Fix for new Facebook UI, Hide unread count of Groups / Lists updates. You can download the script from here.

Userscripts.org seems to go down frequently these days. Here is an alternate link to the script. Source code is available here.

-- Varun

[How to] Filter out tweets on New Twitter interface

Twitter has been rolling out the preview version of its new interface and I got the chance to try it out just few days back. One of the basic functionalities which is missing even in the new interface is the ability to filter out tweets. Twitter is a nice medium for catching up on the latest happenings. But, at times, you might get bombarded with tweets (all of which carrying the  same message) about the same topic from different people and might have to miss some important ones. Filtering is a must-to-have feature in an application like Twitter but Twitter is yet to realize the need for it. However, this feature is already available on some of the popular Twitter clients like Tweetdeck. I have written a simple GreaseMonkey script to add this functionality to New Twitter.

Twitter menu showing 'Filters'. 22 tweets have been filtered out.

Filter options

Filters menu on TwitterFeatures

  • Filter out a person. If a person on your timeline is on a spamming spree, you can temporarily unfollow him / her using this feature. Typical example for this could be a person attending a conference / tech talk and live tweeting from there. His / her tweets might not be applicable outside the conference room. You can use this feature to temporarily unfollow the person.
  • Filter out keywords. Filter out tweets containing a set of words. You can enter multiple words separated by a comma. This will prevent your timeline getting flooded with the trending topics.
  • Remove hyperlinks. In the past few weeks alone, there were two different cases of XSS attack on Twitter. This feature will safeguard you from these sort of attacks to some extent by removing all the external links from your timeline.
  • Filtered count Indicator. The filtered tweets are not gone for ever. You can clear the filters to view them. The number of tweets filtered out will be shown intuitively on the ‘Filters’ menu itself.
  • Remember your settings. The script has the ability to remember your filter settings on the browser and will reload the same when you sign in again. Also, the script applies the filters on new incoming tweets as well (with a max time lag of 15 secs).

How to install?

Compatible Browsers: Firefox 3+, Chrome 4+

Firefox 3+

  • Install the GreaseMonkey add-on for Firefox from here and restart the browser.
  • Get the script by pointing your browser to this.
  • GreaseMonkey Installation dialog box will appear. Please click on the “Install” button.
  • You are all set to use the script. Refresh the twitter homepage. ‘Filters’ menu will appear next to ‘Messages’ menu.

Chrome 4+

  • Chrome has native support for GreaseMonkey scripts. No additional extensions are needed to use the script.
  • Get the script by pointing your browser to this.
  • You will be prompted with a security alert. Please click on the ‘Continue’ button.
  • The script will be installed as an extension. Refresh the twitter homepage to see the ‘Filters’ menu.

The script might contain few minor UI glitches. Please let me know if you find any. If you feel some other feature is missing in Twitter, please reach out to me. I shall try to extend this script. If you are still on old Twitter and looking forward to one such script, try this script. If you are looking for a similar script for Facebook updates, try this script.

Userscripts.org seems to go down frequently these days. Here is an alternate link to the script. Source code is available here

-- Varun

Sunday, September 26, 2010

[How to] Change the DNS server of 3G connection on Android phones

This post is a continuation to my previous post on “[How to] Change DNS Server on Android phones?”. The earlier post was about changing the DNS Server when you are connected using WiFi. For a 3G connection, a different set of properties needs to be changed and the way we change them is also little different.

getprop | grep dns - Listing the properties with dns

Method-1 [Manual]

  • Your device should be rooted. Check out these instructions to root your device with a single-click.
  • Download and install the latest Android SDK from here. This comes up with all the tools needed for development and testing of your application. Make sure the driver ‘ADB interface’ is installed on your machine. In most of the cases, the driver will be installed directly once you plug-in the device.
  • Connect your Android device to your PC on debug mode. Enable USB debugging on your phone. Settings > Applications > Development > USB debugging.
  • On your laptop, open a command prompt and enter “adb shell”.
  • Use the command “getprop | grep dns” to know all the dns properties being used. This command requires BusyBox. Please install it if you have not done it earlier.
  • ‘rmnet0’ is the interface name for the 3G connection. net.rmnet0.dns1 and net.rmnet0.dns2 are the properties to be changed to point to OpenDNS server. Since, these properties are changed after the connection is established, net.dns1 and net.dns2 also have to be changed.
  • Execute these commands as root user: setprop net.rmnet0.dns1 208.67.222.222. setprop net.rmnet0.dns2 208.67.220.220. setprop net.dns1 208.67.222.222. setprop net.dns2 208.67.220.220
  • Done. You can test if the settings are proper by visiting http://welcome.opendns.com. Remember, the settings will be applicable only for the current session.

OpenDNS test page SL4A scripts folder 

Method-2 [Semi-Automated]

  • If you don’t want to take the pain of connecting your device to laptop and then changing the settings, try out this method. It uses a wrapper script which executes on your phone.
  • Download and install Scripting Layer for Android (SL4A). This has interpreters for executing your shell script (in fact, lots of other scripting languages also) from your phone.
  • Download the wrapper script I have written from here. This wraps all the commands needed for changing the DNS server in a shell script.
  • Move the script to /sdcard/sl4a/scripts/. (adb push change-dns.sh /sdcard/sl4a/scripts/.)
  • For easy access, add the scripts folder to your home screen. Long press on the home screen > Folders > Scripts. Open the scripts folder and you should see the script (“change-dns.sh”) which you have copied in the above step. All the above steps are needed to be done just once.
  • Click on the script to launch it. Grant the Super user permission when asked for. You just have to run this script whenever you are connecting to your mobile network.

If you know of any hook to fully-automate the process, please share it by commenting on this post.

-- Varun

Saturday, September 25, 2010

Unix commands on Android using BusyBox

BusyBox is an utility application which executes on an embedded Linux system to provide you with a bunch of handy Unix / Linux tools. It is designed to be a small executable which makes it ideal for use with embedded devices. The application is also known as “The Swiss Army Knife” of embedded Linux. If you have a rooted Android device, this application is a must-have one. It offers some of the popular Unix tools like grep, awk, sed, etc on your Android device.

Pre-requisites

  • Your device should be rooted. Check out these instructions to root your device with a single-click. Complete guide for rooting.
  • Download and install the latest Android SDK from here. This comes up with all the tools needed for development and testing of your application. Make sure the driver ‘ADB interface’ is installed on your machine. In most of the cases, the driver will be installed directly once you plug-in the device.

Executing Grep using BusyBoxInstallation Method-1

  • Connect your Android device to your PC on debug mode. Enable USB debugging on your phone. Settings > Applications > Development > USB debugging.
  • Download the latest version of BusyBox binaries for ARMV6l from here. Rename it to just busybox and copy to the root folder of your SD Card.
  • Download the BusyBox installation script from here. Copy the same to the root folder of your SD Card. Now, you are all set to start the installation.
  • On your laptop, open a command prompt and enter “adb shell”. Get into super user mode by typing su.
  • Move  to the SD card where the binary and the installation script are placed. cd /sdcard.
  • Execute the installation script sh ./installbusybox.sh.
  • Check if the installation is complete by issuing a grep command. “getprop | grep dns”.

BusyBox installerInstallation Method-2

  • If you don’t want to take the pain of downloading the binary and then the installation script, try out this method-2. This method eliminates most of the manual steps done above.
  • Download and install the application “BusyBox” from Android market. This is not the actual application rather it is an installer for the BusyBox utility.
  • Open the application. It will list down some of the recent versions of BusyBox utility. Select the latest one and click on install. Allow the Super user permission when asked by the installer. That is it. You are done.
  • This method is quite simpler when compared to the other one. But, the installer is problematic with some of the custom ROMs.

Check out the complete list of commands supported by BusyBox here.

-- Varun

Saturday, September 4, 2010

[How to] Change DNS server on Android phones?

Domain Name System / Server is the one which takes care of translating the human readable domain names into machine understandable IP addresses. If you are not able to access a particular set of websites either from your laptop / phone, DNS server could be a reason for it. It happened to me recently that only few pages were getting loaded properly on my Nexus One. To fix the problem, one has to change the network configurations to use some of the popular DNS servers like Open DNS or Google’s public DNS. On Android phones, changing the DNS server is easy if you are using the static IP. You can do it from Settings > Wireless & network settings > Wi-Fi settings > Advanced (from menu) > check the ‘Use static IP’ option. After that, you will be able to change the DNS servers. However, when you are using dynamic IP (which will be the case most likely), the process is not straight forward. DNS server details will be taken from the DHCP server which assigns the IP. 

DNS Servers for static IP IP Config showing the updated DNS servers

Here are the steps to be followed to change the DNS servers:

  • Your device should be rooted. Check out these instructions to root your device with a single-click.
  • Download and install the latest Android SDK from here. This comes up with all the tools needed for development and testing of your application. Make sure the driver ‘ADB interface’ is installed on your machine. In most of the cases, the driver will be installed directly once you plug-in the device.
  • Connect your Android device to your PC on debug mode. Enable USB debugging on your phone. Settings > Applications > Development > USB debugging.
  • On your laptop, open a command prompt and enter “adb shell”.
  • Use the commands “getprop dhcp.eth0.dns1” and “getprop dhcp.eth0.dns2” to know the DNS servers currently being used. There are applications like ‘ipconfig’ which will give you the same details.
  • To change the DNS servers, use the command “setprop <property name>”. “setprop dhcp.eth0.dns1 208.67.222.222” “setprop dhcp.eth0.dns1 208.67.222.222”. This command has to be executed as root user.
  • Remember, the above step will change the DNS servers only for the current session. You will have to repeat it when you are re-connecting to the network. Read through the next section to know about how to change the DNS server automatically when you re-connect to a network.

Changing the DNS servers automatically

  • Android system chooses the DNS servers using the script located at “/system/etc/dhcpcd/dhcpcd-hooks/20-dns.conf”
  • By default, /system partition is mounted as read-only. Need to re-mount the same in read-write mode. Follow the instructions here to do this.
  • Take a backup of the script. Download the modified version of the script from here. The modified script has two additional lines which will override the DNS server changes. The modified script uses the Google’s public DNS.
  • Changes will be applied after restarting the connection / device.

Update: To change the DNS server of 3G connection, check out this article.

-- Varun

google-site-verification: googlea4d68ed16ed2eea6.html