Posts Tagged ‘File format’

Googling tricks and tips
Tricks for efficient Google search:Every 9 out of 10 people
use Google to Search the content they wish, and according to a recent
survey 80-90% of people face unsuccessful searches. Today the post is on How
to Search Google more efficiently
, forming a good Google query and you

end up getting the exact and relevant search results.Here i am sharing some
extremely helpful goggling skills with my readers.

 

Have you ever imagined how
pleasurable it would be if you get exactly what you were looking for??? the
techniques mentioned below will add value to your query. Using particular operators
along with the search terms in a specific syntax or format will provide you
with accurate and efficient content in no time.
1)     Use Quotes:
Usually, when you type the
search term without quotes then Google will look for the pages containing any
of the word in the search term. Say for example, if i type “anthem of India”
without quotes, then Google will list out all the webpages containing the word
“anthem” or “India”, but it won’t show the desired search results as we want
pages containing the whole term.
Enclosing the search term
inside a pair of double quotes will display search results of only the webpages
containing that exact phrase in the same order.
  Format: “Search term”
  Example: Suppose, you want to search for the
term techofundas4u, then your query
must be:
use quotes
2)      Also search for similar
terms:
Putting
a Tild(~) symbol right before the search term will  perform a search for the synonyms of the term
as well. Hence the results will contain webpages having  words similar to the term.
Format:
~search term
Example:
Suppose, if you wish to search the word jail, your query looks like:

Find synonyms

 

3)      Use wildcard:
The *(asterisk)symbol is
called wildcard, that can be placed in the search term where we are not sure
about the word. You can replace * with any word in your search term whether it
is the name of a book, a movie, the song lyrics, and likewise.
                  Format:
search * term
                  Example:
Suppose i forgot the name “tom and jerry”, one of my favourite cartoons them I
will write whatever words I remember and will place * where I forgot the word.
My query is:

use wildcard

 

4)      Check and correct spellings:
              spell:
operator will check the term for spelling mistakes and perform search for the
correct word automatically.
Format: spell: Search term
                       Example:
Suppose if I don’t know the correct spelling of the word I will write the
incorrect spelling “enginering” proceeded by spell: operator, now Google will
perform search for the correct word “engineering”. The query must be:

Using spell: operaror

 

5)      specific file type:
Sometimes you may want the
particular file type related to the search
term. If you want only the file with .PDF, .DOCX or .XLS extension then
place the filetype: operator prior to the extension and then write the
search term.
Format: filetype:    file-extension   Search term
Example: Suppose you are
looking for a presentation on the search term “3G technology” then your query
looks like:
Seach by filetype
6)      search word definitions:
Sometimes it may happen that
you want only the definition of the term and nothing else. Then simply place
the define: operator prior to the search term, it will serve your purpose
providing quick definitions from the webpages. And more importantly this
operator also shows an audio button, clicking on that will give the exact
pronunciation this is the most useful feature.
Format: define: Search term
Example: Suppose you want the
definition of the term “Nanotechnology” then you can simply append the term to
the define: operator. Your query must be:
search Word definitions
7)      Search for music:
The “music” operator
gives search results related to music only. Using this operator prior to the song
lyrics, or album name will show links to that song to watch and download the
song.
Format: music “song
lyrics/album name/ movie name”
Example: Suppose if you want
only the song “Chahu mein ya na”and not the lyrics, or reviews then you may
simply append this lyrics to the music operator. Your query is supposed to be:
search music only
8)      Find pages containing search
term in their URL:
allinurl: operator will
search the webpages containing exactly the particular search term in their URL.
There is another operator
inurl that does the same function as allinurl but the only difference
is that inurl will look only for the URLs containing the first word of the
search term, and the remaining words will be searched in the page.
Format: allinurl: search term
Example: Suppose if the search
term is “booking event” then it will display results in whose URL “booking
event” will appear. The query looks like:
using allinurl: operartor
9)      Find pages containing search
term in their title:
allintitle: operator will
search the webpages containing exactly the particular search term in their page
title.
     There is another operator intitle that
does the same function as allintitle but the only difference is that
intitle will look only for the pages with titles containing the first word
of the search term, and the remaining words will be searched in the page.
   Format: allintitle: Search term
  Example: Suppose I want to find the pages
with the term “troubleshooting hardware problems” in their titles, the query
must be:
using allintitle: operator
10)  Use OR:
OR operator displays search
results for both the search terms on either side of it. It is best suited if
you want to look for both word but separately in different links, or if both the
words are similar in meaning. You can also use — (double hyphen) or | (Pipe) symbol
instead of OR.
Format: Search term1 OR
Search term2
Example: Suppose if I want to
search for words Pizza and Burger simultaneously, then I’ll place OR operator
between these two words and it will show links of pages having both the words in
their content. The query must be:
Use OR operator
11)  Use NOT:
This operator excludes the
word with – (minus) sign before it from the search term. The pages containing
the excluded word will not be shown. This will strongly specify that you don’t
want that word to appear anywhere in your search results.
Format: search term –term to
be excluded
Example: Suppose I want to
search for the term institutes but I don’t want the word private to appear
anywhere in the search results, then my query will look like:
Use NOT operator
12)  Use Google as Calculator:
Type in the search box the
whole equation you wish to solve and here you go, it is far easier than using
your computer’s calculator because Google will solve the equation and display result
at once, instead of having to do it manually performing 1 operation each time.
This is a very fascinating
feature of Google , as it have an inbuilt Calculator. You just need to type in
the expression.
Format: Mathematical Expression
Example: Suppose I wish to
solve the expression (17*3)/(4*(6-2)-5) then I’ll simply Google it and the
result will be displayed within no time as shown below.
Use google as calculator
13)  Unit Convertor:
Google have another excellent
feature called Unit convertor, that is built into it. You need to write
down which unit and in what quantity, is to be converted into which one, Google
does the necessary unit conversions for you.
Example: Suppose I have to
find out how many Rupees are there in 5.4 US Dollars, then write it in the form
of a fill in the blank question as shown below.
Use Google as unit convertor
14)  Search within a site:
If you are sure that you want
to search a term from a particular website then you can restrict your search
using site: operator. Then you will be shown the search results from that
particular website only.
Format: Search term site:
site URL
Example: Suppose you are
looking for the term “news” in the website Only4bca.com, then your query must
be:
Using site: operator
            Or you may also use site: operator to find all the website having the
same domain names like .com, .org, .edu, .in, .gov and much more.
Use site operator
15)   Look for Area code:
Find area code

If you need to find out from
where you have received the call, then simply enter the 3-digit area code from
the phone number and you will get the location, As shown below:

16)  Find all the pages linked to
a specific URL:
If you want to know which all
webpages are linked to a particular site, then use link: operator. This
query will show you the links af all the webpages that links to that site.
Format: link: URL
Example: Suppose you want to
find that all the webpages that links to the website only4bca.com then the
query must be:
using link: operator

English: A download symbol.

When our application does a task that takes a considerable amount of time, it is common sense to show the progress of the task to the user.
This is a good User Experience practice. In this tutorial i will be discussing the implementation of a process-progress dialog.

As an example, i am displaying a progress bar that runs while the app downloads an image from the web. And once the image is downloaded
completely i am showing the image in a image view. You could modify this example and try it with any file type you may wish. That could be fun!

Download Code

Creating new Project

1. Create a new project and fill all the details. File ⇒ New ⇒ Android Project
2. Open your main.xml are create a button to show download progress bar. Also define a ImageView to show downloaded image. Paste the following code in your main.xml

main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <!-- Download Button -->
    <Button android:id="@+id/btnProgressBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Download File with Progress Bar"
        android:layout_marginTop="50dip"/>
    <!-- Image view to show image after downloading -->
    <ImageView android:id="@+id/my_image"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
</LinearLayout>

3. Now in your main activity class import necessary classes and buttons. I am starting a new asynctask to download the file after clicking on show progress bar button.

public class AndroidDownloadFileByProgressBarActivity extends Activity {
    // button to show progress dialog
    Button btnShowProgress
    // Progress Dialog
    private ProgressDialog pDialog;
    // Progress dialog type (0 - for Horizontal progress bar)
    public static final int progress_bar_type = 0;
    // File url to download
    private static String file_url = "http://api.androidhive.info/progressdialog/hive.jpg";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        // show progress bar button
        btnShowProgress = (Button) findViewById(R.id.btnProgressBar);
        // Image view to show image after downloading
        my_image = (ImageView) findViewById(R.id.my_image);
        /**
         * Show Progress bar click event
         * */
        btnShowProgress.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // starting new Async Task
                new DownloadFileFromURL().execute(file_url);
            }
        });
    }

4. Progress Dialog can be shown using ProgressDialog class. It is a subclass of normal AlertDialog class. So add an alert method in your main activity class.

/**
 * Showing Dialog
 * */
@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case progress_bar_type:
        pDialog = new ProgressDialog(this);
        pDialog.setMessage("Downloading file. Please wait...");
        pDialog.setIndeterminate(false);
        pDialog.setMax(100);
        pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        pDialog.setCancelable(true);
        pDialog.show();
        return pDialog;
    default:
        return null;
    }
}

5. Now we need to add our Async Background thread to download file from url. In your main activity add a asynctask class and name it as DownloadFileFromURL(). After downloading image from the web i am reading the downloaded image from the sdcard and displaying in a imageview.

/**
 * Background Async Task to download file
 * */
class DownloadFileFromURL extends AsyncTask<String, String, String> {
    /**
     * Before starting background thread
     * Show Progress Bar Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        showDialog(progress_bar_type);
    }
    /**
     * Downloading file in background thread
     * */
    @Override
    protected String doInBackground(String... f_url) {
        int count;
        try {
            URL url = new URL(f_url[0]);
            URLConnection conection = url.openConnection();
            conection.connect();
            // getting file length
            int lenghtOfFile = conection.getContentLength();
            // input stream to read file - with 8k buffer
            InputStream input = new BufferedInputStream(url.openStream(), 8192);
            // Output stream to write file
            OutputStream output = new FileOutputStream("/sdcard/downloadedfile.jpg");
            byte data[] = new byte[1024];
            long total = 0;
            while ((count = input.read(data)) != -1) {
                total += count;
                // publishing the progress....
                // After this onProgressUpdate will be called
                publishProgress(""+(int)((total*100)/lenghtOfFile));
                // writing data to file
                output.write(data, 0, count);
            }
            // flushing output
            output.flush();
            // closing streams
            output.close();
            input.close();
        } catch (Exception e) {
            Log.e("Error: ", e.getMessage());
        }
        return null;
    }
    /**
     * Updating progress bar
     * */
    protected void onProgressUpdate(String... progress) {
        // setting progress percentage
        pDialog.setProgress(Integer.parseInt(progress[0]));
   }
    /**
     * After completing background task
     * Dismiss the progress dialog
     * **/
    @Override
    protected void onPostExecute(String file_url) {
        // dismiss the dialog after the file was downloaded
        dismissDialog(progress_bar_type);
        // Displaying downloaded image into image view
        // Reading image path from sdcard
        String imagePath = Environment.getExternalStorageDirectory().toString() + "/downloadedfile.jpg";
        // setting downloaded into image view
        my_image.setImageDrawable(Drawable.createFromPath(imagePath));
    }
}

6. Open your AndroidManifest.xml file and add internet connect permission and writing to sdcard permission.

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
    package="com.example.androidhive"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk android:minSdkVersion="8" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".AndroidDownloadFileByProgressBarActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <!-- Permission: Allow Connect to Internet -->
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Permission: Writing to SDCard -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>

7. Run your Application and click on show progress bar button to see your progress bar. You can see the downloaded image in imageView once it is downloaded.

android download file and showing progress bar

Final Code

package com.example.androidhive;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class AndroidDownloadFileByProgressBarActivity extends Activity {
    // button to show progress dialog
    Button btnShowProgress;
    // Progress Dialog
    private ProgressDialog pDialog;
    ImageView my_image;
    // Progress dialog type (0 - for Horizontal progress bar)
    public static final int progress_bar_type = 0;
    // File url to download
    private static String file_url = "http://api.androidhive.info/progressdialog/hive.jpg";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        // show progress bar button
        btnShowProgress = (Button) findViewById(R.id.btnProgressBar);
        // Image view to show image after downloading
        my_image = (ImageView) findViewById(R.id.my_image);
        /**
         * Show Progress bar click event
         * */
        btnShowProgress.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // starting new Async Task
                new DownloadFileFromURL().execute(file_url);
            }
        });
    }
    /**
     * Showing Dialog
     * */
    @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case progress_bar_type: // we set this to 0
            pDialog = new ProgressDialog(this);
            pDialog.setMessage("Downloading file. Please wait...");
            pDialog.setIndeterminate(false);
            pDialog.setMax(100);
            pDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            pDialog.setCancelable(true);
            pDialog.show();
            return pDialog;
        default:
            return null;
        }
    }
    /**
     * Background Async Task to download file
     * */
    class DownloadFileFromURL extends AsyncTask<String, String, String> {
        /**
         * Before starting background thread
         * Show Progress Bar Dialog
         * */
        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            showDialog(progress_bar_type);
        }
        /**
         * Downloading file in background thread
         * */
        @Override
        protected String doInBackground(String... f_url) {
            int count;
            try {
                URL url = new URL(f_url[0]);
                URLConnection conection = url.openConnection();
                conection.connect();
                // this will be useful so that you can show a tipical 0-100% progress bar
                int lenghtOfFile = conection.getContentLength();
                // download the file
                InputStream input = new BufferedInputStream(url.openStream(), 8192);
                // Output stream
                OutputStream output = new FileOutputStream("/sdcard/downloadedfile.jpg");
                byte data[] = new byte[1024];
                long total = 0;
                while ((count = input.read(data)) != -1) {
                    total += count;
                    // publishing the progress....
                    // After this onProgressUpdate will be called
                    publishProgress(""+(int)((total*100)/lenghtOfFile));
                    // writing data to file
                    output.write(data, 0, count);
                }
                // flushing output
                output.flush();
                // closing streams
                output.close();
                input.close();
            } catch (Exception e) {
                Log.e("Error: ", e.getMessage());
            }
            return null;
        }
        /**
         * Updating progress bar
         * */
        protected void onProgressUpdate(String... progress) {
            // setting progress percentage
            pDialog.setProgress(Integer.parseInt(progress[0]));
       }
        /**
         * After completing background task
         * Dismiss the progress dialog
         * **/
        @Override
        protected void onPostExecute(String file_url) {
            // dismiss the dialog after the file was downloaded
            dismissDialog(progress_bar_type);
            // Displaying downloaded image into image view
            // Reading image path from sdcard
            String imagePath = Environment.getExternalStorageDirectory().toString() + "/downloadedfile.jpg";
            // setting downloaded into image view
            my_image.setImageDrawable(Drawable.createFromPath(imagePath));
        }
    }
}

The example below illustrates how you can convert the HTML of RadEditor to PDF format using an HTML2PDF convertor tool of Tall Components. For a live demo, please go to http://www.tallcomponents.com/cp0803.aspx

 

ASPX code

<form id=”Form1″ method=”post” runat=”server”>
    RadEditor id=”RadEditor1″ Runat=”server”>
    <asp:button id=”showPDF” runat=”server” Text=”Show PDF”></asp:button>

C# code

private void showPDF_Click(object sender, EventArgs e)
{
    string html = “<html>” + RadEditor1.Html + “</html>”;
    TallComponents.PDF.Layout.Document document = new TallComponents.PDF.Layout.Document();
    TallComponents.PDF.Layout.Section section = document.Sections.Add();
    TallComponents.PDF.Layout.HtmlParagraph htmlParagraph = new TallComponents.PDF.Layout.HtmlParagraph();
    htmlParagraph.FontPath = “fonts“;
    htmlParagraph.Text = html;
    section.Paragraphs.Add( htmlParagraph );
    Response.Clear();
    document.Write( Response );
    Response.End();
}

VB.NET code

Private Sub showPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
 Dim html As String = “<html>” + RadEditor1.Html + “</html>”
 Dim document As TallComponents.PDF.Layout.Document = New TallComponents.PDF.Layout.Document
 Dim section As TallComponents.PDF.Layout.Section = document.Sections.Add
 Dim htmlParagraph As TallComponents.PDF.Layout.HtmlParagraph = New TallComponents.PDF.Layout.HtmlParagraph
 htmlParagraph.FontPath = “fonts”
 htmlParagraph.Text = html
 section.Paragraphs.Add(htmlParagraph)
 Response.Clear
 document.Write(Response)
 Response.End
End Sub

ASPX code

<form id=”Form1″ method=”post” runat=”server”>
    ScriptManager ID=”ScriptManager1″ runat=”server” />
    <telerik:RadEditor id=”RadEditor1″ Runat=”server”>
    <asp:button id=”showPDF” runat=”server” Text=”Show PDF”></asp:button>
</form>

C# code

private void showPDF_Click(object sender, EventArgs e)
{
    string html = “<html>” + RadEditor1.Content + “</html>”;
    TallComponents.PDF.Layout.Document document = new TallComponents.PDF.Layout.Document();
    TallComponents.PDF.Layout.Section section = document.Sections.Add();
    TallComponents.PDF.Layout.HtmlParagraph htmlParagraph = new TallComponents.PDF.Layout.HtmlParagraph();
    htmlParagraph.FontPath = “fonts”;
    htmlParagraph.Text = html;
    section.Paragraphs.Add( htmlParagraph );
    Response.Clear();
    document.Write( Response );
    Response.End();
}

VB.NET code

Private Sub showPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
 Dim html As String = “<html>” + RadEditor1.Content+ “</html>”
 Dim document As TallComponents.PDF.Layout.Document = New TallComponents.PDF.Layout.Document
 Dim section As TallComponents.PDF.Layout.Section = document.Sections.Add
 Dim htmlParagraph As TallComponents.PDF.Layout.HtmlParagraph = New TallComponents.PDF.Layout.HtmlParagraph
 htmlParagraph.FontPath = “fonts”
 htmlParagraph.Text = html
 section.Paragraphs.Add(htmlParagraph)
 Response.Clear
 document.Write(Response)
 Response.End
End Sub

In the “Article Files” section, there is attached a sample project with RadEditor 6.1 demonstrating the described functionality.

Article Links