Skip to main content


Showing posts from April, 2012

Phonegap plugin for Ads on iPhone

I suppose you know how to create a Phonegap project and also how to add a plugin into the project. First download the required code from here . Add the "Ads" folder to your plugins list. To do this, right-click on the Plugins folder in Xcode and select to “Add Files to…” the folder. Navigate to the Ads folder, and select the folder. Check “Copy items into. . .” and “Create groups for. . .” A ChildBrowser folder is added to the Plugins folder. Copy the content of "js" folder to desired location. Then update the plist to use the plugin In Supporting Files > PhoneGap.plist, add under Plugins (click the down arrow to the left of Plugins, then click on the + symbol to open a new row): Key: SAiOSAdPlugin Type: String (default) Value: SAiOSAdPlugin See the "index.html" for initialization of the code. Now, to display the Ad, call "showTheAd(true)" and whenever you want to hide the Ad call "showTheAd(false)"

Google Plus +1 and share

This a html code that can be added to website to share some content on  GooglePlus You can use any image(but select a related one). By clicking on the image, content will be posted on the users G+ account. Consider the following samople code <a href="<LINK TO BE SHARED>" <img src="ANY IMAGE" /></a> Also the proper description will be posted, along with the link.

Shortest Job First Scheduling using HEAP

// Input is from the file "input.txt" in the form (a1,t1),(a2,t2),(a3,t3)  (arrival time, time to complete ie, burst time) import*; import java.util.*; public class SJFHeap {     static class point {         double time;         double run;         int no;         double total;         point(int i, double a, double b) {             no = i;             time = a;             run = b;             total = 0;         }     }     static class MHeap {         private point[] Heap;         private int maxsize;         private int size;         public MHeap(int max) {             maxsize = max;             Heap = new point[maxsize];             size = 0;         }         private int leftchild(int pos) {             return 2 * pos;         }         private int rightchild(int pos) {             return 2 * pos + 1;         }         private int parent(int pos) {             return pos / 2;         }         private boolean

Android : Failed to parse the output of 'adb version'

This error occurs due to 32bit incompatibility on your system. One solution is to install the 32 bit compatibility on your system : sudo apt-get install ia32-libs

Fix In-Built Mic Problem in Ubuntu

Code for terminal: sudo gedit /etc/modprobe.d/alsa-base.conf Add this line to the bottom of the gedit file: options snd-hda-intel model=auto then Reboot and you're done!

BURG (say good bye to GRUB)

BURG stands for B rand-new U niversal loade R from G RUB. It's based on GRUB, and add features like new object format and configurable menu system. For Ubuntu 11.04 users, add the following PPA : sudo add-apt-repository ppa:n-muench/burg Then use the following command to download and install the loader, themes and emulator: sudo apt-get update && sudo apt-get install burg During the installation, it should ask you to write the new boot loader to MBR. If you skip that step, you can later use the following command to update MBR of hd0: sudo burg-install "(hd0)"

Spell Checker using TRIE

Spell checker program using TRIE data structure. Dictionary source is from Dictionary.txt, which is to be in the same directory of the program, or else change the file name and location // import*; import java.util.*; class TrieNode {     char letter;     TrieNode[] links;     boolean fullWord;     TrieNode(char letter, boolean fullWord) {         this.letter = letter;         links = new TrieNode[26];         this.fullWord = fullWord;     } } public class Possible {     static TrieNode createTree()     {         return(new TrieNode('', false));     }     static void insertWord(TrieNode root, String word)     {         int offset = 97;         int l = word.length();         char[] letters = word.toCharArray();         TrieNode curNode = root;         for (int i = 0; i < l; i++)         {             if (curNode.links[letters[i] - offset] == null)                 curNode.links[letters[i] - offset] = new TrieNo

Spell Checker

This is a program which takes a word as input and gives possible suggestions to correct the spelling of the word, by searching them from the dictionary of words(a text file Dictionary.txt). // import*; import java.util.*; public class Spell {     static ArrayList<String> wordsList = new ArrayList<String>();     public static void main(String args[]) throws IOException     {         try {             long build1 = System.currentTimeMillis();             FileInputStream fstream = new FileInputStream("Dictionary.txt");             BufferedReader br = new BufferedReader(new InputStreamReader(fstream));             String ele;             while ((ele = br.readLine()) != null)                 wordsList.add(ele);             long build2 = System.currentTimeMillis();             System.out.println("Time to build data structure is:" + (build2 - build1));         } catch (Exception e) {             System.err.pri