Skip to content

Commit 9422d49

Browse files
committed
Update README.md
Change formatting
1 parent 0536e68 commit 9422d49

1 file changed

Lines changed: 65 additions & 71 deletions

File tree

README.md

100644100755
Lines changed: 65 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,109 @@
1-
Instructions to run the Twitter Influence Analyzer Application(Java version):
1+
# How to Run and Deploy the Twitter Influence Analyzer #
22
==========================================
33

4+
## Prerequisites ##
45

5-
Using the terminal/command line interface:
6-
------------------------------------------
6+
Before we begin, we first need to install the command line tool that will be used to upload and manage your application. Cloud Foundry uses a tool called [**cf**](https://github.com/cloudfoundry/cf). This tool is written in Ruby, so you must have Ruby installed. If you are running on Windows, you can install Ruby from [this](http://rubyinstaller.org/downloads/) website.
77

8-
- **Prerequisites:**
9-
- Before we begin, we first need to install the command line tool that will be used to upload and manage your application. Cloud Foundry uses a tool called [**cf**](https://github.com/cloudfoundry/cf). This is a Ruby application, so you must have Ruby installed. If you are running on Windows, you can install Ruby from [this](http://rubyinstaller.org/downloads/) website.
10-
- For Linux systems, consult your documentation for how to install the **ruby** package - for Ubuntu the command **apt-get install ruby** should work for you.
8+
For Linux systems, consult your documentation for how to install the **ruby** package - for Ubuntu the command:
119

12-
- Once Ruby is installed, cf can be installed by using the **gem install** command:
13-
14-
\> **gem install cf**
10+
apt-get install ruby
11+
12+
should work for you.
13+
14+
Once Ruby is installed, cf can be installed by using the **gem install** command:
1515

16-
- **Download and Load App Into Eclipse**
17-
- There are two ways to download the app and import it into Eclipse:
18-
- 1. Import the Eclipse project by following these instructions:
19-
- A. clone the current repository, i.e.
20-
**git clone https://github.com/ibmjstart/bluemix-java-twitter-search.git**
21-
- B. Open Eclipse
22-
- C. Then File->Import
23-
- D. Under the header labeled "General", click "Existing Projects Into Workspace" and click Next
24-
- E. Click "Browse" next to the first text field, and navigate to the cloned repository and find the folder labeled "app" and click ok.
25-
- F. Under Projects you should now see a project called "TwitterSearch", make sure the checkbox next to the "TwitterSearch" project is checked and then click "Finish
26-
- G. You should now see the "TwitterSearch" project in your list of projects in Eclipse.
16+
gem install cf
2717

28-
- 2. Import the WAR File
29-
- A. Navigate to https://github.com/ibmjstart/bluemix-java-sample-twitter-influence-app/releases
30-
- B. Click the green button labeled "twitter_influence_analyzer.war" and that will download the WAR file.
31-
- C. Open Eclipse
32-
- D. Then File->Import
33-
- E. Scroll down to the "Web" section, expand that section and click WAR File then click Next.
34-
- F. Click next and then Finish and the project should be imported into Eclipse
18+
## Download the App ##
3519

36-
- **Overview of the app:** This is a Java Web(Standalone) app that uses the following cloud service:
37-
- MongoDB (backend database)
20+
The source for this app is at GitHub so, for example, if you are using the command line you can clone the repository like this:
3821

39-
- **Download and modify app code:**
40-
- **Download the app**
41-
- clone the current repository, i.e.
42-
**git clone https://github.com/ibmjstart/bluemix-java-sample-twitter-influence-app.git**
22+
git clone https://github.com/ibmjstart/bluemix-java-sample-twitter-influence-app.git
23+
24+
If you want to use Eclipse to work on it, there are two ways you can get the source into Eclipse:
4325

44-
- **External and Public APIs:**
26+
1. Import the Eclipse project by following these instructions:
27+
1. Start by cloning the repository, as described above
28+
2. Open Eclipse
29+
3. Select File->Import
30+
4. Under the header labeled "General", click "Existing Projects Into Workspace" and click Next
31+
5. Click "Browse" next to the first text field, and navigate to the cloned repository and find the folder labeled "app" and click ok.
32+
6. Under Projects you should now see a project called "twitter_influence_analyzer", make sure the checkbox next to the "twitter_influence_analyzer" project is checked and then click Finish
33+
7. You should now see the "twitter_influence_analyzer" project in your list of projects in Eclipse.
4534

46-
This app uses some external APIs. You need to register the app with Twitter and Klout to get the keys and tokens.
35+
2. Import the WAR File
36+
1. Navigate to https://github.com/ibmjstart/bluemix-java-sample-twitter-influence-app/releases
37+
2. Click the green button labeled "twitter_influence_analyzer.war" and that will download the WAR file.
38+
3. Open Eclipse
39+
4. Then File->Import
40+
5. Scroll down to the "Web" section, expand that section and click WAR File then click Next.
41+
6. Click next and then Finish and the project should be imported into Eclipse
4742

48-
- **Twitter v1.1 API:**
43+
This is a Java app that uses the following cloud services:
4944

50-
To access the Twitter API you need the consumer keys and access tokens, so you must register the app with Twitter. You can register your app [here](https://dev.twitter.com/).
45+
- Company Text Analytics Service
46+
- Name Text Analytics Service
47+
- MongoDB (backend database)
5148

52-
[More information on how to register the app with Twitter](registerTwitter.md)
49+
## External and Public APIs ##
5350

54-
- **Klout API:**
51+
This app uses some external APIs. You need to register the app with Twitter and Klout to get the keys and tokens.
5552

56-
You can register the app with Klout [here](http://developer.klout.com/member/). When you register with Klout, you'll get a Klout Key, which you can use to create a Klout Object as shown in the code.
53+
### Twitter v1.1 API ###
5754

58-
- **Google Maps v3 API:**
55+
To access the Twitter API you need the consumer keys and access tokens, so you must register the app with Twitter. You can register your app [here](https://dev.twitter.com/).
5956

60-
This app uses the Google Maps v3 APIs. Google APIs are open for the developers and you do not need to register the app with Google. Here's the [link](https://developers.google.com/maps/documentation/javascript/tutorial) for the Google Maps APIs.
57+
[More information on how to register the app with Twitter](registerTwitter.md)
6158

62-
- The twitter credentials are entered in the file called as twitter4j.properties which is present in the classpath (src directory). Just copy paste the credentials in twitter4j.properties file that you get after registering the app with twitter. Also the Klout API key is entered in the file called klout.properties present in the classpath as shown below:
59+
### Klout API ###
6360

64-
![image](/images/klout_key.png)
61+
You can register the app with Klout [here](http://developer.klout.com/member/). When you register with Klout, you'll get a Klout Key, which you can use to create a Klout Object as shown in the code.
6562

66-
- **Deploy the App:**
63+
### Google Maps v3 API ###
6764

68-
Now that you have included the twitter keys and tokens and klout key as shown above, you are all set to deploy the app. In the terminal, go in the directory of the app. The application is wrapped in a WAR file. You can directly deploy/push the WAR file using push command:
65+
This app uses the Google Maps v3 APIs. Google APIs are open for the developers and you do not need to register the app with Google. Here's the [link](https://developers.google.com/maps/documentation/javascript/tutorial) for the Google Maps APIs.
6966

70-
\> **cf push**
67+
The twitter credentials are entered in the file called as twitter4j.properties which is present in the classpath (src directory). Just copy paste the credentials in twitter4j.properties file that you get after registering the app with twitter. Also the Klout API key is entered in the file called klout.properties present in the classpath as shown below:
7168

72-
Just follow the instructions on the screen. You can select the default settings for deploying the app, i.e. for URL, memory reservations (512 Recommended), number of instances. You need to bind the MongoDB service to the app.
69+
![image](/images/klout_key.png)
7370

74-
Binding a Service to Your App
71+
## Deploying the App ##
7572

76-
- Create the service instance and bind the service instance while deploying the app. The **cf push** command will ask, "Create services to bind to 'appname'?" Answer yes and go through the menu. See the screenshots of a sample app push below for more clarity.
73+
Once you have included the Twitter keys and tokens and Klout key as shown above, you are all set to deploy the app. In the terminal, go in the directory of the app. The application is wrapped in a WAR file. You can directly deploy/push the WAR file using push command:
7774

78-
Note: This app expects details of the mongoDB service to be present in the environment variables and will generate exception if you try to deploy it without first binding the service.
75+
cf push
7976

80-
Here are some snapshots of how one would deploy the app and create services required for the app:
81-
82-
![Deploy steps](/images/push-app1.png)
77+
Just follow the instructions on the screen. You can select the default settings for deploying the app, i.e. for URL, memory reservations (512 Recommended), number of instances. You need to bind the MongoDB service to the app.
8378

84-
![Deploy steps](/images/push-app-2.png)
79+
### Binding a Service to Your App ###
8580

86-
![Deploy steps](/images/push-app-3.png)
81+
For the app to function correctly, you must create the service instance and bind the service instance while deploying the app. The **cf push** command will ask, "Create services for application?" Answer yes, then you will be presented with a list of services. Choose **mongodb** from this list. Below, you can see some screenshots of what this should look like when deploying from the command line.
8782

83+
![Deploy steps](/images/push-app1.png)
8884

89-
- After the application is deployed using **cf push**, you can check the status of the app using the following command: **cf apps**. If the status is RUNNING, you can hit the URL in the browser and see the application is running.
85+
![Deploy steps](/images/push-app-2.png)
9086

87+
![Deploy steps](/images/push-app-3.png)
9188

92-
Troubleshooting
93-
-----------------------------------
94-
- Sometimes your app may not work as expected and debugging needs to be done. The cf command line tool can be used to assist with debugging. With the cf you can check your app's logs by typing the command **cf logs [app_name]**
89+
- After the application is deployed using **cf push**, you can check the status of the app using the following command: **cf apps**. If the status is RUNNING, you can hit the URL in the browser and see the application is running.
9590

96-
- When you first start using the cf tool, you may potentially have trouble logging in due to no target being set. To view the target that is set, type **cf target** and if you want to set a new target type **cf target [target_url]**. Note: The target URL will usually be in the form of http://api.xxx.tld
91+
## Troubleshooting ##
9792

93+
- Sometimes your app may not work as expected and debugging needs to be done. The cf command line tool can be used to assist with debugging. With the cf you can check your app's logs by typing the command **cf logs [app_name]**
94+
- When you first start using the cf tool, you may potentially have trouble logging in due to no target being set. To view the target that is set, type **cf target** and if you want to set a new target type **cf target [target_url]**. Note: The target URL will usually be in the form of http://api.xxx.tld
9895
- From time to time your app may stop working, this means it could require a restart. To do this you must first stop it by typing **cf stop**. Once the app has been stopped, you can type **cf start** and if there are no other problems your app should start.
9996

97+
## Screenshots ##
10098

101-
Some screen-shots of the running app
102-
------------------------------------
103-
104-
- This is the home screen of the app. You can enter a twitter screen name in the text box and click the Analyze button to see their influence. You can also view any records saved in the database by clicking on the 'View Database' button.
105-
106-
![image](/images/home.png)
99+
This is the home screen of the app. You can enter a twitter screen name in the text box and click the Analyze button to see their influence. You can also view any records saved in the database by clicking on the 'View Database' button.
107100

108-
- After entering the twitter name and clicking the Analyze button, you'll be able to see the influence analysis of that person on the left side. You will also see their last 10 tweets and any recent mentions in the tweets plotted on Google Maps (if there is geolocation data for a tweet).
101+
![image](/images/home.png)
109102

110-
![image](/images/results.png)
103+
After entering the twitter name and clicking the Analyze button, you'll be able to see the influence analysis of that person on the left side. You will also see their last 10 tweets and any recent mentions in the tweets plotted on Google Maps (if there is geolocation data for a tweet).
111104

112-
- These are the records of the Influencers in the database. The user can also delete the records.
105+
![image](/images/results.png)
113106

114-
![image](/images/saved_records.png)
107+
These are the records of the Influencers in the database. The user can also delete the records.
115108

109+
![image](/images/saved_records.png)

0 commit comments

Comments
 (0)