Graphite Custom page Creation


We have some procedures to Create the custom page for Graphite. The brief steps are,
   Define the URL path
   Create the Sample page Directory
   Create the Sample page HTML view
   Link the HTML with specific folder
   Call the Html from specific folder using Python


Step 1:
We have to set the URL path in urls.py file which is located in /opt/graphite/webapp/graphite/urls.py . In this file we have some set of line which contain the url paths . So inside of this line we have to add our own web path with the same pattern.
Example: If we have a Directory called Test (With my own functions) then we have to add a line in this file url.py with the same pattern as below,
('^Test/', include('graphite.Test.urls')),
^Test/                                  : This is the URL extension (What we type after localhost)
graphite.Test.urls : Calling the python URL file which is in graphite/test/
Note : URL extensions are Case sensitive .To avoid the complex make all links as lower case
Step 2:
Now we have to create the sample Directory. So to avoid the complex of the implementation we can copy the browser directory which is located in /opt/graphite/webapp/graphite/ and rename the browser directory as Test. Paste it in same location (/opt/graphite/webapp/graphite/) So the Test Directory will contain the same files, which are in default page. Now we can edit the Test folder which contain url.py and views.py files. Each file we have some small changes.
The /opt/graphite/webapp/graphite/test directory contain url.py and views.py. Now change the graphite.browser.views as graphite.test.views to access our own page.
Similar Change the browser.html page as test.html in views.py file.
/opt/graphite/webapp/graphite/templates/test.html
Step 3:
Now we have to Create the HTML page for test with that what we mention above .So for that we have to create html file in /opt/graphite/webapp/graphite/templates/ as test.html.
Step 4:
Design the Page with your own Specification.
So finally we have to work with only three files for custom page creation
urls.py
views.py
test.html
Done.

Make file Sample Code for Porting libRFID from Linux to Anroid


MY_PATH := $(call my-dir)/librfid-0.2.0

LOCAL_PATH := $(MY_PATH)/src/ \
  $(MY_PATH)/src/ccid

include $(CLEAR_VARS)

# path for Header files
LOCAL_C_INCLUDES := $(MY_PATH)/include

#C files added from the src/ path
LOCAL_SRC_FILES := usleep.c rfid.c rfid_scan.c rfid_reader.c rfid_reader_spidev.c rfid_reader_rc632_common.c \
rfid_reader_openpcd.c rfid_reader_cm5121.c rfid_reader_cm5121_openct.c rfid_protocol.c \
rfid_proto_tcl.c rfid_proto_tagit.c rfid_proto_mifare_ul.c rfid_proto_mifare_classic.c rfid_proto_icode.c \
rfid_layer2.c rfid_layer2_iso15693.c rfid_layer2_iso14443b.c rfid_layer2_iso14443a.c rfid_iso14443_common.c \
rfid_asic_rc632.c rfid_access_mifare_classic.c libusb_dyn.c

#C files added from utils
LOCAL_SRC_FILES := utils/common.c utils/librfid-tool.c utils/mifare-tool.c utils/send_script.c

#C files added from the src/ccid path
#here we are not using the file rfid_reader_cm5121_ccid_direct.c because it is used by rfid_reader_cm5121.c as 
#reference
LOCAL_SRC_FILES := ccid-driver.c 

#Module path of the library
LOCAL_MODULE := test_rfid_integration_RfidLib
LOCAL_LDLIBS := -llog


include $(BUILD_SHARED_LIBRARY)

Twitter BootStrap Samples

Bootstrap is a CSS Framework developed by Twitter. It is an Open Source So everybody can use it . We can build very Cool and awesome  websites from this CSS styles. It contains buttons, Forms, Text Boxes and Tables as well.
The main advantage is we can build this using a simple text editor. Because we are just importing the Styles which are in Twitter Bootstrap.


First Of All we have to download Bootstrap from ,http://twitter.github.com/bootstrap/ the link. It Contain CSS ,IMG and JS Zipped file. Extract and copy the Files in a directory where you want to create your website.
Create an index HTML Page in your website directory where you copied the Bootstrap files.

Path definition :
We have to define the  bootstrap files paths that we want to use in our web page. like bellow,

<html>
<head>
</head>
<link type="text/css" rel="stylesheet" href= "css/bootstrap.css" />
<body>
<script src="js/bootstrap.js"> </script>
</body>
</html>


Sample Form Creation :
First we will look are creating the Form for username and password. So for that we are using the class name as “well” which is in bootstrap css.

<html>
<head>
</head>
<link type="text/css" rel="stylesheet" href= "css/bootstrap.css" />
<body>

<form class="well form-search">

    <input type="text" class="span3 search-query" placeholder="Search..."/>
    <button class="btn">Search</button>
    </form>

<form class="well span6">
    <label>UserName</label>
       <input type="text"class="span3" placeholder="Enter username ..."/></br>
       <label>Password</label>
       <input type="text"class="span3" placeholder="Enter password ..."/></br>
       <button class="btn btn-primary">Submit</button>
       <button class="btn">Clear</button>
   </form>
<script src="js/bootstrap.js"> </script>
</body>
</html>

After this Form creation if you get wow feeling please hit a comment.

Creating Tables:

sample file


<html>
<head>
</head>
<link type="text/css" rel="stylesheet" href= "css/bootstrap.css" />
<body>
<table class="table table-striped">
    <thead>
        <tr>
            <th>ID</th>
               <th>Name</th>
               <th>Age</th>
           </tr>
       </thead>
       <tbody>
      <tr>
           <td>1</td>
           <td>Dhanu</td>
           <td>20</td>
           </tr>
           
      <tr>
           <td>2</td>
           <td>Dhanu_2</td>
           <td>20_2</td>
           </tr>
       </tbody>
   </table>
<script src="js/bootstrap.js"> </script>
</body>
</html>




Graphite : Real Time Graphing Installation


Installed packages has been updated.
sudo apt-get update

Supported libraries has been installed using below command,Also this will installe the django as well
sudo apt-get install --assume-yes apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 python3.2 libpython3.2 python3.2-minimal libapache2-mod-wsgi libaprutil1-ldap memcached python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 erlang-os-mon erlang-snmp rabbitmq-server bzr expect ssh libapache2-mod-python python-setuptools

The applications has been downloaded,
Carbon
Graphite
Whisper

 To install whisper
 cd ~/whisper  
 sudo python setup.py install  

 To install Carbon
 cd ~/carbon  
 sudo python setup.py install  

 To configure Carbon  
 cd /opt/graphite/conf  
 sudo cp carbon.conf.example carbon.conf  
 sudo cp storage-schemas.conf.example storage-schemas.conf  

 To set duration of the Graphite
 sudo gedit storage-schemas.conf  
 Edit the data with below test,  
 [stats]  
 priority = 110  
 pattern = .*  
 retentions = 10:2160,60:10080,600:262974  
 Graphite has been installed after check the dependencies , 
 If you it give an error with dependencies then fix and 
 go forward .sudo python check-dependencies.py  
 sudo python setup.py install  

 Apache server has been configured for graphite,  
 cd ~/graphite/examples  
 sudo cp example-graphite-vhost.conf /etc/apache2/sites-available/default  
 sudo cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi  
 sudo vim /etc/apache2/sites-available/default  
 sudo mkdir /etc/httpd  
 sudo mkdir /etc/httpd/wsgi  
 sudo /etc/init.d/apache2 reload  

 Initial database has been created for graphite,  
 cd /opt/graphite/webapp/graphite/  
 sudo python manage.py syncdb  

 Here give the user name and password for you database  
 sudo chown -R nobody:nobody /opt/graphite/storage/  
 sudo /etc/init.d/apache2 restart  

 cd /opt/graphite/webapp/graphite  
 sudo cp local_settings.py.example local_settings.py  

 Start the Carbon  
 cd /opt/graphite/  
 sudo ./bin/carbon-cache.py start  

 Send the data to the Graphite  
 cd ~/graphite/examples  
 sudo chmod +x example-client.py  
 sudo ./example-client.py  

 Go to web browser and launched localhost .  
 Done.   

Graphiti: An Alternate Frontend for Graphite


Graphite is a powerful front end for the real-time graphing engine. Graphiti provides a whole new way of creating and storing graphs. This was using in day-to-day at Paperless as a way to monitor the infrastructure and product metrics. 

There’s been a big push in the development community on the need and desire for metrics to drive the business, product, and development cycles. Therefore it will definitely help full to the organisation which are based on  analysis and multi task processes.

Accounting data is not real-time, but it is precise. It’s generated nightly by some very awesome and complex SQL functions and collations by our venerable analytics lead. These numbers are hard facts and they give the information  to make important big decisions.

Difference between D3.js and Graphiti
D3 allows you to bind arbitrary data to a Document Object Model (DOM), and then apply data-driven transformations to the document. This can use D3 to generate an HTML table from an array of numbers. Or, use the same data to create an interactive SVG bar chart with smooth transitions and interaction.

So D3.js contain many kind of visualisation view something like table view, tree maps, bubble charts and more.But Graphiti is not contain that kind of fancy things. It's only the contain the specialised graph visualisation .

Therefore Graphiti is more use full when you are going to deal with some kind of analysis and comparing projects 

Write to ADB Log terminal from Java and native code

Usually when we deal with High level programming we should maintain the log information something line debugging because we may have bunch of log data when the system is compiling. Therefore in Android native programming most of the time we deal with c and java.

To track the log in Android native project.

  1. run the android virtual machine using eclipse 
  2. open terminal 
  3. go to the specific folder
  4. command adt logcat to view the log information (This will only run while your android virtual machine is running ,if not it will giving a message like bellow)
Dhanushanths-MacBook-Pro:RFIDIntegration dhanus$ adb logcat
- waiting for device -


From Java
First we see how to pass log information form Java,
Pass the log data information from Java to adb log cat is pretty simple


package test.rfid.integration;
import android.util.Log;------------------------(1)
public class RfidLib {
//Write a own lines in Log using terminal 
public static final String TAG = "Test"; ------------(2)
public static int addValueJ(int x,int y){
Log.d(TAG,"*********The log data from the Java Method************");-----(3)
int sum = x+y;
return sum;
}
public native static int addValueN(int x,int y);
static{
System.loadLibrary("test_rfid_integration_RfidLib");
}
}

you have to add that 3 mentioned lines in your code. Also don't forget to add the LOCAL_LDLIBS line in make file 


LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := test_rfid_integration_RfidLib.c
LOCAL_MODULE := test_rfid_integration_RfidLib
LOCAL_LDLIBS := -llog ---------------(make line)
include $(BUILD_SHARED_LIBRARY)


From Native
Here we can call the log from native code,

#include "test_rfid_integration_RfidLib.h"
#include <android/log.h> ----------------(1)

/*
 * Class:     test_rfid_integration_RfidLib
 * Method:    addValueN
 * Signature: (II)I
 */

JNIEXPORT jint JNICALL Java_test_rfid_integration_RfidLib_addValueN
  (JNIEnv *env, jclass cla, jint x, jint y)
{
//pass the log data in to terminal using
__android_log_print(ANDROID_LOG_DEBUG, "test_rfid_integration_Rfidlib.c", "*********Log data from Native code***********"); ----------(2)
jint sum = x * y;
return sum;

}

Add the two lines which are mentioned in bellow as 1 and 2.

Finally to build the file use ,
  • ndk-build clean
  • ndk-build all
great you are in business





RFID Library for projects

If any one deal with RFID related project for android or linux. Here you can get the open source librfid for your development. The file can be downloadable here. To conform that the source file is working perfectly on your machine follow the instruction.

image reference
  1. Extract the file to your specific location.
  2. Change the folder permission (This should be done if now the ./configure will not process) to change the user permission ->go to folder using terminal and type chmod -R 700 *.
  3. after change the permission type sudo ./configure
  4. Then type sudo make and finally sudo make install .
  5. Done. Now you can start with your code implementation if the source was successfully build.
For Android Developers,
You guys can port this to native library. 


Add Microsoft Word Reference with Numbered Format Using Citation Style

Normally we will have the reference with author. But if we want to add reference with number to mac 2011 word. Follow the instruction to add Citation styles to mac. And IEEE has the numbered format reference.
  1. Unzip the Styles.zip file that you downloaded
  2. Close Word if it's open
  3. Open Applications
  4. Navigate into the Microsoft Office folder
  5. Right click on the file Word.app or just Word if you have the file extensions hidden, click 'Show Package Contents'
  6. There should now be a folder called Contents, open the folder.
  7. Then open Resources
  8. Then open Styles
  9. Copy the Styles you want into this folder. I.e. HarvardAnglia
  10. Launch the Word application and the styles you copied in should be available.
  11. Finally edit the xsl file to get updated by word(Edit in sense delete some line and update it)
To get the Citation styles files follow the link,
http://bibword.codeplex.com/wikipage?title=Styles

Enjoy :) ...