Android: Requesting root access in your app
转帖:http://www.stealthcopter.com/blog/2010/01/android-requesting-root-access-in-your-app/
This snippet shows how root access can be requested inside an application in order to write a file into a place we do not have permission to access usually. Requesting root access will only work if your phone allows it, or it has been ‘rooted’ (hacked to allow superuser permissions).
view plaincopy to clipboardprint?
Process p;
try {
// Preform su to get root privledges
p = Runtime.getRuntime().exec("su");
// Attempt to write a file to a root-only
DataOutputStream os = new DataOutputStream(p.getOutputStream());
os.writeBytes("echo \"Do I have root?\" >/system/sd/temporary.txt\n");
// Close the terminal
os.writeBytes("exit\n");
os.flush();
try {
p.waitFor();
if (p.exitValue() != 255) {
// TODO Code to run on success
toastMessage("root");
}
else {
&nb
相关文档:
今天花了2个小时间,在网上发现一大堆的解答,但都不凑效,自己摸索,终于搞定这个很恶心的问题。
第一步:进入/var目录 执行命令 chmod 755 ./www/ -R ,也就是把WEB目录下的文件的访问权限适当打开
第二步:sudo cd /etc/apache2/sites-enabled/,发现里面有几个目录,比如我的有 000-default,输入sudo gedit /etc/apach ......
sqlserver:update Table_A set Table_A.col1 = (select Table_B.col1 from Table_B where Table_A.col2 = Table_B.col2)
Access: UPDATE Table_ A, Table_B SET Table_ A.字段2 = Table_ B.字段2
WHERE Table_ A.编号=Table_ A.编号;
自己记下,提醒自己 ......
最近系统运行中发现Access 2003 版本中对待 Null 和 ‘’ (空字符)奇怪问题,重现步骤:
1、创建表tabTest ;
2、使用设计视图添加两个字段 ID ,col1
名称
类型
长度
说明
ID
Number
主键,自增
Col1
char
1
无
3、使用sql 添加如下数据
-- col1 字段设置为 null
INS ......
public static DataTable GetSchemaTable(string connectionString) //获取Access所有的表名;
{
using (OleDbConnection connection = new
&n ......
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
using Access = Microsoft.Office.Interop.Access;
namespace ImageAccess
{
static class Program
{
......