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
相关文档:
void ModifyDBCode()
{
CString strPath;
::GetModuleFileName(GetModuleHandle(NULL),strPath.GetBuffer(256),256);
strPath.ReleaseBuffer();
int flag=strPath.ReverseFind('\\');
int size=strPath.GetLength();
strPath.Delete(flag,size-flag);
strPath= strPath+ ......
当然,altera FPGA 的JTAG和AS下载模式是得这么接。但是,我有个小提醒给各位:请注意VCCA的定义,VCCA是同时给FPGA锁相环路供电的2.5V。在锁相环引脚上我接有0.01uF的电容,可以想象它能够移除大约100MHz以上的射频能量,因此对JTAG下载口的其上拉作用的VCCA影响不大(JTAG配置模式的带宽并不高),0.01uF的电容不可能对 ......
项目中用到了此功能。把大概做法跟大家共享下,希望对大家有所帮助。也给自己总结一下,激励自己再接再厉。下面中部分代码被汉字替换了,主要考虑到公司的产品权,希望谅解。
/// <summary>
  ......
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
{
......
在SQL Server中模糊查询通常是这样的Select * from articleTable where authorName like '%jacky%'
但是在Access中用这条语句执行的时候竟然发现查不出结果,怎么可能呢?
后来查了下资料,发现问题如下:
要进行模糊查找,则必须使用通配符,ACCESS库的通配符和SQL SERVER的通配符不一样。
ACCESS库的通配符为:
*& ......