Auto posting wordpress blogs using perl

<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>

#This script is aimed to do auto post for wordpress. Tested with wp 2.5

# on windows XP, activestate perl 5.8.820 with IEAutomation module installed.

#put all your articles/blogs in the folder $DIR. The script will use the file name

#as post title (without file extension, of course). Suppose you save your articles

#as .txt files, otherwise edit the statement “$post_title = substr($file,0,length($file)-4);”

#to get correct file name. For txt or htm, use length($file)-4, for html, use -5, and so on.



use Win32::IEAutomation;



#*******************       Define variables     *****************



$post_url = “http://netrancher.0fees.net/wp-admin/post-new.php”;

$DIR = ‘C:/download’;



&wplogin;



#************ open dirctory to read each files in it*************



opendir DH, $dir or die “cannot open dir $DIR: $!/n”;

foreach $file (readdir(DH)) {

next if $file eq “.”;

next if $file eq “..”;

open FH,”$DIR//$file” or warn “cannot open file $file: $!/n”;

undef $/;

$con = <FH>;

$/ = “/n”;



#******************* determine which category to put this file to



undef $cat_is,$cat_itc,$cat_os;

undef $cat_cs,$cat_git,$cat_net;

undef $cat_ai,$cat_db,$cat_pl;



if ($file =~ /network|wireless|wi-fi|wimax| lan | wan |/) {$cat_net = “0″}

if ($file =~ /Linux|unix|UNIX|[wW]indows|ubuntu|redhat|solaris/) {$cat_os = “0″}

if ($file =~ /certification|guide|cssip|ccna|ccnp|ccie|ocp|mcse|scsa/) {$cat_itc = “0″}

if ($file =~ /mysql|mssql| SQL | sql |oracle|database/) {$cat_db = “0″}

if ($file =~ /security|secur|forensic|hack|crack|authentic/) {$cat_is = “0″}

if ($file =~ /aritifical|intelligence|fuzzy|mind|brain|human/) {$cat_ai = “0″}

if ($file =~ /science|computing|architecture|computational|algorithmic|genetic/) {$cat_cs =”0″}

if ($file =~ /program|perl|python|developer|ruby|j2ee|j2se|java|vb|/.net/) {$cat_pl = “0″}

if ($file =~ /access|excel|office|word|powerpoint|sap|performance|troubleshoot|windows/) {$cat_git = “0″}



#*************  prepare other variables for post ************

#

$post_title = substr($file,0,length($file)-4);



#************************ open IE to post-new.php*************

#*

$ie=Win32::IEAutomation->new(”Maximize =>1″,”Visiable => 1″);

$ie->gotoURL($post_url);

$ie->WaitforDone();

$ie->getTextBox(’name:’,”post_title”)->SetValue($post_title);

$ie->getButton(’id:’,”edButtonHTML”)->click();

$ie->getTextArea(’name:’,”content”)->SetValue($con);

sleep(2);



#************************ set post category ********************



if (defined $cat_ai) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”artifical intelligence”);}

if (defined $cat_db) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Database”);}

if (defined $cat_git) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”General IT”);}

if (defined $cat_is) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”information security”);}

if (defined $cat_itc) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”IT certification”);}

if (defined $cat_net) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”networking”);}

if (defined $cat_os) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Operating System”);}

if (defined $cat_pl) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Programming Language”);}

if (defined $cat_cs) {

$ie->getSelectList(’id:’,”newcat_parent”)->SelectItem(”Computer Science”);}



#************************* set publish status *******************

#

sleep(2);

$ie->getSelectList(’name:’,”post_status”)->SelectItem(”Published”);



#************************ click the publish button **************

#

$ie->getButton(’id:’,”publish”)->click();



}



sub wplogin {



$myie = Win32::IEAutomation->new(”maximize => 1″,”visible => 1″);

$myie->gotoURL(”http://netrancher.0fees.net/wp-login.php”);

$myie->getTextBox(’id:’,”user_login”)->SetValue(”netrancher”);

$myie->getTextBox(’id:’,”user_pass”)->SetValue(”yourpassword”);

$myie->getButton(’name:’,”wp-submit”)->click();

sleep(3);

$myie->closeIE();



}
内容概要:本文提出了一种基于非合作博弈理论的居民负荷分层调度模型,并结合双层鲸鱼优化算法(Two-level Whale Optimization Algorithm)进行高效求解,模型与算法均通过Matlab代码实现。研究针对电力系统中居民侧用电负荷的复杂调度问题,引入非合作博弈机制刻画各用户之间的利益竞争关系,实现负荷的分层优化分配;同时设计双层优化架构,上层优化资源配置,下层模拟用户自主决策行为,提升了模型的实用性与合理性。通过智能优化算法求解多层级、非凸非线性的博弈模型,有效提高了调度方案的收敛性与全局寻优能力,适用于现代智能电网中的需求侧管理与能源优化场景。; 适合人群:具备电力系统基础理论知识和Matlab编程能力,从事智能电网、能源优化调度、需求侧管理、博弈论应用等方向的科研人员、高校研究生及工程技术人员。; 使用场景及目标:①应用于居民区电力负荷的分层优化调度系统设计与仿真分析;②为非合作博弈在多主体能源系统建模中的应用提供方法论支持;③利用双层鲸鱼算法解决具有嵌套结构的复杂双层优化问题,提升求解效率与调度方案的可行性。; 阅读建议:建议读者结合提供的Matlab代码深入理解模型构建逻辑与算法实现流程,重点关注博弈模型的效用函数设计、纳什均衡求解思路以及双层优化结构的迭代机制,宜配合实际用电数据开展复现实验以验证模型有效性与鲁棒性。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值