Skip to main content

Posts

Showing posts from 2011

Eclipse - Cut Copy Paste Not Working

PROBLEM If in an editor : when you try to copy text and paste it, nothing happens.  when you try to cut text and paste it, nothing happens or eclipse creates mess SOLUTION For my problem, I had to go to Window > Preferences > Java > Editor > Typing, and uncheck "Update imports"

Android Secret Codes

*#*#4636#*#* phone information *2767*3855# hard reset *#*#7780#*#* factory reset *#*#7594#*#* change end call/power option *#*#197328640#*#* service mode *#*#273283*255*663282*#*#* file copy screen (backup media files) *#*#526#*#* wlan test *#*#232338#*#* shows wifi mac address *#*#1472365#*#* gps test *#*#1575#*#* another gps test *#*#232331#*#* bluetooth test *#*#232337#*# shows bluetooth device address *#*#8255#*#* gtalk service monitor *#*#0283#*#* packet loopback *#*#0*#*#* lcd test *#*#0673#*#* melody test *#*#0842#*#* device test (vibration test and backlight test) *#*#2663#*#* touch screen version *#*#2664#*#* touch screen test *#*#0588#*#* proximity sensor test *#*#3264#*#* ram version codes to get firmware version information: *#*#4986*2650468#*#* pda, phone, h/w, rfcalldate *#*#1234#*#* pda and phone *#*#1111#*#* fta sw version *#*#2222#*#* fta hw version *#*#44336#*#* pda, phone, csc, build time, changelist number Warning: be careful

"IF" statement test condtions in Shell Script

Following are some "IF" Statement constructs to test conditions provided by the shell: -b file = True if the file exists and is block special file. -c file = True if the file exists and is character special file. -d file = True if the file exists and is a directory. -e file = True if the file exists. -f file = True if the file exists and is a regular file -g file = True if the file exists and the set-group-id bit is set. -k file = True if the files' "sticky" bit is set. -L file = True if the file exists and is a symbolic link. -p file = True if the file exists and is a named pipe. -r file = True if the file exists and is readable. -s file = True if the file exists and its size is greater than zero. -s file = True if the file exists and is a socket. -t fd = True if the file descriptor is opened on a terminal. -u file = True if the file exists and its set-user-id bit is set. -w file = True if the file exists and is writable. -x file = True if the f

'Type' example in Shell Script

Here we are calling functions directly using 'type' after parsing them in SUB_CMD through command line: ############################################## PROG_NAME="$(basename $0)" SUB_CMD="$1" retval=0 if [ "$(type -t "${SUB_CMD}")" == 'function' ] ; then     ${SUB_CMD}     retval=$? else     echo "Invalid command '${SUB_CMD}'"     usage     retval=1 fi exit ${retval} ##############################################

Spiral Traversal of Matrix

#include <iostream> using namespace std; int mat[4][3] = {{1,2,3}, {4,5,6}, {7,8,9}, {10,11,12}}; void print_spiral(int mat[4][3], int m, int n, int k) {   if (m <= 0 || n <= 0)     return;   if (m == 1) {     for (int j = 0; j < n; j++)       cout << mat[k][k+j] << " ";     return;   }   if (n == 1) {     for (int i = 0; i < m; i++)       cout << mat[k+i][k] << " ";     return;   }   // print from top left   for (int j = 0; j < n - 1; j++)     cout << mat[k][k+j] << " ";   // print from top right   for (int i = 0; i < m - 1; i++)     cout << mat[k+i][k+n-1] << " ";   // print from bottom right   for (int j = 0; j < n - 1; j++)     cout << mat[k+m-1][k+n-1-j] << " ";   // print from bottom left   for (int i = 0; i < m - 1; i++)     cout << mat[k+m-1-i][k] << " ";   print_spiral(mat, m-2, n-2, k+1

Syslog Example

What is Syslog Syslog is a standard for logging program messages. It allows separation of the software that generates messages from the system that stores them and the software that reports and analyzes them. It also provides devices which would otherwise be unable to communicate a means to notify administrators of problems or performance. Syslog can be used for computer system management and security auditing as well as generalized informational, analysis, and debugging messages. It is supported by a wide variety of devices (like printers and routers) and receivers across multiple platforms. Because of this, syslog can be used to integrate log data from many different types of systems into a central repository. Messages refer to a facility (auth, authpriv, daemon, cron, ftp, lpr, kern, mail, news, syslog, user, uucp, local0, ... , local7 ) and are assigned a priority/level (Emergency, Alert, Critical, Error, Warning, Notice, Info or Debug) by the sender of the message. Configura

eXtensible Access Method (XAM)

The XAM (eXtensible Access Method) Interface specification “defines a standard access method (API) between Consumers (application and management software) and Providers (storage systems) to manage fixed content reference information storage services. XAM includes metadata definitions to accompany data to achieve application interoperability, storage transparency, and automation for ILM-based practices, long term records retention, and information security. XAM will be expanded over time to include other data types as well as support additional implementations based on the XAM API to XAM conformant storage systems.” The SNIA XAM standard access method is designed to benefit storage vendors, software developers and the end user community. It provides: Interoperability : applications can work with any XAM conformant storage system, information can be migrated and shared. Compliance : integrated record retention and disposition metadata. ILM Practices : a framework for cl

Good Style of Programming

Here are few tips to program your C / C++ code in good style : Break Using break is ok in loops. Ideally, the loop should be structured to iterate in the most straightforward way. The break in the body can detect the exceptional case that comes up during the iteration. for (i = 0; i < length; i++ ) {     if (<found>) break; … } or while (current != NULL) {     if (<found>) break; … } While while (TRUE) types loops are fine if they are really necessary. Often you need this for the loop-and-a-half-type situation where you need to first do some processing before you are able to test whether you need to exit the loop. If the first statement of a while (TRUE) loop is the test, then you should just put the test directly into the while statement. If the bounds of iteration are known, then a for loop is preferable. Return A return in a place other than the end of a function body is potentially vulgar. The early return can be used nicely if it detects and

Ultimate Dictionary

I use online dictionary a lot in my work, so here I’m sharing with you an amazing online dictionary tool : Ultimate Dictionary , a complete collection of dictionaries with which you can look up words right on your Windows desktop. Ultimate Dictionary includes a huge collection of dictionaries that enable you to look up definitions, synonyms and translations to a bunch of different languages. The program features a very simple, minimalist interface with two main areas: on the left side, you can choose to have either the list of available dictionaries or the list of word results as you search. On the right, you’ll see words’ definitions and/or translations. You can also enable the “Scan” mode in Ultimate Dictionary, which makes the dictionary follow the mouse and displays a pop-up window with the definition of the word right below the cursor. Ultimate Dictionary is easy to use and performs very fast searches. You can also customize the order in which dictionaries appear, s

Search People on Web

There are various reasons why we might need to search for people, we may need to find a lost relative, an old flame, a classmate or a business contact – but if we are using a search engine such as Google or Yahoo to search for people, we have probably realized by now that it might work in some cases but in most cases it won’t. How come the best search engines fail so miserably when it comes to people search? The answer lies in a little known but very important part of the web called “ the deep web “. Also known as “invisible web”, the term “deep web” refers to a vast repository of underlying content, such as documents in online databases that general-purpose web crawlers cannot reach. The deep web content is estimated at 500 times that of the surface web, yet has remained mostly untapped due to the limitations of traditional search engines. Since most personal profiles, public records and other people-related documents are stored in databases and not on static web page

AUTO IT

AutoIt is a free BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is very small, self-contained and runs on all versions of Windows out-of-the-box with no annoying “runtimes” required! AutoIt is a stand-alone application with no external .dll files or registry entries required making it safe to use on Servers. Scripts can be compiled into stand-alone executable with Aut2Exe. Also there is a combined COM and DLL version of AutoIt called AutoItX that allows to add the unique features of AutoIt to our favorite scripting or programming languages! Features : Basic-like Syntax and Rich Function Set AutoIt has a BASIC-like syntax which means that most people who have ever written a script or used a high-level language shou

Old Version of Softwares / Applications

Old is Gold, Looking for old version of your favorite Software or Utility Upgrading to a newer version is a good thing. But,  your computer may not be compatible with the new version, the new version is bloated, or all the options you liked are no longer available. Often newer versions are more complicated to use and we understand that it is hard to find older, more user-friendly versions of popular software. Many software providers do not include older versions of their software on their sites. Well here are some of the sites providing us the old versions of our favorite software or utilities. http://www.oldversion.com/ http://www.oldapps.com/ http://old-versions.net/

Firefox’s Temporary Internet Files

Are you searching where Firefox stores its temporary internet files (cache) ? Well there is no need to go anywhere, solution lies within the Firefox browser. Follow the below given steps and you can access all the files stored by Firefox : Open a new tab. In the address bar, write “ about:cache ” and press enter. Following page will come up like shown in image below : This page shows all the cache maintained by the Firefox browser. For Temporary Internet Files, we need to go for “ Disk Cache “. Click on the link given for Disk Cache on the about:cache page. Following page will come up like shown in image below : This page will list all the files being cached by the Firefox. Using find utility of Firefox search for the file you are looking for. After the finding that file click on the link given for that file as shown in above image. Following page will come up like shown in image below : This page will have link and all the details about that file. Right click on the

Quotations II

Here are some of the finest quotes : “Failures are divided into two classes – those who thought and never did, and those who did and never thought” “Love is the triumph of imagination over intelligence” “Only two things are infinite, the universe and human stupidity, and I’m not sure about the former” “Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT’S relativity” “A good speech is like a miniskirt – short enough to be interesting, long enough to cover the essentials” “There’s a fine line between genius and insanity. I have erased that line” “Math was always my bad subject. I couldn’t convince my teachers that many of my answers were meant ironically” “Never ruin an apology with an excuse” “America is the only country that went from barbarism to decadence without civilization in between” “If we think we hear, we no longer listen If we think we see, we no longer look If we think we know, w

Quotations I

Here are some of the finest quotes : “I certainly don’t regret my experiences because without them, I couldn’t imagine who or where I would be today. Life is an amazing gift to those who have overcome great obstacles, and attitude is everything!” “When you have confidence, you can have a lot of fun. And when you have fun, you can do amazing things.” “Everybody is ignorant, only on different subjects” “In theory, there is no difference between theory and practice. But, in practice, there is” “I have never let my schooling interfere with my education” “The real problem is not whether machines think but whether men do” “He used statistics the way a drunkard uses lampposts – for support, not illumination” “A women’s dress should be like a barbed wire fence, serving its purpose without obstructing the view” “Diplomacy: The art of letting someone have your way” “He was a wise man who invented God” “For every complex problem, there is a solution that is simple, neat, and wrong” “W

C++ Questions II

Q11. Should I use NULL or 0? Ans. In C++, the definition of NULL is 0, so there is only an aesthetic difference. I prefer to avoid macros, so I use 0. Another problem with NULL is that people sometimes mistakenly believe that it is different from 0 and/or not an integer. In pre-standard code, NULL was/is sometimes defined to something unsuitable and therefore had/has to be avoided. That’s less common these days. Q12. How are C++ objects laid out in memory? Ans. Like C, C++ doesn’t define layouts, just semantic constraints that must be met. Therefore different implementations do things differently. Basically, C++ constructs objects simply by concatenating sub objects. Thus struct A { int a , b ; } ; is represented by two ints next to each other, and struct B : A { int c; } ; is represented by an A followed by an int; that is, by three ints next to each other. Virtual functions are typically implemented by adding a pointer (the vptr) to each object of a class with virtual functions.

C++ Questions I

Q1. What is the output of printf ( “%d” ) ? Ans. %d helps to read integer data type of a given variable. When we write ( “%d”, x ) compiler will print the value of x assumed in the main but nothing after ( “%d” ) so the output will be a garbage value. Q2. Explain the need for a virtual destructor. Ans. Destructor for the base parts are invoked automatically. We might delete a ptr to the base type that actually points to a derived object,  if we delete a ptr to base then the base class destructor is executed and the members of the base class are cleared up. If the object is a derived type then the behavior is undefined. To ensure that the proper destructor is invoked the destructor must be virtual in the base class. Q3. What is Mutable keyword ? Ans. Mutable keyword is the key to make exceptions to const objects. Mutable data member is allowed to change during a const member function. Mutable data member is never a const even when it is a member of a const object. A const me