MTK功能平台远程上传LOG到七牛服务器_mt6261 cjson-程序员宅基地

MTK功能平台远程上传LOG到七牛服务器

MT6261,MT2503 等功能平台因储存空间有限,平时产品上打印日志文件过多,只能本地删除重新写入新日志。旧日志被删除,无法记录全天侯甚至一个月的系统日志。今天开源远程上传本地日志源码。使用的服务器是 七牛服务器 ,七牛服务虽然提供了linux c 版本的api,但是无法适合用MTK平台。

/* 头文件 */
#ifndef __REPORT_LOG_H__
#define __REPORT_LOG_H__
#include "MMI_include.h"
#include "kal_public_defs.h"
#include "Nvram_user_defs.h"
#include "conversions.h"
#include "task_main_func.h"
#include "app_ltlcom.h"
#include "task_config.h"
#include "syscomp_config.h"
#include "custom_util.h"
#include "stack_ltlcom.h"
#include "kal_non_specific_general_types.h"
#include "stack_config.h"
#include "custom_config.h"
#include "stack_timer.h"
#include "custom_config.h"
#include "med_utility.h"
#include "profilessrvgprot.h"
#include "DateTimeType.h"
#include "mmi_rp_srv_prof_def.h"
#include "gpiosrvgprot.h"
#include "mdi_audio.h"
#include "mdi_gps.h"
#include "aud_defs.h"
#include "mmi_rp_app_charger_def.h"
#include "GeneralDeviceGprot.h"
#include "TimerEvents.h"
#include "stack_msgs.h"
#include "soc_api.h"
#include "cbm_api.h"
#include "DtcntSrvGprot.h"
#include "App_datetime.h"
#include "wndrv_cnst.h"
#include "FileMgrSrvGProt.h"
#include "nbr_public_struct.h"
#include "CharBatSrvGprot.h"
#include "NwInfoSrvGprot.h"
#include "wmp_socket.h"
#include "wmp_gps.h"
#include "cJSON.h"
#include "wmp_timerevent.h"

#define MAX_LOGS_SAVE   20
#define MAX_LEN_LOG    30

typedef struct _ReportLogSocket{

    sockaddr_struct rl_addr;

    signed rl_socHand;

    kal_uint32 rl_account_id;

    U8 *rl_sendbuff;

    U32 rl_sendbuff_lenth;

    U8  *rl_recvBuff;

    U32 rl_recvBuff_lenth;

    kal_uint32 account_id;

    WCHAR LogFilesPath[MAX_LOGS_SAVE][MAX_LEN_LOG*2];

    WCHAR currFilePath[MAX_LEN_LOG*2];
}ReportLogSocket;
#endif

每次上传13K文本日志。文件名以 IMEI/时间.log 命名。上传到七牛一个bucket空间。HTTP POST提交。
上传到七牛服务器需要申请帐号,得到一个AccessKey、SecretKey 等key鉴权。以下是源码实现 。

#ifdef __REPORT_LOG__
#include "wmp_reportlog.h"
#include "task_config.h"

#define LOG_FILE_PATH L"c:\\wmp_log.txt"
#define END_LINE_CONTENT "\n\r\n------------------------------01a9d769ec15--\r\n"
#define MAX_GET_SIZE (1024*13) /* 最大每次发送15K */

            kal_uint32 offset_size = 0;
int wmp_ReportLogIsEmpt(void);
extern  void wmp_trace_log(char* fmt,...);
void wmp_ReportLog(void);
kal_uint32 wmp_ReportLogGetFileSize( kal_wchar *path );
void wmp_ReportLogReadFileLog(kal_wchar *path,char *package,int package_lenth,U32 offset_package,kal_uint32 *package_readLenth);
extern kal_uint32 wmp_GetGPRSAccount(void);
ReportLogSocket rl_socket={
   0};
WCHAR * wmp_ReportPopLogFilePath( void );
void wmp_ReportPushLogFilePath(WCHAR *path);
void wmp_RoportLOG_sync_filepath(void);
void wmp_ReportLogRead (U16 result)
{
    #define SOC_RECV_READ_LENTH   (1500)
    #define TOTAL_RECV_LENTH  (1024*50)
    ReportLogSocket *p = &rl_socket;
    int buffer_len=0;
    S32 ret = 0;

    p->rl_recvBuff = wmp_Malloc(TOTAL_RECV_LENTH);
    if(p->rl_recvBuff)
    {
        memset(p->rl_recvBuff,0,TOTAL_RECV_LENTH);
        /* 这里要做一层接收大文件,内存越界处理。现暂时用于LOG,不处理了。 */
        do{
            ret = soc_recv(p->rl_socHand, (void *)(p->rl_recvBuff+buffer_len), SOC_RECV_READ_LENTH, 0);
            if(ret >= 0)
            buffer_len +=  ret;
        }while(ret > 0);
        if(strstr(p->rl_recvBuff,"200 OK\r\n"))
        {
            kal_prompt_trace(MOD_CC,"LOG 发送成功 ");
            if(wmp_ReportLogIsEmpt() != -1)
            {
                wmp_ReportLog();
            }
        }

    }
    else
    {
        wmp_trace_log("soc 分配内存失败");
    }
    if(p->rl_recvBuff)
    {
        wmp_Free(p->rl_recvBuff);
        p->rl_recvBuff = NULL;
    }
}
char sl_tmpPacket[500] = {
   0};
int wmp_sendsize(void)
{
    if(wmp_ReportLogGetFileSize(wmp_ReportPopLogFilePath()) <= MAX_GET_SIZE)
    {
        return wmp_ReportLogGetFileSize(wmp_ReportPopLogFilePath());
    }
    else
        return MAX_GET_SIZE;
}
void wmp_ReportLogSendHttpHead( void )
{
    extern char sys_imei[20];
    S32 ret = 0;
    ReportLogSocket *p = &rl_socket;
    char sl_bodyLenth[10]={
   0};
    char sl_packet[1024]={
   0};
    MYTIME time; 
    char time_str[128] = {
   0};
    char filename_[50]={
   0};
    char *realaddr = NULL;
    DTGetRTCTime(&time);

    mmi_wcs_to_asc(filename_, wmp_ReportPopLogFilePath());
    realaddr = strstr(filename_,"C:\\Log\\")+strlen("C:\\Log\\");
    strcpy(filename_,realaddr);
    sprintf(time_str, "%s/%s",
        sm_GetIMEI(),filename_);
    strcpy(sl_packet,"POST / HTTP/1.1\r\nHost: upload.qiniu.com\r\nAccept: */*\r\nContent-Length: ");
    strcpy(sl_tmpPacket,"");
    strcat(sl_tmpPacket,"------------------------------01a9d769ec15\r\n");
    strcat(sl_tmpPacket,"Content-Disposition: form-data; name=\"token\"\r\n\r\n");
    //strcat(sl_tmpPacket,"你的AccessKey \r\n");
    strcat(sl_tmpPacket,"你的AccessKey\r\n");
    strcat(sl_tmpPacket,"------------------------------01a9d769ec15\r\nContent-Disposition: form-data; name=\"key\"\r\n\r\n");
    strcat(sl_tmpPacket,time_str);
    strcat(sl_tmpPacket,"\r\n------------------------------01a9d769ec15\r\nContent-Disposition: form-data; name=\"file\"; filename=\"wmp_log.txt\"\r\nContent-Type: text/plain\r\n\r\n");
    sprintf(sl_bodyLenth,"%d",wmp_sendsize()+strlen(END_LINE_CONTENT)+strlen(sl_tmpPacket));
    strcat(sl_packet,sl_bodyLenth);
    strcat(sl_packet,"\r\nContent-Type: multipart/form-data; boundary=----------------------------01a9d769ec15\r\n\r\n");
    strcat(sl_packet,sl_tmpPacket);
    ret = soc_send(p->rl_socHand, (U8*) (sl_packet), strlen(sl_packet), 0);
    wmp_trace_log("发送LOG头。ret:%d",ret);
}

void wmp_ReportGetLogContent( void )
{
    FS_HANDLE file_handle;
    kal_uint32 filesize=0;
    U8 read_flag;
    S32 fs_ret;
    U32 nRW;
    ReportLogSocket *p = &rl_socket;

    memset(p->currFilePath,0,sizeof(p->currFilePath));
    mmi_wcscpy(p->currFilePath, wmp_ReportPopLogFilePath());

    if(p->currFilePath)
    {
        file_handle = FS_Open(p->currFilePath,FS_READ_WRITE);
        if (file_handle > FS_NO_ERROR)
            if(FS_GetFileSize(file_handle, &filesize) == FS_NO_ERROR)
            {
                    if(filesize < MAX_GET_SIZE)
                    {
                        p->rl_sendbuff = wmp_Malloc(filesize+1);
                        memset(p->rl_sendbuff,0,filesize+1);
                        fs_ret = FS_Read(file_handle, p->rl_sendbuff, filesize, &nRW);
                        p->rl_sendbuff_lenth = nRW;
                    }
                    else
                    {
                        p->rl_sendbuff = wmp_Malloc(MAX_GET_SIZE+1);
                        memset(p->rl_sendbuff,0,MAX_GET_SIZE+1);
                        fs_ret = FS_Read(file_handle, p->rl_sendbuff, MAX_GET_SIZE, &nRW);
                        p->rl_sendbuff_lenth = nRW;
                    }
                    wmp_trace("文件总大小 %d 读到 %d",filesize,nRW);
            }
        FS_Close(file_handle);
    }
}


static void wmp_ReportLogTaskNotifyInternal(void* Content)
{
    ReportLogSocket *p = &rl_socket;
    app_soc_notify_ind_struct *soc_notify = (app_soc_notify_ind_struct *) Content;
    S32 ret = 0;
    kal_uint32 file_read_lenth = 0;

    switch (soc_notify->event_type)
    {
        case SOC_WRITE:
            //wmp_ReportSendFile();
        break;
        case SOC_READ:
        {
            wmp_ReportLogRead(soc_notify->event_type);
        }
        break;
        case SOC_CONNECT:
        {
            kal_uint32 filesize= wmp_ReportLogGetFileSize(wmp_ReportPopLogFilePath());

            wmp_RoportLOG_sync_filepath();
            if(filesize != 0)
            {
                char file_path[100]={
   0};
                char temp[100]={
   0};
                int fs_err;

                mmi_wcs_to_asc(file_path, wmp_ReportPopLogFilePath());
                wmp_ReportLogSendHttpHead();
                wmp_ReportGetLogContent();
                ret = soc_send(p->rl_socHand, (U8*) (p->rl_sendbuff), p->rl_sendbuff_lenth, 0);
                ret = soc_send(p->rl_socHand, (U8*) END_LINE_CONTENT, strlen(END_LINE_CONTENT), 0);
                if(p->rl_sendbuff != NULL)
                {
                    p->rl_sendbuff_lenth = 0;
                    wmp_Free(p->rl_sendbuff);
                    p->rl_sendbuff = NULL;
                }
                fs_err = FS_Delete(p->currFilePath);
                mmi_wcs_to_asc(temp, p->currFilePath);
                if(wmp_ReportDeleteFileFromPath(p->currFilePath) < 0)
                {
                    wmp_trace_log("LOG文件删除失败..%s",temp);
                }
                if(fs_err < FS_NO_ERROR)
                {

                }
                kal_prompt_trace(MOD_CC,"report log :%d,path:%s 删除结果:%d",filesize,file_path,fs_err);
            }
        }
        break;
        case SOC_ACCEPT:
        break;
        case SOC_CLOSE:
        {
            //关闭
            p->rl_socHand=-1;
        }
        default:
            break;
        break;
    }
}
/* 初始化Task */
kal_bool wmp_initReportLogTask( task_indx_type task_indx )
{
    ReportLogSocket *p = &rl_socket;
    p->rl_recvBuff = NULL;
    p->rl_sendbuff = NULL;
    p->rl_socHand = -1;
    return KAL_TRUE;
}
/* Task处理 */
void wmp_ReportLogTaskEntry( task_entry_struct *task_entry_ptr )
{
    ilm_struct current_ilm;
    kal_uint32 task_index=0;
    kal_get_my_task_index(&task_index);
    stack_set_active_module_id(task_index, MOD_WMP_SOCKET);
    while(1)
    {
        receive_msg_ext_q_for_stack(task_info_g[task_index].task_ext_qid, &current_ilm);
        stack_set_active_module_id(task_index, current_ilm.dest_mod_id);
        switch(current_ilm.msg_id)
        {
            case MSG_ID_APP_SOC_NOTIFY_IND:
            {
                wmp_ReportLogTaskNotifyInternal((void *)current_ilm.local_para_ptr);
            }
            break;
            case MSG_ID_APP_SOC_GET_HOST_BY_NAME_IND:
            {
                //wmp_GetHostByNameCallBack((void *)current_ilm.local_para_ptr);
            }
            break;
        }
        free_ilm(&current_ilm);
    }
}

kal_bool wmp_ReportLogTaskCreate( comptask_handler_struct **handle )
{
    static const comptask_handler_struct custom2_handler_info = {
        wmp_ReportLogTaskEntry,  /* task entry function */
        wmp_initReportLogTask,  /* task initialization function */
        NULL,  /* task configuration function */
        NULL,  /* task reset handler */
        NULL,  /* task termination handler */
    };
    *handle = ( comptask_handler_struct * )&custom2_handler_info;
    return KAL_TRUE;
}
void wmp_ReportLogCloseSocket(void)
{
    ReportLogSocket *p = &rl_socket;

    wmp_trace_log("wmp_ReportLogCloseSocket...");
    if(p->rl_socHand == SOC_LIMIT_RESOURCE)
    {
        int i = 0;
        wmp_trace_log("wmp_ReportLogCloseSocket受限制的句柄,全部关闭一下。");
        for(i=0;i<MAX_IP_SOCKET_NUM;i++)
        {
            soc_close(i);
            kal_sleep_task(10);
        }
        p->rl_socHand = -1;
    }
    if(p->rl_socHand != -1)
    {
        soc_close(p->rl_socHand);
        p->rl_socHand=-1;
    }
}
void wmp_ReportLogGetHost(sockaddr_struct * addr)
{
   //183.39.156.37
    addr->addr[0] =58;//192;//58;
    addr->addr[1] = 63;//168;//63;
    addr->addr[2] = 233; //124;//33;
    addr->addr[3] = 33 ;//124;//33;
    addr->port = 80;
    addr->addr_len = 4;
    addr->sock_type = SOC_SOCK_STREAM;
}
int wmp_ReportLogIsEmpt(void)
{
    ReportLogSocket *p = &rl_socket;
    int i=0;
    for(;i<MAX_LOGS_SAVE;i++)
    {
        if(mmi_wcslen(p->LogFilesPath[i]) != 0)
        {
            return i;
        }
        else
            continue;
    }

    return -1;
}
WCHAR * wmp_ReportPopLogFilePath( void )
{
    ReportLogSocket *p = &rl_socket;
    int i=0;
    for(;i<MAX_LOGS_SAVE;i++)
    {
        if(mmi_wcslen(p->LogFilesPath[i]) != 0)
        {
            return p->LogFilesPath[i];
        }
        else
            continue;
    }

    return NULL;
}
int wmp_ReportDeleteFileFromPath(WCHAR *filePath)
{
    ReportLogSocket *p = &rl_socket;
    int i=0;
    if(mmi_wcslen(filePath) == 0) return -1;
    for(;i<MAX_LOGS_SAVE;i++)
    {
        if(!mmi_wcscmp(p->LogFilesPath[i],filePath))
        {
            mmi_wcscpy(p->LogFilesPath[i],L"");
            return i;
        }
    }
    return -1;
}
void wmp_ReportPushLogFilePath(WCHAR *path)
{
    ReportLogSocket *p = &rl_socket;
    int i=0,isPush = 0;
    for(;i<MAX_LOGS_SAVE;i++)
    {
        if(mmi_wcslen(p->LogFilesPath[i]) == 0)
        {
            mmi_wcscpy(p->LogFilesPath[i],path);
            isPush = 1;
            break;
        }
        else
            continue;
    }
    if(!isPush)
    {
        applib_file_delete_folder(L"C:\\Log");
        memset(p->LogFilesPath,0,sizeof(p->LogFilesPath));
        for(;i<MAX_LOGS_SAVE;i++)
        {
            if(mmi_wcslen(p->LogFilesPath[i]) == 0)
            {
                mmi_wcscpy(p->LogFilesPath[i],path);
                break;
            }
            else
                continue;
        }
    }
}
void wmp_RoportLOG_sync_filepath(void)
{
#define VDOPLY_HISTORY_BUF_LEN   (50)
    FS_DOSDirEntry file_info;
    CHAR buf_filename[(VDOPLY_HISTORY_BUF_LEN+1) * ENCODING_LENGTH];
    FS_HANDLE file_handle;
    S16 error;
    int i = 0;
    S32 fs_ret;
    CHAR filter[(VDOPLY_HISTORY_BUF_LEN+1) * ENCODING_LENGTH];
    ReportLogSocket *p = &rl_socket;

    mmi_ucs2cpy((CHAR*)filter, (CHAR*)L"C:\\Log\\*.log");
    memset(p->LogFilesPath,0,sizeof(p->LogFilesPath));
    file_handle = FS_FindFirst(
                    (U16*)filter, 
                    0, 
                    0, 
                    &file_info, 
                    (U16*)buf_filename, 
                    sizeof(buf_filename));

    if (file_handle  > 0)
    {
        do
        {
            WCHAR file_path[100]={
   0};
            fs_ret = FS_FindNext(
                        file_handle, 
                        &file_info,
                        (PU16)buf_filename,
                        sizeof(buf_filename));
            mmi_wcscpy(file_path,L"C:\\Log\\");
            mmi_wcscat(file_path,(U16*)buf_filename);
            mmi_wcscpy(p->LogFilesPath[i], file_path);
            i++;
        }while (fs_ret == FS_NO_ERROR);
        FS_FindClose(file_handle);
    }

}
kal_uint32 wmp_ReportLogGetFileSize( kal_wchar *path )
{
    FS_HANDLE file_handle;
    kal_uint32 filesize=0;
    if(path)
    {
        file_handle = FS_Open(path,FS_READ_ONLY);
        if (file_handle >= FS_NO_ERROR)
            if(FS_GetFileSize(file_handle, &filesize) == FS_NO_ERROR)
            {

            }
        FS_Close(file_handle);  
    }
    return filesize;
}
/* package_lenth:每次最大读取的文件size */
void wmp_ReportLogReadFileLog(kal_wchar *path,char *package,int package_lenth,U32 offset_package,kal_uint32 *package_readLenth)
{
    FS_HANDLE file_handle;
    kal_uint32 filesize=0;
    U8 read_flag;
    S32 fs_ret;
    U32 nRW;
    ReportLogSocket *p = &rl_socket;

    file_handle = FS_Open(path,FS_READ_WRITE);
    if (file_handle >= FS_NO_ERROR)
        if(FS_GetFileSize(file_handle, &filesize) == FS_NO_ERROR)
        {
            if(filesize < package_lenth)
            {
                p->rl_sendbuff = wmp_Malloc(filesize);
                memset(p->rl_sendbuff,0,filesize);
                if(p->rl_sendbuff)
                {
                    fs_ret = FS_Read(file_handle, p->rl_sendbuff, filesize, &nRW);
                    *package_readLenth= nRW;
                }
            }
            else if((filesize > package_lenth)&&(offset_package < filesize))
            {
                p->rl_sendbuff = wmp_Malloc(package_lenth);
                memset(p->rl_sendbuff,0,package_lenth);
                if(p->rl_sendbuff)
                {
                    FS_Seek(
                    file_handle,
                    offset_package,
                    FS_FILE_BEGIN);
                    fs_ret = FS_Read(file_handle, p->rl_sendbuff, package_lenth, &nRW);
                    *package_readLenth = nRW;
                    //wmp_trace_log("读取文件长度:%d  ",nRW);
                }
            }
            else
            {
                package = NULL;
                *package_readLenth = 0;
            }
        }
    FS_Close(file_handle);
}
void wmp_ReportLog(void)
{
    #define VALID_SOCKET(s) (s>=0)
    ReportLogSocket *p = &rl_socket;
    kal_int8 ret = 0;
    U8 strength = 0;

#ifndef WIN32
    srv_nw_info_service_availability_enum status = srv_nw_info_get_service_availability( MMI_SIM1 );
    strength = srv_nw_info_get_signal_strength_in_percentage(MMI_SIM1);
    wmp_ReportLogCloseSocket();
    kal_prompt_trace(MOD_CC,"LOG 提交信号:%d 强度:%d",status,strength);
#endif
    wmp_ReportLogGetHost(&p->rl_addr);
    if(!VALID_SOCKET(p->rl_socHand))
    {
        U8 val = 1;

        if(p->account_id == 0)
        p->account_id = wmp_GetGPRSAccount();
        p->rl_socHand = soc_create(SOC_PF_INET, p->rl_addr.sock_type, 0, MOD_REPORT_LOG, p->account_id);
        if (soc_setsockopt(p->rl_socHand, SOC_NBIO, &val, sizeof(val)) < 0)
        {
            //错误
            //return ;
        }
        val = SOC_READ | SOC_WRITE | SOC_CLOSE | SOC_CONNECT;
        if (soc_setsockopt(p->rl_socHand, SOC_ASYNC, &val, sizeof(val)) < 0)
        {
            //错误
            //return;
        }
        if(p->rl_addr.sock_type == SOC_SOCK_STREAM)
        {
            ret = soc_connect(p->rl_socHand, &p->rl_addr);
        }
        else
        {
            //错误
        }
    }
    else
    {
        wmp_ReportLogCloseSocket();
    }
        StartTimer(WMP_TIMER_EVNET_20,1000*60*60,wmp_ReportLog);
}
#endif

效果图:

enter image description here

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/wongshandev/article/details/53767393

智能推荐

jQuery 效果 – 淡入淡出_在jquery中,如果希望实现元素淡出效果应调用的方法是-程序员宅基地

文章浏览阅读167次。在jQuery中可以通过四个方法来实现元素的淡入淡出,这四个方法分别是fadeIn()、fadeOut()、fadeToggle()以及fadeTo(),本文通过实例来为你讲解如何在jQuery中使用这四个方法。_在jquery中,如果希望实现元素淡出效果应调用的方法是

【ArcGIS Pro微课1000例】0057:未安装所需的Microsoft驱动程序_arcgispro未安装所需的microsoft驱动程度-程序员宅基地

文章浏览阅读498次,点赞2次,收藏2次。这是因为要在 ArcGIS Pro 中使用 Excel 文件,必须从Microsoft 下载中心 下载并安装 Microsoft Access Database Engine 2016 Redistributable。如果你使用的是 ArcGIS Pro 2.5 或更高版本,请选择与您当前安装的 Microsoft 应用程序匹配的下载。如果你使用的是 ArcGIS Pro 2.4,请选择 32 位驱动程序下载。在选择输入表时,可能会提示未安装所需的 Microsoft 驱动程序。_arcgispro未安装所需的microsoft驱动程度

XSS CSRF SQL注入 URL跳转漏洞 点击劫持 web安全_挑战url劫持-程序员宅基地

文章浏览阅读1k次,点赞13次,收藏26次。CSRF,XSS,SQL注入,URL跳转漏洞,点击挟持等WEB安全问题_挑战url劫持

用虚拟信用卡注册Google Play开发者账号-程序员宅基地

文章浏览阅读1.5k次。本文首发于http://www.abcdsxg.cn/free/net/562虚拟信用卡首先介绍一下虚拟信用卡(Virtual Credit Card),顾名思义,虚拟就是没有实体卡,一般都是在提供服务的网站上注册后由服务商生成提供卡号、有效期、安全码之类的信息,此类平台是由金融市场行为监管局授权及监管,并且有相关银行组织发的执照,所以在安全性上是有一定保障的!虚拟信用卡一般有VISA(4..._谷歌开发者没卡怎么办

java毕业设计闸口社区管理系统Mybatis+系统+数据库+调试部署_人闸口机读取信息 后台管理系统架构-程序员宅基地

文章浏览阅读110次。java毕业设计闸口社区管理系统Mybatis+系统+数据库+调试部署。springboot疫情期间中小学生作业线上管理系统设计与实现。springcloud基于微服务的家居体验平台的设计与实现。JSP物流仓储仓库管理系统的设计与实现sqlserver。ssm医疗机构药房管理系统软件开发-后台软件设计与实现。springboot基于web的学校工资管理系统。ssm基于Web的精品课程网站的设计与实现。_人闸口机读取信息 后台管理系统架构

获取EasyUI的treegrid的checkbox所有已勾选的数据-程序员宅基地

文章浏览阅读533次。EasyUI为TreeGrid的已勾选节点,未勾选节点,只勾选部分子节点的父节点分别添加了三个不同的样式,如下:样式一:tree-checkbox2 有子节点被选中样式二:tree-checkbox1 节点被选中样式三:tree-checkbox0 节点未选中那么,我们就可以依据这三个样式分别取到所有已勾选的主键值了,为方便使用,我们写成TreeGrid的扩展方法,代码如下: $.exten..._treegrid checknode

随便推点

chart.Correlation绘制相关性热图-程序员宅基地

文章浏览阅读1.3w次,点赞9次,收藏62次。可以同时显示相关性和显著性的热图我们最终绘制的是如下图所示首先配置的文件如下所示行为样本名,列为基因名的一个表达谱读取文件data = read.table("cor.txt",header=T,sep="\t")data1<-data[,-1]#计算相关性,默认用的是pearson相关性计算cor_matr = cor(data1)cor_matr#保存相关性..._chart.correlation

【shell】远程执行shell|多节点并行执行|远程登录执行_shell脚本远程执行shell指令-程序员宅基地

文章浏览阅读6.8k次。目录shell远程执行前提条件:对于简单的命令:对于脚本的方式:SSH命令格式主要参数说明ssh控制远程主机,远程执行命令步骤准备工作基于公私钥认证远程登录可能存在的不足ssh 执行远程命令格式打开远程shellssh的-t参数在多个节点上并行执行命令的三种方法使用bash执行命令∞(Execute commands using Bash∞)使用执行命令clustershell∞(Execute commands usingclust..._shell脚本远程执行shell指令

探索DroidLord:一款强大的Android逆向工程工具-程序员宅基地

文章浏览阅读371次,点赞3次,收藏4次。探索DroidLord:一款强大的Android逆向工程工具项目地址:https://gitcode.com/likia/DroidLordDroidLord 是一个专为Android开发者和安全研究人员设计的开源逆向工程框架。它利用Java和Python的强大功能,帮助用户深入理解APK文件的内部工作机制,从而进行代码审计、漏洞发现或应用优化。项目简介DroidLord的核心在于其模块化...

随机背景图php,岁月小筑随机图片API接口-随机背景图片-随机图片API-程序员宅基地

文章浏览阅读670次。前言此为完整版随机图片API介绍,若仅需要随机背景图片,请点击:接口调用地址12345#https调用https://img.xjh.me/random_img.php#http调用http://img.xjh.me/random_img.php开发状态增加图片分类,背景->ACG,背景->环境背景,调用方法:GET参数:type=bg&ctype=acg/nature——更新..._随机图片api接口

xfs_growfs 同步文件系统_xfs_growfs命令找不到-程序员宅基地

文章浏览阅读3.2w次,点赞6次,收藏21次。在使用pvcreate, vgcreate,lvextend等命令拓展分区的时候,发现出现了找不到逻辑块的问题,最后问题是现在的文件格式是xfs,resize2fs命令是读取不了的,故而查找到了需要使用xfs_growfs lvextend之后显示lv空间已经增加 然后我需要同步文件系统,一开始使用resize2fs后来_xfs_growfs命令找不到

python 安装serial模块_python安装serial模块-程序员宅基地

文章浏览阅读2.5w次,点赞10次,收藏45次。如果python想要操作串口,需要首先先安装pyserial,在不同的系统上安装python serial模块的方法不一样,在windowns系统上,你可以直接直接通过pip install pyserial去安装pyserial,但是在linux系统上你需要把pyserial的源码包下载下来,解压,然后执行安装命令。1,在windows系统上的操作:C:\Users\test>..._python安装serial模块