Skip to content

Instantly share code, notes, and snippets.

<?php
try {
$reqStr = getInputString();
file_put_contents(__DIR__ . '/callbackService.log', sprintf("%s BODY:%s POST:%s METHOD:%s\n",
date('Y-m-d H:i:s'), $reqStr, json_encode($_POST), $_SERVER['REQUEST_METHOD']), FILE_APPEND);
// logger.info("reqStr:" + reqStr);
if (!empty($reqStr)) {
$json = json_decode($reqStr, true);
$serviceName = $json['serviceName'];
$callPara = $json['callPara'];
procedure TfrmMain.DomImg2Image(wb:TWebBrowser);
var
i:Integer;
rang:IHTMLControlRange;
s:string;
begin
try
s := (IHTMLDocument2(wb.Document).images.item('pic',EmptyParam) as IHTMLElement).getAttribute('src',0);
rang:=((IHTMLDocument2(wb.Document).body as HTMLBody).createControlRange)as
IHTMLControlRange;
package com.ifreestudio.olympic.servlet;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@melice
melice / auto_iptables.sh
Last active August 29, 2015 14:14
配置iptables脚本
#!/bin/bash
#########################################
#Function: auto_iptables
#Usage: bash auto_iptables.sh
#Author: melice
#Version: 1.0
#Origin: vpser.net
# for ubuntu only
#########################################
@melice
melice / auto_fdisk.sh
Created January 30, 2015 07:26
阿里云自动挂载分区脚本
#/bin/bash
#########################################
#Function: auto fdisk
#Usage: bash auto_fdisk.sh
#Author: Customer service department
#Company: Alibaba Cloud Computing
#Version: 3.0
#########################################
count=0
unit ListviewHelper;
interface
uses System.SysUtils, Vcl.ComCtrls;
type
TListviewHelper = class helper for TListview
public
procedure SetRowCount(Count: Integer; Compacted: Boolean = False);
@melice
melice / dynacreatecom.pas
Created April 8, 2012 13:26
(Delphi)dynamic create a GUI component
procedure TForm1.Button1Click(Sender: TObject);
var
edit :TEdit;
begin
edit := TEdit.Create(nil);
edit.Parent := self;
edit.Left := random(width);
edit.Top :=random(height);
end;
@melice
melice / operatewebbrowser.txt
Created April 8, 2012 14:18
(Delphi)操作Webbrowser
如何获取 WebBrowser 对象模型的一个 HTML 框架
概要
可以使用此文章详细标准技术 WebBrowser 控件主机来访问 WebBrowser 对象模型的控件中的 HTML 页中框架窗口。 此对象模型提供对框架窗口通过 HTML 对象模型不公开额外功能。
更多信息
以下代码演示如何访问 WebBrowser 对象模型是一个 HTML 页中框架要刷新的各个框架内容。
最重要的代码使用的 HTML 文档对象 IOleContainer::EnumObjects 方法来枚举页上嵌入。 每个这些嵌入表示页上控件。 此代码通过查询每个控件对象的 IWebBrowser 2, 可以确定控件是否 sub-frame。 和 IWebBrowser 2 代表 WebBrowser 对象模型 ; 如果为该接口, QueryInterface 成功结果是对 WebBrowser 对象模型。 // Get the IDispatch of the document
LPDISPATCH lpDisp = NULL;
lpDisp = m_webBrowser.GetDocument();
// fyttt.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "windows.h"
#include <string>
using namespace std;
struct tagAuthResult
@melice
melice / fileexist64.pas
Created May 14, 2012 09:26
fileexist for win 64bit
function FileExists64(const FileName: string):Boolean;
type TWow64DisableWow64FsRedirection = function(var Wow64FsEnableRedirection: LongBool): LongBool; stdcall;
TWow64EnableWow64FsRedirection = function(Wow64FsEnableRedirection: LongBool): LongBool; stdcall;
var hHandle: THandle;
Wow64DisableWow64FsRedirection : TWow64DisableWow64FsRedirection;
Wow64EnableWow64FsRedirection : TWow64EnableWow64FsRedirection;
Wow64FsEnableRedirection : LongBool;
begin
hHandle := GetModuleHandle('kernel32.dll');