Pages

Showing posts with label using. Show all posts
Showing posts with label using. Show all posts

Wednesday, March 11, 2015

I will continue using Chrome

I dont like to write about hot topics. Waste of time mostly since everyone tends to overpush it. But IE 9 Beta brings important points, so here is my resume:

1. Nicely implements Chrome logic of tabs and big screen for website
2. Speed is nicely improved, though the feeling of being stuck is still there
3. Its designed as it should be. The great MS feeling for design. Windows and Office users will LOVE it.

4. Downloading is as stupid as it can be.
5. Microsoft wants to loose its market share. Downloading it takes too many clicks. Installing is too many clicks. First use is too many clicks.
6. Microsoft want to loose its market share. You cant install it on WinXP.
7. Microsoft does NOT want people to download IE 9. Here is the exact way to NOT get it:
 - go to http://www.microsoft.com/en/us/default.aspx => CLICK FREE download
 - you come here http://www.microsoft.com/presspass/presskits/internetexplorer/ => CLICK Get it NOW
 - you come here http://www.beautyoftheweb.com/ => click Download NOW
 - another beautiful window arises telling you that it it Win7 or Vista only

As one of many Win XP users you give up. Not to mention Mac and Linux users. Youre just waste of Microsoft money.

OK, Microsoft really has a bad attitude towards web-download-use process. It is always a mess of unlogical 20-times confirmation of legal and ilegal and mostly legal notices. Questions about what you really want. Facts about the beauty of their products. Facts about pirates and illegal equipment. Facts about the features of the great Microsoft products.

I know, I bought Windows 7 once. After 30 minutes of WANTING TO BUY I gave up and called Microsoft to tell me where I can buy. After 10 minutes on phone (now thats a process!) I got info about Irish website where EU customers can buy it. So it was 50 minutes shopping for 1 Windows7.

But lets forget for a minute that Microsoft does NOT want people to buy their products. Forget that downloading their products is big pain for experienced users. Lets focus on beauty of the web, IE9, comparing to others.

IE9 passed the css test. Great, all that I ever wanted. But does this box seem to be having rounded corners ?

IE9

NO. So nothing will change actually. Well still need to develope websites for IE especially. Ugly. No further test needed.

I will continue using Chrome. Just because I dont care which version it is for more than a year. It just updates whenever theres something new. No download button. No Get it now button. No FREE download button. No Accept button. No legal notice. Just small, natural, evolutionary changes every once in a while. And normal css support.

And Im sure this is something all other browsers still need to learn. "Versions" are useless for users. They can be some marketing point, but needless and pointless in the future of browser wars.
Read more »

Using Google Document List APIs to build Memeo Connect for Google Docs


Building Memeo Connect for Google Docs

Editors Note: This post was written by our partner Memeo, a digital media management company. Memeo Connect™ for Google Docs enhances Google Docs capabilities. We invited Memeo to share their experiences building an application on top of Google Apps utilizing some of our APIs. Other partners will share their experiences in future posts. 

Hi Im Matthew Tonkin, Mac Applications Architect at Memeo.  Google has been a great partner in helping us bring Memeo Connect to market.  Were excited about the new additions to the Google Documents List APIs and the products weve been working on for them.

Google Apps  is a great way for businesses to share and collaborate on documents, but more importantly, it has allowed businesses to move much of their office and IT infrastructure online for dramatic operating cost reductions.  Until recently, Google Docs users had no way of uploading, storing, syncing and sharing files of any type.  The big news is that Google Docs now supports all file types and there are Documents List APIs to prove it.  January saw the release of the updated Documents List API with this new arbitrary file support, but no desktop client software to manage file syncing between the desktop and the cloud.  Memeo Connect for Google Apps is that missing link.  Memeo set out to bridge Google Docs cloud storage with desktop software.  A simple goal that has big implications for where users store documents and how they are shared.  

The end result is a desktop application that is fully supported by Google Docs for online storage, synchronization, sharing and data management. With Memeo Connect, instant access to your important documents while online or offline is now very possible. Memeo Connect is available on both Windows and Mac platforms.







Our timeline for Memeo Connect was impossibly short due to Google’s aggressive timeline for launch. How did we do it?  Apart from the obvious late nights, junk food and beer, we received help from Google to take this product from concept to reality.  Some of it came in the form of new APIs, some directly from the Documents List API team, some from the client libraries and some from the discussion groups.



1. Keeping native file formats

Google Docs now supports keeping files in their native format.  Previously Microsoft Office files and images were converted to the online Google Document formats, removing much of the application specific formatting options used in the Office file formats.  However, its now possible to upload Microsoft Office files and images without conversion, meaning users can keep all of their custom file formatting.

You can get all of this with a simple parameter in the post URL when uploading the new document.

Google Documents List API

https://docs.google.com/feeds/default/private/full?convert=false










If like us, you use the client libraries, then its just as easy.

Google Data Objective-C client library**

NSURL *uploadURL = [[mDocListFeed postLink] URL];
GDataQueryDocs *uploadQuery = [GDataQueryDocs queryWithFeedURL:uploadURL];
[uploadQuery setShouldConvertUpload:NO];


Google Data .NET client library

string uploadURL = DocumentsListQuery.documentsBaseUri + "?convert=false";
docService.StreamSend(new Uri(uploadURL), fileStreamHandle, GDataRequestType.Insert, contentType, docTitle); 


The new features dont just handle Microsoft Office files.  Any file type is supported with no additional parameters or changes to client code, however the support for these features is only available through the Google Documents List API for users that have a Premier account.



2. Bigger file size limits and resumable uploads

Google Docs now supports file uploads up to 1GB and is resumable, so failed or paused uploads can pick up where they left off.

Google Documents List API
http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#ResumableUpload


Resumable post link:

resumable-create-media" type="application/atom+xml"
    href="https://docs.google.com/feeds/upload/create-session/default/private/full"/>


Request:

POST /feeds/upload/create-session/default/private/full HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization:
Content-Length: 0
Content-Type: application/pdf
Slug: MyTitle
X-Upload-Content-Type: application/pdf
X-Upload-Content-Length: 1234567



Resuming:

POST HTTP/1.1
Host: docs.google.com
Content-Length: 100000
Content-Type: application/pdf
Content-Range: bytes 0-99999/1234567



Google Data Objective-C client library**

Resumable uploads are automatically enabled when switching to the uploadLink URL

NSURL *uploadURL = [[mDocListFeed uploadLink] URL];
GDataQueryDocs * uploadQuery = [GDataQueryDocs queryWithFeedURL:uploadURL];

Pausing and resuming uploads is also made easy.

[mUploadTicket pauseUpload];
[mUploadTicket resumeUpload];

Google Data .NET client library

ResumableUploader resumableUploader = new ResumableUploader();
if (newFile)
    resumableUploader.Insert(authentication, docEntry);
else if (partialFile)
    resumableUploader.Resume(authentication, resumeUri, httpMethod, fileStream, cotentType);
else if (updateExistingFile)
    resumableUploader.Update(authentication, docEntry);

** Objective-C code samples have been taken from the Docs Sample code



3. Client Libraries for Mac & Windows

The Google Documents List API provides all of the backend server functionality but isnt ideal for rapid client application development.  As client developers, we prefer the efficiencies provided by a wrapper in our native client languages.  This is where the client libraries for Objective-C and .NET allowed us to shorten our application development time significantly.  Without the client libraries, we simply would not have been able to achieve our goals for Memeo Connect in the time we had available.

Many of the Documents List API features we worked with in our early development were not available through the client libraries.  This was initially quite daunting because of the risk that we would have to drop down to raw server calls and miss out on the efficiencies we gained through using the client libraries.  However as we got to know the client libraries better, we found they were written flexibly enough that we never had to do that - there was always a way to bend them enough to get what we needed.  A sign of great design by their architects.

For example uploading without conversion was simple in the Objective-C client library even before it was officially updated to support it.

NSURL *uploadURL = [[mDocListFeed postLink] URL];
GDataQueryDocs *uploadQuery = [GDataQueryDocs queryWithFeedURL:uploadURL];
[uploadQuery addCustomParameterWithName:@"convert" value:@"false"];



4. Support from Google

The Documents List API team were of enormous help throughout the course of this project.  As with most of Googles public APIs, theres always an avenue to ask questions about how to best use the technology, pursue bugs or request new features.  The new Google Apps Discussion Groups are simply the best way to get an answer quickly and is invaluable in getting past whatever is blocking your progress. Google Developer Relations people monitor the discussion groups and frequently answer questions, link to other relevant resources, and provide code samples.


Whats next?

We had a sizable list of things we really wanted to do with Memeo Connect 1.0 and some of that had to wait for 1.x or 2.0.  Were looking forward to continuing to work with Google and file as many feature requests as we can to make some of these new features a reality.  Anyone can file a feature request for Google Apps APIs and I can assure you they all get considered.

In future releases well be adding more support for direct file system integration, better tools to manage sharing and were really excited about supporting new devices.  Get ready to see more Google Docs in more places.
Read more »

Monday, March 9, 2015

Building an Idea Bank using Google Apps Script

Editor’s Note: This is a guest post by Saqib Ali. Saqib is a Google Apps evangelist at Seagate. He has used Apps Script to create a number of applications that leverage Google Apps. His other interests include the curation of Lewis Carroll’s letter and translation of Urdu poetry to English. -- Ryan Boyd

What is an Idea Bank?

Idea Banks are repositories for innovative ideas that Seagate employees can submit, and others can vote on those ideas. Before Google Apps Script we had a custom built Idea Bank on the LAMP stack. With the release of the UI Services in the Google Apps Script, we wanted to port that Idea Bank to Google Apps to easily manage idea submissions in a Google Spreadsheet.

Designing the Idea Bank

A typical Idea Bank consists of three basic functions:

  1. Ability to submit and store ideas to a central database.
  2. Ability to vote on ideas.
  3. Ability to add description comment on ideas.

A traditional application would probably use a Relational Database like MySQL to store the ideas. However we found that using Google Spreadsheet to store the ideas provides two inherent benefits:

  1. Entered data can be easily managed using the Spreadsheet Editor;
  2. Revision history. Since Spreadsheet provides built-in revision history, we don’t have to create a system for tracking the changes to the submitted ideas.

The number of votes, and the voters are tracked using cells in the spreadsheet. For voters we used the Session.getUser().getEmail() to get the email address of the logged in user, and store them in the spreadsheet.

Since the Ideas Bank is embedded in a Google Site, we were able to simply use the Google Sites Page as a place holder to add description and comments to the ideas. Once the idea is submitted, a Google Sites page gets created corresponding to that idea from predefined template using the createPageFromTemplace() function. The submitter can then add detailed description in the template. Others can add comments to that Site pages.

Implementation Details

Using Spreadsheet Services to Manage Data

All the data is stored in a Google Spreadsheet, which makes it easy for the Idea Bank manager to manage (delete, remove, modify) the ideas using the Spreadsheets Editor.

Code snippet for adding new ideas to the spreadsheet:

var ss = SpreadsheetApp.openById("");  // Spreadsheet id goes here
SpreadsheetApp.setActiveSpreadsheet(ss);
ideas_sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Ideas");

var last_row = ideas_sheet.getLastRow();
var next_empty_row = last_row+1;

ideas_sheet.setActiveCell("A"+next_empty_row);
ideas_sheet.getActiveCell().setValue(e.parameter.ideadescription);
ideas_sheet.setActiveCell("B"+next_empty_row);
ideas_sheet.getActiveCell().setValue(Session.getActiveUser().getUserLoginId());
ideas_sheet.setActiveCell("E"+next_empty_row);
ideas_sheet.getActiveCell().setValue(Session.getActiveUser().getEmail());

Code snippet to read the ideas from the Spreadsheet and display them:

var ss = SpreadsheetApp.openById(""); // Spreadsheet id goes here
SpreadsheetApp.setActiveSpreadsheet(ss);
ideas_sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Ideas");

var last_row = ideas_sheet.getLastRow();
var last_column = ideas_sheet.getLastColumn();
var sheet_array = ideas_sheet.getRange(2, 1, last_row, last_column).getValues();

var submitIdeaButton = app.createButton("I have another idea");
var submitIdeaButtonHandler = app.createServerClickHandler(showSubmitIdeaDialog);
submitIdeaButton.addClickHandler(submitIdeaButtonHandler);
applyCSS(submitIdeaButton, _submitideabutton);

var ideaContents = app.createGrid().resize(last_row,3);
ideaContents.setId("ideacontents");
ideaContents.setWidth("100%");
ideaContents.setCellSpacing(0);
scrollPanel.add(ideaContents);
app.add(scrollPanel);

for (var row_i = 0; row_i < last_row-1; row_i++) {
var ideaDescriptionLabel = app.createLabel(sheet_array[row_i][0]).setStyleAttribute("font","16px Sans-serif").setWordWrap(true);
var submitter = sheet_array[row_i][1].split("@");
var ideaAuthor = app.createLabel(submitter[0]).setStyleAttribute("font","10px Courier New, Courier, monospace").setStyleAttribute("color", "#CCC")
ideaContents.setWidget(row_i, 0, app.createVerticalPanel().add(ideaDescriptionLabel).add(ideaAuthor)).setStyleAttribute("overflow","visible").setStyleAttribute("white-space","normal !important");

//Button to display the voters
var numberOfVotesForm = app.createFormPanel().setId(numofvotesform);
var numberOfVotesFormContent = app.createVerticalPanel()
numberOfVotesForm.add(numberOfVotesFormContent);
numberOfVotesFormContent.add(app.createTextBox().setName(ideaID).setText(row_i + "").setVisible(false).setSize("0","0"));
numberOfVotesFormContent.add(app.createTextBox().setName(voters).setText(sheet_array[row_i][4]).setVisible(false).setSize("0","0"));
var numberOfVotesButton = app.createButton(countVotes(sheet_array[row_i][4]) + " vote(s)").setId("numberOfVotesButton"+row_i);
applyCSS(numberOfVotesButton, _numofvotesbutton);
var numberOfVotesButtonHandler = app.createServerClickHandler(showVotersDialog);
numberOfVotesButtonHandler.addCallbackElement(numberOfVotesFormContent);
numberOfVotesButton.addClickHandler(numberOfVotesButtonHandler);
numberOfVotesFormContent.add(numberOfVotesButton);

//Button to cast a vote
var voteForm = app.createFormPanel().setId(voteform);
var voteFormContent = app.createVerticalPanel();
voteForm.add(voteFormContent);
voteFormContent.add(app.createHidden(ideaID, row_i + "").setSize("0","0"))

// Identify the function schedule as the server click handler
var voteButton = app.createButton(I like this!).setId("voteButton"+row_i)
var voteButtonHandler = app.createServerClickHandler(casteVote);
voteButtonHandler.addCallbackElement(voteFormContent);
voteButton.addClickHandler(voteButtonHandler);
if (sheet_array[row_i][4].indexOf(Session.getActiveUser().getEmail())>-1)
voteFormContent.add(voteButton.setText("Thanks!").setEnabled(false));
else
voteFormContent.add(voteButton);

ideaContents.setWidget(row_i, 1, numberOfVotesForm);
ideaContents.setWidget(row_i, 2, voteForm);
}
app.add(submitIdeaButton);

Using Ui Services to embed User Interface in Google Sites

Ui Service was used to build the front end for the app. UI Services are based on GWT, so it is a good idea to have a basic understanding of the GWT framework. The following were used in building this app:

  1. Horizontal panel to display each idea;
  2. Vertical panel to display the list of ideas;
  3. Simple button to cast votes and submit ideas;
  4. Form panel to accept new ideas.

A real live working example is available here. Full source code is available here.

But why Google Apps Script?

So why did I choose Google Apps Script? Well for one it is at no extra cost, comes with your Google Account, it is in the cloud (i.e. no servers required), integrates well with Google Sites and Spreadsheets, and most importantly it uses GWT UI widgets. Google Apps Script’s UI Services and the ability to easily integrate with any REST interface make Apps Script an easy choice.

Saqib Ali

Saqib is a Google Apps evangelist at Seagate. He has used Apps Script to create a number of applications that leverage Google Apps. His other interests include the curation of Lewis Carroll’s letter and translation of Urdu poetry to English.

Read more »

Wednesday, February 18, 2015

HowTo Finding the Corners of a Rectangle using Image Magick and Perl

Problem:
I need to find the x and y coordinates of the corner of a rectangle in an image. The rectangle in the image is may either be rotated or not. The background of the rectangle in the image should be transparent if it is angled.
Solution: 
(I dont know if such algorithm like this exists, but if there is non, lets just call it Foobaring Rectangle Corner Detector Algorithm, hehehe)

1. determine the width and height of the image
2. inspect each pixel from upper left to lower right.
3. check each pixel who has and opacity of < 1, get the coordinates with the biggest x, and get the coordinates of the pixel with the smallest y
4. inspect each pixel again, but this time, you start from lower right going to upper left.
5. check each pixel who has and opacity of < 1, get the coordinates with the smallest x, and get the coordinates of the pixel with the biggest y
6. there you have it, you now have the coordinates of each of the corners of the rectangle

Sample Code:
(written in perl, incomplete code, just showing you the idea, I used Image::Magick to access the pixels of the image)

my $Ax = 0;
my $Ay = 0;
my $Bx = $width;
my $By = $height;
my $Cx = 0;
my $Cy = $height;
my $Dx = 0;
my $Dy = 0;
for(my $x = 0;$x<=$width;$x++){
for(my $y = 0;$y<=$height;$y++){
my $pixel = $im->GetPixel(x=>$x,y=>$y,channel=>opacity);
if($pixel < 1){
# big-x big-y
if($Ax <= $x){
$Ax = $x;
$Ay = $y;
}
if($Cy >= $y){
$Cy = $y;
$Cx = $x;
}
}
}
}
for(my $x = $width;$x>=0;$x--){
for(my $y = $height;$y>=0;$y--){
my $pixel = $im->GetPixel(x=>$x,y=>$y,channel=>opacity);
if($pixel < 1){
# small-x small-y
if($Bx >= $x){
$Bx = $x;
$By = $y;
}
if($Dy <= $y){
$Dy = $y;
$Dx = $x;
}
}
}
}
print "---- COORDINATES ----
";
print "($Ax,$Ay)
";
print "($Bx,$By)
";
print "($Cx,$Cy)
";
print "($Dx,$Dy)
";

Notes:
1. The coordinates generated by this is code will not exactly give you a perfect rectangle, this is probably because of the anti-aliasing of the image. I think this will produce a perfect rectangle if used on an image without anti-alias and if the pixel count of the rectangle is a whole number. This is just a hunch, not proven yet.
2. This code is a bit slow because I iterated through all the pixels of the image 2 times. If you can recommend a better way of doing this, feel free to comment.
3. If you found circumstances where this is not applicable, please comment, thanks.
Read more »

How to Bypass Cyberoam by using Wayback Machine to Access Blocked Sites on Wi Fi 100 Working

How to Bypass Cyberoam by using Wayback Machine to Access Blocked Sites on Wi-Fi [100% Working]

Does your college/school/office have blocked sites on wi-fi? Are you not able to get access? Then probably you are at the right place. The same has happened with me. In my college sites are blocked by using a firewall known as Cyberoam. By doing a lot of search I came to a solution. Here we are going to use Wayback Machine to get over this kind of problem. I have personally tested this and it is 100% working. This method will also work for any other firewalls. So before going through the solution let’s take a brief knowledge about wayback machine.

Also Read: Google Gravity: How to Hack Google Homepage (Funny Trick)
Also Read: Using a VPN Service – How to Hide Yourself Online

What is Wayback Machine?

The Wayback Machine is a web site that allows you to see any particular site like it looks in past. It’s same as like using a time machine to go back in past. When you will paste the url of you site that you want to visit, then it will show a calendar with snapshots of a particular day and even a particular hour.

Wayback machine is a great solution to access blocked sites but it has some limitations.

1. Sometimes the site performance is very slow and it is unable to crawl some web pages.
2. In case it will not show recent snapshot then you will be not able to see the contents of a particular site that has been updated recently.
3. You can’t use any download manger to download files. You can download only through the browser.

How to Access Blocked Sites using Wayback Machine?

1. First of all go to link web.archive.org
2. Now paste the url of the site that you want to visit in the given box and then click on ‘Take Me Back’, as shown in below image.

How to Bypass Cyberoam by using Wayback Machine to Access Blocked Sites on Wi-Fi [100% Working]


3. After that a calendar will be displayed with different snapshots.

How to Bypass Cyberoam by using Wayback Machine to Access Blocked Sites on Wi-Fi [100% Working]

4. Then click on your desired snapshot, now you will be able to see the 
blocked site.

In this way you can get access to restricted sites and can download files on wi-fi or on any other network. If you have any other methods then please do share it with us by commenting below. 
Read more »

Saturday, February 14, 2015

How To Hack WPA WPA2 WiFi Password Using Reaver

How To Hack WPA WPA2 WiFi Password Using Reaver
Hack WiFi Password Using Reaver



"Crack WPA/WPA2 Wireless Password Using Reaver"






















Reaver Is Great In Cracking ~WPA/WPA2 Protected Passwords any Forcing The WPS Pins On The
Routers which have WPS/ Push button enabled on them but the problem is that there are thousonds of
pins which Reaver has to brute force and this requires much time to hack the password

But I Have bought a soloution for you in which you will be crack the WiFi Password in just 2-3 hours of average time which which i have considered.


Whats The Logic?

The Logic is simple if you can understand , Reaver current version brute force 8 digit pin code (WPS Pin Code) and it took more time in cracking 8 digit pin code but if we command Reaver to crack 4 digit of pin code in first session and the rest of 4 digit pin code in second session and in this way we can crack the WiFi Password easily in 2-3 hours and even less than in hour , like i Myself cracked my WiFi Password In Just 1 & half hour.


reaver -i mon0 -f-c "Channel No" -a -b BSSID -v -d 0 -vv


EG:- reaver -i mon0 -f -c 5 -a -b 00:25:5E:95:01:EE -v -d 0 -vv

Note:- Always Try To hack the WiFi Which have strongest Signals , because Reaver will be able to inject the pin code easily in few seconds as when i was cracking Reaver was injecting the Pin Code In Less than second nearly a 1 second per pin and this took me 1 and half hour in cracking.



Errors Soloutions:-




Majority Of peoples are noob and they get few errors and then they dont know what to do .

if you are getting (0x03) or (0x03) error then please try to hack the router which have strongest signals this error means that the router which you are cracking has low signal streangth.

WPS failed to inject pin or something like this this error then then they are possibly few reasons behind this,

  1. The router which you are cracking is advance router which is not easy to crack because when
    Reaver tried to brute forced bunch of pins with combination one after another then router itself
    block us from sending the request to enter the pin code for this we will try to use the advance
    option in Reaver which will check the AP limit for router and will wait for few seconds after
    Injecting the Pin.just after the command put -a and done.
  2. The router which you are trying to hack has WPS locked or does not contain WPS enabled

If You are Facing any Problem kindly do comment and i will be able to answer your question as soon as Possible.







Read more »

Thursday, February 12, 2015

C Program to do arithmetic operations according to user choice using switch case

include<iostream.h>
#include<conio.h>

void main()
{       clrscr();
int a,b;
char c;
cout<<"Enter any expression(ex:3*7):";
cin>>a>>c>>b;

switch(c)
{
case+: cout<<"
Result:"<<a+b;

break;

case-: cout<<"
Result:"<<a-b;

break;

case*: cout<<"
Result:"<<a*b;

break;

case/: cout<<"
Result:"<<a/b;

break;

case%:  cout<<"
Result:"<<a%b;

break;
}

getch();
}
Read more »

C Templates Program to Swap Two Numbers Using Function Template

C++ Templates: Program to Swap Two Numbers Using Function Template

What are Templates in C++?
Templates help in defining generic classes and functions and hence allow generic programming. Generic programming is an approach where generic data types are used as parameters and the same piece of code work for various data types.

Function templates are used to create family of functions with different argument types. The format of a function template is shown below:

template<class T>
return_type function_name (arguments of type T)
{
                . . . . .
                . . . . .
}

I have written a program below which will swap two numbers using function templates.

#include<iostream>

using namespace std;

template <class T>
void swap(T&a,T&b)      //Function Template
{
    T temp=a;
    a=b;
    b=temp;
}

int main()
{
    int x1=4,y1=7;
    float x2=4.5,y2=7.5;

    cout<<"Before Swap:";
    cout<<"
x1="<<x1<<" y1="<<y1;
    cout<<"
x2="<<x2<<" y2="<<y2;

    swap(x1,y1);
    swap(x2,y2);

    cout<<"

After Swap:";
    cout<<"
x1="<<x1<<" y1="<<y1;
    cout<<"
x2="<<x2<<" y2="<<y2;

    return 0;
}

There are so many things that I have missed in this tutorial. In below video templates are explained very nicely. I am sure that after watching this video you will understand templates very easily.

Read more »

Wednesday, February 11, 2015

C Program to Print Numbers From 1 to n Without Using Loops Recursion or Goto Statement

You may have made program to print numbers from 1 to n using loops, recursion or goto statement. But have you ever thought about doing this without help of loops, recursion or goto? It can be done without using such things as explained in below program.

Also Read: C program to find factorial of any number using recursion
Also Read: C++ Templates: Program to Swap Two Numbers Using Function Template

#include<iostream>

using namespace std;

class Num
{
    public:
    static int i;
    Num()
    {
        cout<<i++<<" ";
    }
};

int Num::i=1;

int main()
{
    int n;
    cout<<"Enter value on n:";
    cin>>n;
    Num obj[n];
    return 0;
}

In this program we are using the concept of static data member and array of objects. Class Numcontains a static variable i whose value will remain till the program terminates. We are creating an array of objects of class Num. In this program we are creating n objects, value of n depends on input we give. The default constructor is called for all objects one by one. In the constructor the value of i is printed and is incremented by one in each call. In this way numbers from 1 to n are printed.

C++ Program to Print Numbers From 1 to n Without Using Loops, Recursion or Goto Statement

If you have any doubts or any suggestion regarding above program then you can ask it by commenting below.

Source: http://www.geeksforgeeks.org/output-of-c-program-set-18-3/
Read more »

C program to find whether a given character is an alphabet digit or any special character using ASCII values


#include<stdio.h>
#include<conio.h>


void main()
{
    char ch;
    clrscr();    //to clear the screen
    printf("Enter any character:");
    scanf("%c",&ch);
    if((ch>=A&&ch<=Z)||(ch>=a&&ch<=z))
        printf("
You have entered an alphabet");

    else
        if(ch>=0&&ch<=9)
            printf("
You have entered a digit");

        else
            printf("
You have entered a special character");



    getch();    //to stop the screen
}
Read more »

Creating “HelloAndroid” project using android studio

To create a project in android studio please follow the following steps.
1.       Run android studio  


2.       Create a new project



3.       Choose options for basic settings



4.       Choose activity type for default activity



5.       Set name for default activity


6.       System will create project now

7.       Navigate to layout folder according to below image

8.       Double click on activity_hellow_activity.xml file
9.       Run application


10.   System will display output 

Read more »