当前位置: 首页 > news >正文

做视频怎样传到网站wordpress前后台域名分离

做视频怎样传到网站,wordpress前后台域名分离,免费企业建站源代码,个人自己免费建网站一个在C#中集成Python的例子。在C#中可以执行Python脚本#xff0c;在Python中也可以调用C#宿主中的功能#xff08;clr.AddReference(Business)#xff09;。 文件说明 Debug为执行目录 Mgr.exe为执行文件 Py\init.py为python初始化脚本 Py\Lib.zip为python需要的模块在Python中也可以调用C#宿主中的功能clr.AddReference(Business)。  文件说明 Debug为执行目录 Mgr.exe为执行文件 Py\init.py为python初始化脚本 Py\Lib.zip为python需要的模块可以在init.py中import Data为数据库目录 mgr.db为mgr.exe使用的数据库 操作说明 系统设置 可以在这里修改运行的参数 打开一个账户 用户的规则设置 交易 代码说明 Python的说明 在Python中可以调用C#宿主中的功能clr.AddReference(Business)。  import clr import io import os import stringclr.AddReference(System) clr.AddReference(System.Data) clr.AddReference(Business)from System import * from System.Data import * from Business import *def get_account_money_by_dt(account_id,date):dbPub.db_name_mgrInitMoneyPub.select_str(db,select InitMoney from account where account_idaccount_id)cashPub.select_str(db,select sum(amount_real) from tran where account_idaccount_id and tran_datedate)stock_amountfloat.Parse(0)table_stockPub.select(db,select code_type,code,sum(tran_count_real) as c from tran where account_idaccount_id and code and tran_datedate group by code_type,code)for dr in table_stock.Rows:code_typeDBUtils.get_str(dr, code_type);codeDBUtils.get_str(dr, code);countDBUtils.get_str(dr, c);pricePub.select_str(code_type\\code,select close from data_day where dtdate order by dt desc limit 1)if price:stock_amountstock_amountfloat.Parse(price)*float.Parse(count)if cash:cash0if InitMoney:InitMoney0return (float.Parse(InitMoney)float.Parse(cash)stock_amount).ToString(0.00) C#的说明 加载Python环境 instance new Py();             instance.init_py_lib(); public void init_py_lib(){engine IronPython.Hosting.Python.CreateEngine();scope engine.CreateScope();engine.Runtime.IO.SetOutput(Output,Encoding.Unicode);engine.SetTrace(on_trace);StringBuilder sb new StringBuilder();sb.AppendLine(import sys );sb.AppendLine(sys.path.append(.\py\Lib.zip) );sb.AppendLine(sys.path.append(.\scripts) );ScriptSource source engine.CreateScriptSourceFromString(sb.ToString());source.Execute(scope);string init_py Pub.exe_dir \py\init.py;if (System.IO.File.Exists(init_py)){ScriptSource source_init engine.CreateScriptSourceFromFile(init_py);source_init.Execute(scope);}} 执行脚本 public Boolean Execute(string script, out string msg, out IronPyErrors err, ExecRequest request){msg ;err new IronPyErrors();StringBuilder sb request.log;sb.AppendLine(开始 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss) );sb.AppendLine(------);try{last_trace_lineno ;last_trace_result ;ScriptSource source engine.CreateScriptSourceFromString(script); CompiledCode cc source.Compile(err); if (err.Items.Count 0){err.ToStringBuilder(sb);msg 编译错误;sb.Append(msg);return false;}scope.SetVariable(request, request);Py.instance.Output.SetLength(0);string sql_err DataAccess.DataConn.clear_err();cc.Execute(scope); Py.instance.Output.Flush();string print_s Encoding.Unicode.GetString(Py.instance.Output.ToArray());sql_err DataAccess.DataConn.clear_err();if (sql_err ! )sb.AppendLine(sql_err);sb.AppendLine(print_s);sb.AppendLine(------);msg 运行完成 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss) ;sb.Append(msg);return true;}catch (Exception e){if (last_trace_lineno ! )msg trace line: last_trace_lineno;if (last_trace_result ! )msg msg trace: last_trace_result;msg msg e.Message;sb.Append(msg);}return false;} using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using Microsoft.Scripting; using Microsoft.Scripting.Hosting; using IronPython; using IronPython.Runtime; using IronPython.Modules; using IronPython.Compiler; using IronPython.Runtime.Exceptions; using IronPython.Hosting; using Business;namespace Mgr {public class Py{public static Py instance null;public static void init(){if (instance ! null)return;instance new Py();instance.init_py_lib();}public ScriptEngine engine null;public ScriptScope scope null;public static string get_key(string name){return name.Trim().ToLower();}public static Dictionarystring , ScriptSource ScriptDict new Dictionarystring , ScriptSource();public string set_script(string id ,string script){if (id )id Guid.NewGuid().ToString();id get_key(id);ScriptSource source engine.CreateScriptSourceFromString(script);ScriptDict[id] source;return id;}public string last_trace_lineno ;public string last_trace_result ;public TracebackDelegate on_trace(TraceBackFrame frame, string result, object payload){last_trace_lineno frame.f_lineno.ToString();last_trace_result result;return on_trace;}public Boolean Compile(string script,out string msg, out CompiledCode cc, out IronPyErrors err){msg ;err new IronPyErrors();cc null;try{ScriptSource source engine.CreateScriptSourceFromString(script); cc source.Compile(err);msg 编译完成;return true;}catch (Exception e){msg e.Message;}return false;}public Boolean Execute_cc(CompiledCode cc, out string msg, ExecRequest request){msg ;StringBuilder sb request.log;sb.AppendLine(开始 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss));sb.AppendLine(------);try{last_trace_lineno ;last_trace_result ;scope.SetVariable(request, request);Py.instance.Output.SetLength(0);string sql_err DataAccess.DataConn.clear_err();cc.Execute(scope);Py.instance.Output.Flush();string print_s Encoding.Unicode.GetString(Py.instance.Output.ToArray());sql_err DataAccess.DataConn.clear_err();if (sql_err ! )sb.AppendLine(sql_err);sb.AppendLine(print_s);sb.AppendLine(------);msg 运行完成 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss);sb.Append(msg);return true;}catch (Exception e){if (last_trace_lineno ! )msg trace line: last_trace_lineno;if (last_trace_result ! )msg msg trace: last_trace_result;msg msg e.Message;sb.Append(msg);}return false;}public Boolean Execute(string script, out string msg, out IronPyErrors err, ExecRequest request){msg ;err new IronPyErrors();StringBuilder sb request.log;sb.AppendLine(开始 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss) );sb.AppendLine(------);try{last_trace_lineno ;last_trace_result ;ScriptSource source engine.CreateScriptSourceFromString(script); CompiledCode cc source.Compile(err); if (err.Items.Count 0){err.ToStringBuilder(sb);msg 编译错误;sb.Append(msg);return false;}scope.SetVariable(request, request);Py.instance.Output.SetLength(0);string sql_err DataAccess.DataConn.clear_err();cc.Execute(scope); Py.instance.Output.Flush();string print_s Encoding.Unicode.GetString(Py.instance.Output.ToArray());sql_err DataAccess.DataConn.clear_err();if (sql_err ! )sb.AppendLine(sql_err);sb.AppendLine(print_s);sb.AppendLine(------);msg 运行完成 DateTime.Now.ToString(yyyy-MM-dd HH:mm:ss) ;sb.Append(msg);return true;}catch (Exception e){if (last_trace_lineno ! )msg trace line: last_trace_lineno;if (last_trace_result ! )msg msg trace: last_trace_result;msg msg e.Message;sb.Append(msg);}return false;}public MemoryStream Output new MemoryStream();public void init_py_lib(){engine IronPython.Hosting.Python.CreateEngine();scope engine.CreateScope();engine.Runtime.IO.SetOutput(Output,Encoding.Unicode);engine.SetTrace(on_trace);StringBuilder sb new StringBuilder();sb.AppendLine(import sys );sb.AppendLine(sys.path.append(.\py\Lib.zip) );sb.AppendLine(sys.path.append(.\scripts) );ScriptSource source engine.CreateScriptSourceFromString(sb.ToString());source.Execute(scope);string init_py Pub.exe_dir \py\init.py;if (System.IO.File.Exists(init_py)){ScriptSource source_init engine.CreateScriptSourceFromFile(init_py);source_init.Execute(scope);}}}public class IronPyErrorsItem{public string Message { get; set; }public int ErrorCode { get; set; }public Severity sev { get; set; }public SourceSpan Span { get; set; }public string get_info(){string line ;line Span.Start.Line.ToString() 行 Span.Start.Column.ToString() 列;line line ( sev.ToString() ErrorCode.ToString()): ;line line Message;return line;}}public class IronPyErrors : ErrorListener{public ListIronPyErrorsItem Items new ListIronPyErrorsItem();public void ToStringBuilder(StringBuilder sb){foreach (IronPyErrorsItem i in Items){sb.AppendLine(i.get_info());}}public override void ErrorReported(ScriptSource source, string message, Microsoft.Scripting.SourceSpan span, int errorCode, Microsoft.Scripting.Severity severity){IronPyErrorsItem i new IronPyErrorsItem{Message message,ErrorCode errorCode,sev severity,Span span};Items.Add(i);} } }
http://www.hkea.cn/news/14395904/

相关文章:

  • wordpress 插件 汉化seo北京公司
  • 生鲜网站建设费用学校网站怎么做的
  • 环球影城物品寄存费用株洲搜索引擎优化
  • 具有口碑的产品设计网站新网站如何才做被百度收录
  • app在线开发网站建设机器人编程培训机构
  • 网站建设报价费用是多少内蒙古银税贷互动平台
  • 电商网站开发毕业设计百度文库家庭装修设计软件免费
  • 网页设计教学网站夹娃娃网站如何做
  • 广州 网站制作网站维护费用一般多少钱
  • 大型网站制作公司飞数自已做网站
  • 深圳哪家网站设计比较好国内最大的供求信息网
  • 网站设计北京新大连开发区天气预报
  • 自己做图片上传网站百度怎么做网站
  • 昆明网站建设搜q.479185700小程序是什么意思
  • 做代理需要网站吗优化大师的三大功能
  • 医疗网站建设行业现状网站服务流程
  • 外贸网站该怎么做家居企业网站建设如何
  • 你的网站尚未进行备案关键词排名优化易下拉技术
  • 门户网站建设中标结果杭州专业网站营销
  • 网站的视频怎么下载广州网站建设联系信科海珠
  • 东莞网站优化方法有哪些股票网站模板
  • 怎么在ftp看网站后台地址wordpress comment_form
  • 信息科技有限公司网站建设网站打不开
  • 德清网站制作汽车网站网页设计
  • 网站降权如何恢复php的网站数据库如何上传
  • 潍坊网站建设wfyckj行列资讯工程造价信息网
  • 门户网站是以什么为主上海协会网站建设
  • 上海城建设计院网站wordpress判断使用不同模板
  • 三网合一的网站怎么做20个优秀的响应式设计html5网站模板
  • 天津公司网站制作wordpress本站主题