How to import mysql innodb with foreign key constraint error?

To import mysql innodb with foreign key constraint error, follow the steps below:-

  • If you have the access to mysql thru terminal, then you can use the command below:-
    mysql> SET foreign_key_checks = 0;
    mysql> SOURCE your_db_dump_file;
    mysql> SET foreign_key_checks = 1;
    
  • If you import your database thru web interface like phpmyadmin, then you need to edit the sql dump file. Add this to the 1st line of your sql db dump file:-
    SET foreign_key_checks = 0;
  • then add this line to the last line in your sql db dump file:-
    SET foreign_key_checks = 1;
  • Now you may import your sql dump file, and it should have no error by now.
Read more...

给openvpn客户分配固定ip

ifconfig-pool-persist ipp.txt

ipp.txt 内 就是固定 ip

 

 

 

在/etc/openvpn/server.conf中增加\
client-config-dir /etc/openvpn/ccd

然后在 /etc/openvpn/ccd目录中放针对每个客户端的个性化配置文件。
文件名就用客户端名 生成key的时候输入的 "Common Name" 名字

比如要设置客户端 liushiwei为 192.168.2.24 
只要在 /etc/openvpn/ccd/liushiwei文件中包含一行:

ifconfig-push 192.168.2.24 255.255.255.0


就可以了

 

sudochown-R nobody:nogroup /etc/openvpn/ccd

Read more...

批处理FINDSTR正则表达式用法实例分析

dos或批处理下findstr正则用法,会了这个我们就可以用批处理实现文本等搜索替换等
 
 
1.findstr . 2.txt 或 Findstr "." 2.txt 
从文件2.txt中查找任意字符,不包括空字符或空行 

2.findstr .* 2.txt 或 findstr ".*" 2.txt 
从文件2.txt中查找任意字符包括空行和空字符 

3.findstr "[0-9]" 2.txt 
从文件2.txt中查找包括数字0-9的字符串或行 

4.findstr "[a-zA-Z]" 2.txt 
从文件2.txt中查找包括任意字符的字符串或行 

5.findstr "[abcezy]" 2.txt 
从文件2.txt中查找包括a b c e z y字母的字符串或行 

6.findstr "[a-fl-z]" 2.txt 
从文件2.txt中查找小写字符a-f l-z的字符串,但不包含g h I j k这几个字母。 

7.findstr "M[abc][hig]Y" 2.txt 
从文件2.txt中可以匹配 MahY , MbiY, MahY等….. 

8. ^和$符号的应用 
^ 表示行首,"^step"仅匹配 "step hello world"中的第一个单词 
$ 表示行尾,"step$"仅匹配 "hello world step"中最后一个单词 

9.finstr "[^0-9]" 2.txt 
如果是纯数字的字符串或者行便过滤掉,例如2323423423 这样的字符串,如果是345hh888这样的形式就不成了。 

10.findstr "[^a-z]" 2.txt 
同上,如果是纯字母的字符串或者行便过滤掉,例如 sdlfjlkjlksjdklfjlskdf这样的字符,如果是sdfksjdkf99999这样的形式,掺杂着数字就不成了 

11.*号的作用 
前面已经说过了 ".*"表示搜索的条件是任意字符,*号在正则表达式中的作用不是任何字符,而是表示左侧字符或者表达式的重复次数,*号表示重复的次数为零次或者多次。 

12.findstr "^[0-9]*$" 2.txt 
这个是匹配找到的纯数字,例如 234234234234,如果是2133234kkjl234就被过滤掉了。 
Findstr "^[a-z]*$" 2.txt 
这个是匹配找到的纯字母,例如 sdfsdfsdfsdf,如果是213sldjfkljsdlk就被过滤掉了 
如果在搜索条件里没有*号,也就是说不重复左侧的搜索条件,也就是[0-9] [a-z]那只能匹配字符串的第一个字符也只有这一个字符,因为有行首和行尾的限制,"^[0-9]$"第一个字符如果是数字就匹配,如果不是就过滤掉,如果字符串是 9 就匹配,如果是98或者9j之类的就不可以了。 

13. "\<…\>"这个表达式的作用 
这个表示精确查找一个字符串,\<sss 表示字的开始位置,sss\>表示字的结束位置 
echo hello world computer|findstr "\<computer\>"这样的形式 
echo hello worldcomputer|findstr "\<computer\>" 这样的形式就不成了,他要找的是 "computer"这个字符串,所以不可以。 
echo hello worldcomputer|findstr ".*computer\>"这样就可以匹配了
Read more...
Subscribe to this RSS feed
( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php on line 191
Call Stack
#TimeMemoryFunctionLocation
10.0003399728{main}( ).../index.php:0
20.03201350520Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.03201350520Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.12292792728Joomla\CMS\Application\SiteApplication->dispatch( $component = ??? ).../SiteApplication.php:233
50.12332817112Joomla\CMS\Component\ComponentHelper::renderComponent( $option = 'com_k2', $params = ??? ).../SiteApplication.php:194
60.12372872464Joomla\CMS\Component\ComponentHelper::executeComponent( $path = '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:377
70.12382889520require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php ).../ComponentHelper.php:402
80.12733021784K2ControllerItemlist->execute( $task = '' ).../k2.php:64
90.12733021784K2ControllerItemlist->display( $cachable = ???, $urlparams = ??? ).../BaseController.php:710
100.12963045408K2ControllerItemlist->display( $cachable = TRUE, $urlparams = ['limit' => 'UINT', 'limitstart' => 'UINT', 'id' => 'INT', 'tag' => 'STRING', 'searchword' => 'STRING', 'day' => 'INT', 'year' => 'INT', 'month' => 'INT', 'print' => 'INT', 'lang' => 'CMD', 'Itemid' => 'INT', 'ordering' => 'CMD', 'm' => 'INT', 'amp' => 'INT', 'tmpl' => 'CMD', 'template' => 'CMD'] ).../itemlist.php:49
110.12963045408K2ControllerItemlist->display( $cachable = TRUE, $urlparams = ['limit' => 'UINT', 'limitstart' => 'UINT', 'id' => 'INT', 'tag' => 'STRING', 'searchword' => 'STRING', 'day' => 'INT', 'year' => 'INT', 'month' => 'INT', 'print' => 'INT', 'lang' => 'CMD', 'Itemid' => 'INT', 'ordering' => 'CMD', 'm' => 'INT', 'amp' => 'INT', 'tmpl' => 'CMD', 'template' => 'CMD'] ).../controller.php:19
120.13033052920Joomla\CMS\Cache\Controller\ViewController->get( $view = class K2ViewItemlist { public $document = class Joomla\CMS\Document\HtmlDocument { public $_links = [...]; public $_custom = [...]; public $template = NULL; public $baseurl = NULL; public $params = NULL; public $_file = NULL; protected $_template = ''; protected $_template_tags = [...]; protected $_caching = NULL; private $_html5 = NULL; public $title = 'Yan\'s BLOG'; public $description = '电脑 windows server 2008 win 7 nas 设置 configuration'; public $link = ''; public $base = 'https://www.shan.info/itemlist.html'; public $language = 'en-gb'; public $direction = 'ltr'; public $_generator = 'Joomla! - Open Source Content Management'; public $_mdate = ''; public $_tab = '\t'; public $_lineEnd = '\n'; public $_charset = 'utf-8'; public $_mime = 'text/html'; public $_namespace = ''; public $_profile = ''; public $_scripts = [...]; public $_script = [...]; protected $scriptOptions = [...]; public $_styleSheets = [...]; public $_style = [...]; public $_metaTags = [...]; public $_engine = NULL; public $_type = 'html'; protected $mediaVersion = '15dbf078d61dbbf76811992dd0143dd9' }; protected $_name = 'itemlist'; protected $_models = ['item' => class K2ModelItem { ... }, 'itemlist' => class K2ModelItemlist { ... }]; protected $_basePath = '/var/www/vhosts/shan.info/httpdocs/components/com_k2'; protected $_defaultModel = 'itemlist'; protected $_layout = 'category'; protected $_layoutExt = 'php'; protected $_layoutTemplate = '_'; protected $_path = ['template' => [...], 'helper' => [...]]; protected $_template = '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category_item.php'; protected $_output = '\n<article class="itemView groupLeading"> \t\n\t\t<time datetime="2013-08-01T18:15:29+02:00">\n\t\t01 Aug\t</time>\n\t\t\t\n\t<section>\t\t\n\t\t<header>\n\t\t\t\t\n\t\t\t\t\t\t<h2>\n\t\t\t\t\t\t\t\t\t\t<a href="/item/522-802-3ad-does-not-increase-the-bandwidth-for-a-single-conversation.html">802.3ad &quot;Does not increase the bandwidth for a single conversation</a>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</h2>\n\t\t\t\t\t\t\n\t\t\t<ul>\n\t\t\t\t\t\t\t\t<li class="itemCategory"> <span>Published in</span> <a href="/ite'; protected $_escape = 'htmlspecialchars'; protected $_charset = 'UTF-8'; protected $_errors = []; public $baseurl = ''; public $now = '2021-01-27 23:15:08'; public $nullDate = '0000-00-00 00:00:00'; public $user = class Joomla\CMS\User\User { protected $isRoot = FALSE; public $id = 0; public $name = NULL; public $username = NULL; public $email = NULL; public $password = NULL; public $password_clear = ''; public $block = NULL; public $sendEmail = 0; public $registerDate = NULL; public $lastvisitDate = NULL; public $activation = NULL; public $params = NULL; public $groups = [...]; public $guest = 1; public $lastResetTime = NULL; public $resetCount = NULL; public $requireReset = NULL; protected $_params = class Joomla\Registry\Registry { ... }; protected $_authGroups = NULL; protected $_authLevels = [...]; protected $_authActions = NULL; protected $_errorMsg = NULL; protected $userHelper = class Joomla\CMS\User\UserWrapper { ... }; protected $_errors = [...]; public $aid = 0; public $gid = 1 }; public $feed = 'https://www.shan.info/itemlist.html?start=16&format=feed&Itemid=53'; public $leading = [0 => class stdClass { ... }, 1 => class stdClass { ... }, 2 => class stdClass { ... }, 3 => class stdClass { ... }, 4 => class stdClass { ... }, 5 => class stdClass { ... }, 6 => class stdClass { ... }, 7 => class stdClass { ... }]; public $primary = []; public $secondary = []; public $links = []; public $params = class Joomla\Registry\Registry { protected $data = class stdClass { ... }; protected $initialized = TRUE; public $separator = '.' }; public $pagination = class Joomla\CMS\Pagination\Pagination { public $limitstart = 16; public $limit = 8; public $total = 334; public $prefix = ''; public $pagesStart = 1; public $pagesStop = 10; public $pagesCurrent = 3; public $pagesTotal = 42; public $hideEmptyLimitstart = FALSE; protected $viewall = FALSE; protected $additionalUrlParams = [...]; protected $app = class Joomla\CMS\Application\SiteApplication { ... }; protected $data = NULL }; public $item = class stdClass { public $id = '522'; public $title = '802.3ad &quot;Does not increase the bandwidth for a single conversation'; public $alias = '802-3ad-does-not-increase-the-bandwidth-for-a-single-conversation'; public $catid = '67'; public $published = '1'; public $introtext = '<p><span style="color: #333333; font-family: \'Lucida Grande\', \'Trebuchet MS\', Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18.1875px; background-color: #ecf3f7;">According to&nbsp;</span><a class="postlink" style="margin: 0px; padding: 0px; direction: ltr; unicode-bidi: embed; color: #5d8fbd; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-family: \'Lucida Grande\', \'Trebuchet MS\', Verdana, Helvetica, Arial, sans-serif; font-size: 13px;'; public $fulltext = ''; public $video = NULL; public $gallery = NULL; public $extra_fields = '[]'; public $extra_fields_search = ''; public $created = '2013-08-01 16:15:29'; public $created_by = '63'; public $created_by_alias = ''; public $checked_out = '63'; public $checked_out_time = '2013-08-01 16:16:54'; public $modified = '0000-00-00 00:00:00'; public $modified_by = '0'; public $publish_up = '2013-08-01 16:15:29'; public $publish_down = '0000-00-00 00:00:00'; public $trash = '0'; public $access = '1'; public $ordering = '12'; public $featured = '0'; public $featured_ordering = '0'; public $image_caption = ''; public $image_credits = ''; public $video_caption = ''; public $video_credits = ''; public $hits = '1017'; public $params = class Joomla\Registry\Registry { ... }; public $metadesc = ''; public $metadata = 'robots=\nauthor='; public $metakey = ''; public $plugins = ''; public $language = '*'; public $categoryname = 'Qnap'; public $categoryid = '67'; public $categoryalias = 'qnap'; public $categoryparams = '{"inheritFrom":"0","theme":"","num_leading_items":"0","num_leading_columns":"1","leadingImgSize":"Large","num_primary_items":"10","num_primary_columns":"1","primaryImgSize":"Medium","num_secondary_items":"0","num_secondary_columns":"1","secondaryImgSize":"Small","num_links":"0","num_links_columns":"1","linksImgSize":"XSmall","catCatalogMode":"0","catFeaturedItems":"1","catOrdering":"","catPagination":"2","catPaginationResults":"1","catTitle":"1","catTitleItemCounter":"1","catDescription":"0","catImage":"0",'; public $itemGroup = 'leading'; public $category = class TableK2Category { ... }; public $link = '/item/522-802-3ad-does-not-increase-the-bandwidth-for-a-single-conversation.html'; public $printLink = '/item/522-802-3ad-does-not-increase-the-bandwidth-for-a-single-conversation.html?tmpl=component&amp;print=1'; public $tags = [...]; public $imageXSmall = ''; public $imageSmall = ''; public $imageMedium = ''; public $imageLarge = ''; public $imageXLarge = ''; public $rawTitle = '802.3ad "Does not increase the bandwidth for a single conversation'; public $author = class Joomla\CMS\User\User { ... }; public $text = '<p><span style="color: #333333; font-family: \'Lucida Grande\', \'Trebuchet MS\', Verdana, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18.1875px; background-color: #ecf3f7;">According to&nbsp;</span><a class="postlink" style="margin: 0px; padding: 0px; direction: ltr; unicode-bidi: embed; color: #5d8fbd; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: #666666; font-family: \'Lucida Grande\', \'Trebuchet MS\', Verdana, Helvetica, Arial, sans-serif; font-size: 13px;'; public $event = class stdClass { ... }; public $jcfields = [...]; public $image = ''; public $imageWidth = '600' } }, $method = 'display', $id = ???, $wrkarounds = ??? ).../BaseController.php:663
130.13133073608K2ViewItemlist->display( $tpl = ??? ).../ViewController.php:102
140.18913986864K2ViewItemlist->display( $tpl = NULL ).../view.html.php:1407
150.18913986864K2ViewItemlist->loadTemplate( $tpl = NULL ).../HtmlView.php:230
160.18974063688include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/category.php ).../HtmlView.php:701