Download jtds-1.2.8.jar

http://sourceforge.net/projects/jtds/files/jtds/

At Linux Box:

nano DemoJdbcRowSet.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.rowset.JdbcRowSet;
public class DemoJdbcRowSet {
 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  try {
   //import driver
   Class.forName("net.sourceforge.jtds.jdbc.Driver");
   //connection to database
   Connection conn=DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.100:1433;databaseName=test;user=sa;password=password;");
   Statement state=conn.createStatement();
   String sql="SELECT * FROM areacode where id=1";
   ResultSet result=state.executeQuery(sql);
   while (result.next())
   {
    System.out.println(result.getString("id")+"\t"+result.getString("areacode"));
   }
  } catch (ClassNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (SQLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } 
 }
}
javac -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet.java
java -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet

copy jtds-1.2.8.jar and DemoJdbcRowSet.class into Yun.

root@Arduino:/mnt/sda1# jamvm  -classpath  .:jtds-1.2.8.jar  DemoJdbcRowSet
1       354

 

 

Write comment (0 Comments)

Create table with AUTO_INCREMENT and TIMESTAMP:

CREATE TABLE temperatura_new (
id INT NOT NULL AUTO_INCREMENT,
tempdegree VARCHAR(20),
insert_date TIMESTAMP,
PRIMARY KEY (id)
);

Insert test data:

INSERT INTO temperatura_new (tempdegree) VALUES ( '32');
INSERT INTO temperatura_new (tempdegree) VALUES ( '34');
select * from temperatura_new;

+----+------------+---------------------+
| id | tempdegree | insert_date         |
+----+------------+---------------------+
|  1 | 32         | 2014-02-03 10:08:51 |
|  2 | 34         | 2014-02-03 10:08:57 |
+----+------------+---------------------+

 

Write comment (0 Comments)

Install base64 software:

opkg update
opkg install coreutils-base64

Download test image:

cd /mnt/sda1/
wget -O uno.jpg http://www.adafruit.com/images/970x728/50-01.jpg
nano /mnt/sda1/upload.sh
#!/bin/ash
strbase64=$(/usr/bin/base64 --wrap=0 /mnt/sda1/uno.jpg)
echo "{\"image\":\""+$strbase64+"\"}" > /mnt/sda1/test.base64
curl -k -X PATCH  -d @/mnt/sda1/test.base64   'https://shms.firebaseio.com/images/image.json'
chmod 755  /mnt/sda1/upload.sh
/mnt/sda1/upload.sh

Hide standard and error outputs:

curl -k  -X PATCH  -d @/mnt/sda1/test.base64 'https://shms.firebaseio.com/images/image.json' > /dev/null 2>&1

 

Write comment (0 Comments)

https://www.facebook.com/official.arduino

337,174 Total Page Likes Arduino

Get app_id, app_secret for facebook.

http://goldplugins.com/documentation/wp-social-pro-documentation/how-to-get-an-app-id-and-secret-key-from-facebook/

access_token=app_id|app_secret
nano /mnt/sda1/facebook.py
#!/usr/bin/python
import urllib, json
pagename="official.arduino"
accessToken = "app_id|app_secret"
url='https://graph.facebook.com/v2.3/'+pagename+'?access_token='+accessToken
data = json.load(urllib.urlopen(url))
#print data
print data['likes']
chmod 755 /mnt/sda1/facebook.py
/mnt/sda1/facebook.py
337174

 

Write comment (0 Comments)

Subcategories

Expand the Storage at Yun

Languages Supported by Yun

Backup and Recover

Network and Yun

Hardware & Yun

OpenWrt-SDK & Yun