c++construct模板的问题 10C

template
inline void
Construct(_T1* __p, _Args&&... __args)
{ ::new(static_cast(
_p)) T1(std::forward<_Args>(_args)...); }
上面这段是我系统里的stl_construct.h里的construct模板,我用的不是SGI STL所以这段代码没用,但是这段代码是错的吧,可变参数大于2时,会用多个参数构造_T1,我查了一下SGI中的construct模板,没有查到这种可变参数版本的,想问这个模板怎么写才正确

2个回答

试试这个

 template <class T1 >
inline void
Construct(_T1* __p, _Args&&... __args)
{
    ::new(static_cast(_p)) T1(std::forward<_Args>(_args)...);
}
u014789012
逆水行舟天涯路 写错了~
2 年多之前 回复
u014789012
逆水行舟天涯路 template <class T1,class _T1> inline void Construct(_T1* __p, ...) { ::new(static_cast(_p)) T1(...); }
2 年多之前 回复

这是C++11及以后才支持的语法吧?系统头文件里的不会有错,只不过我们一般用不了这么复杂,这么写我猜也能覆盖单参数的情形。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
类模板问题,undefined reference与报错无法解析的外部符号

今天编写了一个双向循环链表,想做一个模板类就用模板写了,结果无限报错。 代码如下: ``` #ifndef _DoublyCircularList_H_ #define _DoublyCircularList_H_ #include "listNode.h" // 双向循环链表类声明 template<typename Type> class DoublyCircularList { private: ListNode<Type>* head; size_t count; public: DoublyCircularList(const size_t size); // DoublyCircularList(const DoublyCircularList& ano); ~DoublyCircularList(); bool insert_(const Type& data, const size_t pos); // bool delete_(const size_t pos); // bool update_(const Type& data, const size_t pos); // bool search_(const size_t pos) const; // size_t getCount() const; // Type getData() const; // void printList() const; // void vprintList() const; }; #endif ``` ``` #include <iostream> #include "doublyCircularList.h" using namespace std; // 双向循环链表类定义 // 构造函数,负责创建size个结点的双向链表 template<typename Type> DoublyCircularList<Type>::DoublyCircularList(const size_t size) { count = 0; // 创建头结点 head = new ListNode<Type>; head->prev = head->next = head; // 插入size个结点 Type x; cout << "-----Ready to construct DoublyCircularList-----" << endl; cout << "Please input " << size << " data:" << endl; for(size_t i = 0; i < size; ++i){ cin >> x; // insert_(x, i); } cout << "-----Input data end-----" << endl << endl; } template<typename Type> DoublyCircularList<Type>::~DoublyCircularList() { } ``` ``` #include <iostream> #include "doublyCircularList.h" using namespace std; int main() { cout << "----DoublyCircularList----\n" << endl; DoublyCircularList<int> L1(6); getchar(); return 0; } ``` 在DevC++上编译显示 ... undefined reference to DoublyCircularList< int>::DoublyCircularList(unsigned long long) undefined reference to DoublyCircularList< int>::~DoublyCircularList() ... 在VS2008上显示error LNK2019: 无法解析的外部符号 "public: __thiscall DoublyCircularList<int>::~DoublyCircularList<int>(void)" (??1?$DoublyCircularList@H@@QAE@XZ),该符号在函数 _main 中被引用 ... error LNK2019: 无法解析的外部符号 "public: __thiscall DoublyCircularList<int>::DoublyCircularList<int>(unsigned int)" (??0?$DoublyCircularList@H@@QAE@I@Z),该符号在函数 _main 中被引用 ... 实在没搞懂这是什么意思,求高手指点迷津,感激不尽

在降价电子邮件模板中使用特征问题

<div class="post-text" itemprop="text"> <p>I'm trying to use php Trait method inside my markdown mail template in laravel, problem is I'm getting the following error:</p> <pre><code> ErrorException : Call to undefined method Illuminate\View\Engines\CompilerEngine::getExcerpt() (View: C:\xampp\htdocs\dtcburger.com esources\views\emails\weekly\weekly-mail-1.blade.php) </code></pre> <p>I'm trying to use getExcerpt mehod from my Strings php Trait class, but it's not working.</p> <p>This is my mailable class:</p> <pre><code>&lt;?php namespace App\Mail\weekly; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue; use App\Traits\Strings; class WeeklyMail1 extends Mailable { use Queueable, SerializesModels; use Strings; public $mailData; public function __construct($mailData) { $this-&gt;mailData = $mailData; } public function build() { $mail = $this-&gt;markdown('emails.weekly.weekly-mail-1') -&gt;from(env('MAIL_FROM'), env('MAIL_FROM_NAME')) -&gt;subject($this-&gt;mailData['subject']); return $mail; } } </code></pre> <p>And my markdown mail template:</p> <pre><code> @component('mail::message', ['mailData' =&gt; $mailData]) # {{ $mailData['subject'] }} @if(count($mailData['events']) &gt; 0) # No te pierdas nuestros próximos eventos @component('mail::table') | | | | :------------- | :------------- | @foreach($mailData['events'] as $event) | &lt;img src="{{ $event-&gt;image }}" style="min-width:120px; max-width:120px; min-height:100px; max-height:100px;"&gt; | &lt;strong&gt;&lt;p&gt;{{ $event-&gt;title }}&lt;/p&gt;&lt;/strong&gt;&lt;p&gt;{{!! $this-&gt;getExcerpt($event-&gt;body, 0, 100) !!}}&lt;/p&gt; | @endforeach @endcomponent @endif @endcomponent </code></pre> <p>And my Strings Trait with method getExcerpt inside:</p> <pre><code>&lt;?php namespace App\Traits; use Str; trait Strings { public function slugify($title){ $cleanString = $this-&gt;cleanString($title); $slugified = Str::lower( Str::slug($title, '-') ); return $slugified; } public function getExcerpt($str, $startPos = 0, $maxLength = 30, $end = '[...]') { if(strlen($str) &gt; $maxLength) { $excerpt = substr($str, $startPos, $maxLength - 6); $lastSpace = strrpos($excerpt, ' '); $excerpt = substr($excerpt, 0, $lastSpace); $excerpt .= $end; } else { $excerpt = $str; } return $excerpt; } } </code></pre> </div>

与php刀片模板的codeigniter错误/不允许直接脚本访问

<div class="post-text" itemprop="text"> <p>I have installed all the required component to use blade but am getting an error message when I run my code. here is my MY_Controller file</p> <pre><code>&lt;?php defined('BASEBATH') OR exit ('No direct script access allowed'); use Coolpraz\PhpBlade\PhpBlade; class MY_Controller extends CI_Controller{ protected $views = APPBATH. 'views'; protected $cache = APPBATH. 'cache'; protected $blade; public function __construct(){ parent:: __construct(); $this-&gt;$blade = new PhpBlade($this-&gt;$views, $this-&gt;$cache); } } </code></pre> </div>

使用codeigniter在头文件上加载菜单

<div class="post-text" itemprop="text"> <p>I'm new to Codeigniter and i have been trying to develop some part using it. On my header file, i need to load my menu items and i have create a menu controller, menu model and a view. Controller page</p> <pre><code>&lt;?php class Menu extends CI_Controller { public function __construct(){ parent::__construct(); $this-&gt;load-&gt;model('menu_model'); } public function index(){ $data['menuArray'] = $this-&gt;mainMenuDataLoad(); if($data['menuArray']){ $this-&gt;load-&gt;view('menu' , $data); } } public function mainMenuDataLoad(){ /* create menus Array */ $rootMenuData = $this-&gt;menu_model-&gt;loadManuData(); if($rootMenuData){ for($e=0; $e&lt;count($rootMenuData); $e++){ if($rootMenuData[$e]){ $data[$e] = array( 'title' =&gt; $rootMenuData[$e]['title'], 'menu_id' =&gt; $rootMenuData[$e]['menu_id'], 'url' =&gt; $rootMenuData[$e]['url'], 'menu_icon' =&gt; $rootMenuData[$e]['menu_icon'], ); $get_sub = $this-&gt;mainMenuDataLoad($rootMenuData[$e]['menu_id']); if($get_sub){ $data[$e]['sub'] = $get_sub; } } } return $data; } return false; } } </code></pre> <p>this is my model page</p> <pre><code>class Menu_model extends CI_Model{ public function loadManuData(){ $this-&gt;db-&gt;select("*"); $this-&gt;db-&gt;from('tbl_menu'); $this-&gt;db-&gt;order_by("order", "DESC"); $query = $this-&gt;db-&gt;get(); if ($query-&gt;num_rows() &gt; 0) { $r=0; foreach ($query-&gt;result() as $row) { $data[$r]['root_id'] = $row-&gt;root_id; $data[$r]['menu_id'] = $row-&gt;menu_id; $data[$r]['title'] = $row-&gt;title; $data[$r]['url'] = $row-&gt;url; $data[$r]['menu_icon'] = $row-&gt;menu_icon; $r++; } return $data; } return false; } public function __construct(){ parent::__construct(); }} </code></pre> <p>andon my menu view page i am looping the menu data. But on my header.php if i try to call the menu controller like this</p> <pre><code>$this-&gt;load-&gt;controller('menu'); </code></pre> <p>it gives me an error like this.</p> <blockquote> <p>Fatal error: Call to undefined method CI_Loader::controller() on header.php</p> </blockquote> <p>What am i doing wrong?. Someone please guide me. thanks in advance</p> <p>menu.php view Page</p> <pre><code> &lt;ul class="nav navbar-nav"&gt; &lt;?php print_r($menuArray); for($q=1; $q&lt;count($menuArray); $q++){ ?&gt;&lt;li&gt; &lt;a href="&lt;?php echo base_url($menuArray[$q]['url']);?&gt;"&gt; &lt;span class="&lt;?php echo $menuArray[$q]['menu_icon'];?&gt;"&gt; &lt;?php echo $menuArray[$q]['title'];?&gt; &lt;/span&gt; &lt;/a&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;/ul&gt; </code></pre> </div>

模板中的未定义变量

<div class="post-text" itemprop="text"> <p>I am getting the undefined variable whenever I load the controller.</p> <p>Here is the index function from the controller that gets called ( 4th line ) and the same error in every other occurrence.</p> <pre><code>&lt;?php class Students extends CI_Controller { public function __construct() { parent::__construct(); $this-&gt;load-&gt;model('Student_model'); } public function index() { $data['view_name'] = 'students/dashboard'; $this-&gt;load-&gt;view('templates/template_student' , $data ); } } </code></pre> <p>And the part of the template where the error comes from This is a part of the code from the template_student template</p> <pre><code>&lt;ul class="nav navbar-nav navbar-right"&gt; &lt;li class=""&gt; &lt;a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false"&gt; &lt;?php if ($student-&gt;passport_photo == '') { ?&gt; &lt;img src="&lt;?php echo base_url(); ?&gt;assets/images/sample.jpg" alt=""&gt; &lt;?php } else { ?&gt; &lt;img src="&lt;?php echo base_url(); ?&gt;&lt;?php echo $student-&gt;passport_photo; ?&gt;" alt=""&gt; &lt;?php } ?&gt; &lt;?php if ($this-&gt;session-&gt;userdata('logged_in')) : ?&gt; &lt;?php echo $this-&gt;session-&gt;userdata('first_name') . " " . $this-&gt;session-&gt;userdata('last_name'); ?&gt; &lt;?php endif; ?&gt; &lt;span class=" fa fa-angle-down"&gt;&lt;/span&gt; &lt;/a&gt; &lt;ul class="dropdown-menu dropdown-usermenu pull-right"&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;students/profile"&gt; Profile&lt;/a&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="&lt;?php echo base_url(); ?&gt;students/logout"&gt;&lt;i class="fa fa-sign-out pull-right"&gt;&lt;/i&gt; Log Out&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>What have I done wrong?</p> </div>

Smarty从课堂上获取while模板

<div class="post-text" itemprop="text"> <p>I'm totally new to smarty... and it's creeping me out :)</p> <p>I got the following class in /inc/class/search.php:</p> <pre><code>Class search { function __construct($request) { global $dbconn; $request = htmlspecialchars($request); $sql = "SELECT * FROM table WHERE id LIKE '%{$request}%'"; $res = $dbconn-&gt;Query($sql); $entity = $res-&gt;fetchArray(); return $entity; } } </code></pre> <p>I have this in php_head.php:</p> <pre><code>if (isset($_REQUEST['search']) &amp;&amp; !empty($_REQUEST['search'])) { $is = new search($_REQUEST['search']); $smarty-&gt;assign("searchValues", $is); } </code></pre> <p>This code in php_head is designed to be called by ajax later on. But when I run index.php?search=string I get the whole smarty template. Please help.</p> </div>

简单的手工PHP模板引擎无法正常工作! 请帮忙

<div class="post-text" itemprop="text"> <p>These are the class definitions</p> <pre><code>&lt;?php abstract class MyTemplate { protected $arrayOfSpaces; protected $arrayOfVariables; protected $output; protected abstract function __construct(); function outputHTML(){ echo $output; //Apparently, the problem is HERE. &lt;&lt;&lt;&lt;&gt;&gt;&gt;&gt;&gt; } } class MyTemplateMain extends MyTemplate { function __construct(){ $this-&gt;output="&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; I love Rock n Roll!!! &lt;/body&gt; &lt;/html&gt;"; } } ?&gt; </code></pre> <p>And this is where I launch this page</p> <pre><code>&lt;?php require_once("view/templates.php"); $page=new MyTemplateMain(); $page-&gt;outputHTML(); ?&gt; </code></pre> <p>Doesn't work, though. Just shows a blank page, without the String I love rock n roll which was supposed to appear in the body.</p> <p>I'm sure there are better ways to implement templates but I just want to figure out why this particular example doesn't work</p> <p>Any help is appreciated. Thanks</p> <p>PS: The quotes are all duly escaped and the file paths are ok too</p> </div>

模板库不与HMVC codeigniter一起使用

<div class="post-text" itemprop="text"> <p>I am using this library code to use template functionally in HMVC codeigniter, but its showing "Unable to load the requested file: /.php" </p> <pre><code>class Template { var $ci; function __construct() { $this-&gt;ci =&amp; get_instance(); } function load($tpl_view, $body_view = null, $data = null) { if ( ! is_null( $body_view ) ) { if ( file_exists( APPPATH.'views/'.$tpl_view.'/'.$body_view ) ) { $body_view_path = $tpl_view.'/'.$body_view; } else if ( file_exists( APPPATH.'views/'.$tpl_view.'/'.$body_view.'.php' ) ) { $body_view_path = $tpl_view.'/'.$body_view.'.php'; } else if ( file_exists( APPPATH.'views/'.$body_view ) ) { $body_view_path = $body_view; } else if ( file_exists( APPPATH.'views/'.$body_view.'.php' ) ) { $body_view_path = $body_view.'.php'; } else { show_error('Unable to load the requested file: ' . $tpl_name.'/'.$view_name.'.php'); } $body = $this-&gt;ci-&gt;load-&gt;view($body_view_path, $data, TRUE); if ( is_null($data) ) { $data = array('body' =&gt; $body); } else if ( is_array($data) ) { $data['body'] = $body; } else if ( is_object($data) ) { $data-&gt;body = $body; } } $this-&gt;ci-&gt;load-&gt;view('template/'.$tpl_view, $data); } } </code></pre> <p>I am accessing using:</p> <pre><code>$this-&gt;template-&gt;load('main','dashboard/dashboard'); </code></pre> <p>Here is my folder structure:</p> <p><a href="https://i.stack.imgur.com/x7MYf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x7MYf.png" alt="here is my folder structure"></a></p> </div>

我正在尝试将我的模板与“i18n Extension”整合到twig中。 坚持与xgettext集成

<div class="post-text" itemprop="text"> <p>The integration works fine. But when I am trying to integrate it with xgettext for template string i get fatal error. There is an error</p> <blockquote> <p><em>Fatal error: Uncaught Twig_Error_Loader: Unable to find template "C:/MAMP/htdocs/views/site/blocks/contactform.html" (looked into: C:\MAMP\htdocs/views/site). in C:\MAMP\htdocs\components\twig\Loader\Filesystem.php:232 Stack trace: 0 C:\MAMP\htdocs\components\twig\Loader\Filesystem.php(150): Twig_Loader_Filesystem-&gt;findTemplate('C:/MAMP/htdocs/...') #1 C:\MAMP\htdocs\components\twig\Environment.php(329): Twig_Loader_Filesystem-&gt;getCacheKey('C:\MAMP\htdocs/...') #2 C:\MAMP\htdocs\components\twig\Environment.php(419): Twig_Environment-&gt;getTemplateClass('C:\MAMP\htdocs/...') #3 C:\MAMP\htdocs\controllers\mainController.php(43): Twig_Environment-&gt;loadTemplate('C:\MAMP\htdocs/...') #4 C:\MAMP\htdocs\controllers\siteController.php(22): mainController-&gt;loadTwig() #5 C:\MAMP\htdocs\components outer.php(83): siteController-&gt;actionIndex() #6 C:\MAMP\htdocs\index.php(12): Router-&gt;Run() #7 {main} thrown in C:\MAMP\htdocs\components\twig\Loader\Filesystem.php on line 232</em></p> </blockquote> <p>And here is my code:</p> <pre><code>class mainController { var $twig = null; public $configs; public $langlibrary; const DEFAULT_LANGUAGE = 'en'; public function __construct() { $this-&gt;configs = Config::getConfigiration(); } public function loadTwig() { require_once 'components/Twig/Autoloader.php'; Twig_Autoloader::register(); $tplDir = ROOT.'/views/site'; $tmpDir = 'cache'; $loader = new Twig_Loader_Filesystem($tplDir); $this-&gt;twig = new Twig_Environment($loader, array( 'cache' =&gt; $tmpDir, 'auto_reload' =&gt; true )); $this-&gt;twig-&gt;addExtension(new Twig_Extensions_Extension_I18n()); // THE PROBLEM BEGINS WHEN ADD CODE BELOW FOR INETGRATION foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tplDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { // force compilation if ($file-&gt;isFile()) { $this-&gt;twig-&gt;loadTemplate(str_replace($tplDir.'/', '', $file)); } } </code></pre> </div>

致命错误:未捕获的ArgumentCountError

<div class="post-text" itemprop="text"> <p>I get this error. I created a button to update the table. When I click the button, I get an error. How to fix it?</p> <blockquote> <p>Fatal error: Uncaught ArgumentCountError: Too few arguments to function personel::update_form(), 0 passed in C:\xampp\htdocs\warehouse\panel\system\core\CodeIgniter.php on line 360 and exactly 1 expected in C:\xampp\htdocs\warehouse\panel\application\controllers\personel.php:57 Stack trace: #0 C:\xampp\htdocs\warehouse\panel\system\core\CodeIgniter.php(360): personel-&gt;update_form() #1 C:\xampp\htdocs\warehouse\panel\index.php(202): require_once('C:\xampp\htdocs...') #2 {main} thrown in C:\xampp\htdocs\warehouse\panel\application\controllers\personel.php on line 57</p> </blockquote> <p><strong>Fİle Name: personel.php</strong> <strong>Controller</strong></p> <p><strong>MY CODES</strong></p> <pre><code> public function update_form($id){ $where = array( "id" =&gt; $id); $personel = $this-&gt;Personel_model-&gt;get($where); $viewData["personel"] = $personel; $this-&gt;load-&gt;view("personel_edit"); } </code></pre> <p><strong>MY BUTTON CODES</strong></p> <pre><code> &lt;a href="&lt;?php echo base_url("personel/update_form"); ?&gt;" class="btn-sm btn-warning"&gt;Update &lt;/a&gt; </code></pre> </div>

无法将数据从模型传递到视图

<div class="post-text" itemprop="text"> <p>Hello i'm having problem on passing some data from my Model to my View, with this following code:</p> <p>Controller:</p> <pre><code>class Welcome extends CI_Controller { function __construct() { parent::__construct(); $this-&gt;load-&gt;library('session'); $this-&gt;load-&gt;helper('form'); $this-&gt;load-&gt;helper('url'); } public function testing(){ $query = $this-&gt;Model-&gt;getEmployees(); if(isset($query)){ $data['fds'] = $query; } $this-&gt;load-&gt;view('UserPage', $data); } } </code></pre> <p>Model:</p> <pre><code>class Model extends CI_Model{ function __construct() { parent::__construct(); $this-&gt;load-&gt;library('session'); } public function getEmployees(){ $this-&gt;db-&gt;select('*'); $this-&gt;db-&gt;where("idcliente='".$_SESSION['userid']."'"); $query=$this-&gt;db-&gt;get('marcacao'); return $query-&gt;num_rows() &gt; 0 ? $query-&gt;result() : NULL; } } </code></pre> <p>View:</p> <pre><code>&lt;table class="table table-striped table-bordered"&gt; &lt;tr&gt; &lt;td&gt;&lt;strong&gt;Employee Id&lt;/strong&gt;&lt;/td&gt; &lt;td&gt;&lt;strong&gt;First Name&lt;/strong&gt;&lt;/td&gt; &lt;td&gt;&lt;strong&gt;Last Name&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php foreach($fds as $employee){?&gt; &lt;tr&gt; &lt;td&gt;&lt;? =$employee-&gt;data;?&gt;&lt;/td&gt; &lt;td&gt;&lt;? =$employee-&gt;hora;?&gt;&lt;/td&gt; &lt;td&gt;&lt;? =$employee-&gt;tipo;?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php }?&gt; &lt;/table&gt; </code></pre> <p>I've tried several things that I've seen here but none works... Hope you can help me.</p> </div>

访问FUEL CMS中的“博客”功能/模板

<div class="post-text" itemprop="text"> <p>I'm having trouble getting the "stock" blog functionality / template working within FUEL CMS.</p> <p>I have read that it is already there, stock with the download configuration of the CMS; I have also tried creating one from scratch and uploading a 'blog' theme from a project found in GitHub. None have worked so far.</p> <p>I found the blog variable at:</p> <pre><code>_variables/global.php </code></pre> <p>I have created a 'blog' controller via interpretation of (gappy) docs.</p> <p>By adding the below code within it; then making a corresponding 'blog.php' view. I get nothing but a <strong>404 error</strong>.</p> <pre><code>&lt;?php class Blog extends CI_Controller { public function view($page = 'home') { //you can acesse this http://example.com/blog/view/ } public function new($page = 'home') { //you can acesse this http://example.com/blog/new/ } } </code></pre> <p>Within the modules folder. I found this 'stock' blog controller file. But don't know how to use it? found at: <strong>/fuel/modules/blog/controller/blog.php</strong></p> <pre><code>&lt;?php require_once(MODULES_PATH.'/blog/libraries/Blog_base_controller.php'); class Blog extends Blog_base_controller { function __construct() { parent::__construct(); } function _remap() { $year = ($this-&gt;uri-&gt;rsegment(2) != 'index') ? (int) $this-&gt;uri-&gt;rsegment(2) : NULL; $month = (int) $this-&gt;uri-&gt;rsegment(3); $day = (int) $this-&gt;uri-&gt;rsegment(4); $slug = $this-&gt;uri-&gt;rsegment(5); $limit = (int) $this-&gt;fuel-&gt;blog-&gt;config('per_page'); $view_by = 'page'; // we empty out year variable if it is page because we won't be querying on year' if (preg_match('#\d{4}#', $year) &amp;&amp; !empty($year) &amp;&amp; empty($slug)) { $view_by = 'date'; } // if the first segment is id then treat the second segment as the id else if ($this-&gt;uri-&gt;rsegment(2) === 'id' &amp;&amp; $this-&gt;uri-&gt;rsegment(3)) { $view_by = 'slug'; $slug = (int) $this-&gt;uri-&gt;rsegment(3); $post = $this-&gt;fuel-&gt;blog-&gt;get_post($slug); if (isset($post-&gt;id)) { redirect($post-&gt;url); } } else if (!empty($slug)) { $view_by = 'slug'; } // set this to false so that we can use segments for the limit $cache_id = fuel_cache_id(); $cache = $this-&gt;fuel-&gt;blog-&gt;get_cache($cache_id); if (!empty($cache)) { $output =&amp; $cache; } else { $vars = $this-&gt;_common_vars(); if ($view_by == 'slug') { return $this-&gt;post($slug); } else if ($view_by == 'date') { $page_title_arr = array(); $posts_date = mktime(0, 0, 0, $month, $day, $year); if (!empty($day)) $page_title_arr[] = $day; if (!empty($month)) $page_title_arr[] = date('M', strtotime($posts_date)); if (!empty($year)) $page_title_arr[] = $year; // run before_posts_by_date hook $hook_params = array('year' =&gt; $year, 'month' =&gt; $month, 'day' =&gt; $day, 'slug' =&gt; $slug, 'limit' =&gt; $limit); $this-&gt;fuel-&gt;blog-&gt;run_hook('before_posts_by_date', $hook_params); $vars = array_merge($vars, $hook_params); $vars['page_title'] = $page_title_arr; $vars['posts'] = $this-&gt;fuel-&gt;blog-&gt;get_posts_by_date($year, (int) $month, $day, $slug); $vars['pagination'] = ''; } else { $limit = $this-&gt;fuel-&gt;blog-&gt;config('per_page'); $this-&gt;load-&gt;library('pagination'); $config['uri_segment'] = 3; $offset = $this-&gt;uri-&gt;segment($config['uri_segment']); $this-&gt;config-&gt;set_item('enable_query_strings', FALSE); $config = $this-&gt;fuel-&gt;blog-&gt;config('pagination'); $config['base_url'] = $this-&gt;fuel-&gt;blog-&gt;url('page/'); //$config['total_rows'] = $this-&gt;fuel-&gt;blog-&gt;get_posts_count(); $config['page_query_string'] = FALSE; $config['per_page'] = $limit; $config['num_links'] = 2; //$this-&gt;pagination-&gt;initialize($config); if (!empty($offset)) { $vars['page_title'] = lang('blog_page_num_title', $offset, $offset + $limit); } else { $vars['page_title'] = ''; } // run before_posts_by_date hook $hook_params = array('offset' =&gt; $offset, 'limit' =&gt; $limit, 'type' =&gt; 'posts'); $this-&gt;fuel-&gt;blog-&gt;run_hook('before_posts_by_page', $hook_params); $vars['offset'] = $offset; $vars['limit'] = $limit; $vars['posts'] = $this-&gt;fuel-&gt;blog-&gt;get_posts_by_page($limit, $offset); // run hook again to get the proper count $hook_params['type'] = 'count'; $this-&gt;fuel-&gt;blog-&gt;run_hook('before_posts_by_page', $hook_params); //$config['total_rows'] = count($this-&gt;fuel-&gt;blog-&gt;get_posts_by_page()); $config['total_rows'] = $this-&gt;fuel-&gt;blog-&gt;get_posts_count(); // create pagination $this-&gt;pagination-&gt;initialize($config); $vars['pagination'] = $this-&gt;pagination-&gt;create_links(); } // show the index page if the page doesn't have any uri_segment(3)' $view = ($this-&gt;uri-&gt;rsegment(2) == 'index' OR ($this-&gt;uri-&gt;rsegment(2) == 'page' AND !$this-&gt;uri-&gt;segment(3))) ? 'index' : 'posts'; $output = $this-&gt;_render($view, $vars, TRUE); $this-&gt;fuel-&gt;blog-&gt;save_cache($cache_id, $output); } $this-&gt;output-&gt;set_output($output); } function post($slug = null) { if (empty($slug)) { redirect_404(); } $this-&gt;load-&gt;library('session'); $blog_config = $this-&gt;fuel-&gt;blog-&gt;config(); // run before_posts_by_date hook $hook_params = array('slug' =&gt; $slug); $this-&gt;fuel-&gt;blog-&gt;run_hook('before_post', $hook_params); $post = $this-&gt;fuel-&gt;blog-&gt;get_post($slug); if (isset($post-&gt;id)) { $vars = $this-&gt;_common_vars(); $vars['post'] = $post; $vars['user'] = $this-&gt;fuel-&gt;blog-&gt;logged_in_user(); $vars['page_title'] = $post-&gt;title; $vars['next'] = $this-&gt;fuel-&gt;blog-&gt;get_next_post($post); $vars['prev'] = $this-&gt;fuel-&gt;blog-&gt;get_prev_post($post); $vars['slug'] = $slug; $vars['is_home'] = $this-&gt;fuel-&gt;blog-&gt;is_home(); $antispam = md5(random_string('unique')); $field_values = array(); // post comment if (!empty($_POST)) { $field_values = $_POST; // the id of "content" is a likely ID on the front end, so we use comment_content and need to remap $field_values['content'] = $field_values['new_comment']; unset($field_values['antispam']); if (!empty($_POST['new_comment'])) { $vars['processed'] = $this-&gt;_process_comment($post); } else { add_error(lang('blog_error_blank_comment')); } } $cache_id = fuel_cache_id(); $cache = $this-&gt;fuel-&gt;blog-&gt;get_cache($cache_id); if (!empty($cache) AND empty($_POST)) { $output =&amp; $cache; } else { $this-&gt;load-&gt;library('form'); if (is_true_val($this-&gt;fuel-&gt;blog-&gt;config('use_captchas'))) { $captcha = $this-&gt;_render_captcha(); $vars['captcha'] = $captcha; } $vars['thanks'] = ($this-&gt;session-&gt;flashdata('thanks')) ? blog_block('comment_thanks', $vars, TRUE) : ''; $vars['comment_form'] = ''; $this-&gt;session-&gt;set_userdata('antispam', $antispam); if ($post-&gt;allow_comments) { $this-&gt;load-&gt;module_model(BLOG_FOLDER, 'blog_comments_model'); $this-&gt;load-&gt;library('form_builder', $blog_config['comment_form']); $fields['author_name'] = array('label' =&gt; 'Name', 'required' =&gt; TRUE); $fields['author_email'] = array('label' =&gt; 'Email', 'required' =&gt; TRUE); $fields['author_website'] = array('label' =&gt; 'Website'); $fields['new_comment'] = array('label' =&gt; 'Comment', 'type' =&gt; 'textarea', 'required' =&gt; TRUE); $fields['post_id'] = array('type' =&gt; 'hidden', 'value' =&gt; $post-&gt;id); $fields['antispam'] = array('type' =&gt; 'hidden', 'value' =&gt; $antispam); if (!empty($vars['captcha'])) { $fields['captcha'] = array('required' =&gt; TRUE, 'label' =&gt; 'Security Text', 'value' =&gt; '', 'after_html' =&gt; ' &lt;span class="captcha"&gt;'.$vars['captcha']['image'].'&lt;/span&gt;&lt;br /&gt;&lt;span class="captcha_text"&gt;'.lang('blog_captcha_text').'&lt;/span&gt;'); } // now merge with config... can't do array_merge_recursive' foreach($blog_config['comment_form']['fields'] as $key =&gt; $field) { if (isset($fields[$key])) $fields[$key] = array_merge($fields[$key], $field); } if (!isset($blog_config['comment_form']['label_layout'])) $this-&gt;form_builder-&gt;label_layout = 'left'; if (!isset($blog_config['comment_form']['submit_value'])) $this-&gt;form_builder-&gt;submit_value = 'Submit Comment'; if (!isset($blog_config['comment_form']['use_form_tag'])) $this-&gt;form_builder-&gt;use_form_tag = TRUE; if (!isset($blog_config['comment_form']['display_errors'])) $this-&gt;form_builder-&gt;display_errors = TRUE; $this-&gt;form_builder-&gt;form_attrs = 'method="post" action="'.site_url($this-&gt;uri-&gt;uri_string()).'#comments_form"'; $this-&gt;form_builder-&gt;set_fields($fields); $this-&gt;form_builder-&gt;set_field_values($field_values); $this-&gt;form_builder-&gt;set_validator($this-&gt;blog_comments_model-&gt;get_validation()); $vars['comment_form'] = $this-&gt;form_builder-&gt;render(); $vars['fields'] = $fields; } $output = $this-&gt;_render('post', $vars, TRUE); // save cache only if we are not posting data if (!empty($_POST)) { $this-&gt;fuel-&gt;blog-&gt;save_cache($cache_id, $output); } } if (!empty($output)) { $this-&gt;output-&gt;set_output($output); return; } } else { show_404(); } } function _process_comment($post) { if (!is_true_val($this-&gt;fuel-&gt;blog-&gt;config('allow_comments'))) return; $notified = FALSE; // check captcha if (!$this-&gt;_is_valid_captcha()) { add_error(lang('blog_error_captcha_mismatch')); } // check that the site is submitted via the websit if (!$this-&gt;_is_site_submitted()) { add_error(lang('blog_error_comment_site_submit')); } // check consecutive posts if (!$this-&gt;_is_not_consecutive_post()) { add_error(lang('blog_error_consecutive_comments')); } $this-&gt;load-&gt;module_model(BLOG_FOLDER, 'blog_users_model'); $user = $this-&gt;blog_users_model-&gt;find_one(array('fuel_users.email' =&gt; $this-&gt;input-&gt;post('author_email', TRUE))); // create comment $this-&gt;load-&gt;module_model(BLOG_FOLDER, 'blog_comments_model'); $comment = $this-&gt;blog_comments_model-&gt;create(); $comment-&gt;post_id = $post-&gt;id; $comment-&gt;author_id = (!empty($user-&gt;id)) ? $user-&gt;id : NULL; $comment-&gt;author_name = $this-&gt;input-&gt;post('author_name', TRUE); $comment-&gt;author_email = $this-&gt;input-&gt;post('author_email', TRUE); $comment-&gt;author_website = $this-&gt;input-&gt;post('author_website', TRUE); $comment-&gt;author_ip = $_SERVER['REMOTE_ADDR']; $comment-&gt;content = trim($this-&gt;input-&gt;post('new_comment', TRUE)); $comment-&gt;date_added = NULL; // will automatically be added //http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html //http://en.wikipedia.org/wiki/Spam_in_blogs // check double posts by IP address if ($comment-&gt;is_duplicate()) { add_error(lang('blog_error_comment_already_submitted')); } // if no errors from above then proceed to submit if (!has_errors()) { // submit to akisment for validity $comment = $this-&gt;_process_akismet($comment); // process links and add no follow attribute $comment = $this-&gt;_filter_comment($comment); // set published status if (is_true_val($comment-&gt;is_spam) OR $this-&gt;fuel-&gt;blog-&gt;config('monitor_comments')) { $comment-&gt;published = 'no'; } // save comment if saveable and redirect if (!is_true_val($comment-&gt;is_spam) OR (is_true_val($comment-&gt;is_spam) AND $this-&gt;fuel-&gt;blog-&gt;config('save_spam'))) { if ($comment-&gt;save()) { $notified = $this-&gt;_notify($comment, $post); $this-&gt;load-&gt;library('session'); $vars['post'] = $post; $vars['comment'] = $comment; $this-&gt;session-&gt;set_flashdata('thanks', TRUE); $this-&gt;session-&gt;set_userdata('last_comment_ip', $_SERVER['REMOTE_ADDR']); $this-&gt;session-&gt;set_userdata('last_comment_time', time()); redirect($post-&gt;url); } else { add_errors($comment-&gt;errors()); } } else { add_error(lang('blog_comment_is_spam')); } } return $notified; } // check captcha validity function _is_valid_captcha() { $valid = TRUE; // check captcha if (is_true_val($this-&gt;fuel-&gt;blog-&gt;config('use_captchas'))) { if (!$this-&gt;input-&gt;post('captcha')) { $valid = FALSE; } else if (!is_string($this-&gt;input-&gt;post('captcha'))) { $valid = FALSE; } else { $post_captcha_md5 = $this-&gt;_get_encryption($this-&gt;input-&gt;post('captcha')); $session_captcha_md5 = $this-&gt;session-&gt;userdata('comment_captcha'); if ($post_captcha_md5 != $session_captcha_md5) { $valid = FALSE; } } } return $valid; } // check to make sure the site issued a session variable to check against function _is_site_submitted() { return ($this-&gt;session-&gt;userdata('antispam') AND $this-&gt;input-&gt;post('antispam') == $this-&gt;session-&gt;userdata('antispam')); } // disallow multiple successive submissions function _is_not_consecutive_post() { $valid = TRUE; $time_exp_secs = $this-&gt;fuel-&gt;blog-&gt;config('multiple_comment_submission_time_limit'); $last_comment_time = ($this-&gt;session-&gt;userdata('last_comment_time')) ? $this-&gt;session-&gt;userdata('last_comment_time') : 0; $last_comment_ip = ($this-&gt;session-&gt;userdata('last_comment_ip')) ? $this-&gt;session-&gt;userdata('last_comment_ip') : 0; if ($_SERVER['REMOTE_ADDR'] == $last_comment_ip AND !empty($time_exp_secs)) { if (time() - $last_comment_time &lt; $time_exp_secs) { $valid = FALSE; } } return $valid; } // process through akisment function _process_akismet($comment) { if ($this-&gt;fuel-&gt;blog-&gt;config('akismet_api_key')) { $this-&gt;load-&gt;module_library(BLOG_FOLDER, 'akismet'); $akisment_comment = array( 'author' =&gt; $comment-&gt;author_name, 'email' =&gt; $comment-&gt;author_email, 'body' =&gt; $comment-&gt;content ); $config = array( 'blog_url' =&gt; $this-&gt;fuel-&gt;blog-&gt;url(), 'api_key' =&gt; $this-&gt;fuel-&gt;blog-&gt;config('akismet_api_key'), 'comment' =&gt; $akisment_comment ); $this-&gt;akismet-&gt;init($config); if ( $this-&gt;akismet-&gt;errors_exist() ) { if ( $this-&gt;akismet-&gt;is_error('AKISMET_INVALID_KEY') ) { log_message('error', 'AKISMET :: Theres a problem with the api key'); } elseif ( $this-&gt;akismet-&gt;is_error('AKISMET_RESPONSE_FAILED') ) { log_message('error', 'AKISMET :: Looks like the servers not responding'); } elseif ( $this-&gt;akismet-&gt;is_error('AKISMET_SERVER_NOT_FOUND') ) { log_message('error', 'AKISMET :: Wheres the server gone?'); } } else { $comment-&gt;is_spam = ($this-&gt;akismet-&gt;is_spam()) ? 'yes' : 'no'; } } return $comment; } // strip out function _filter_comment($comment) { $this-&gt;load-&gt;helper('security'); $comment_attrs = array('content', 'author_name', 'author_email', 'author_website'); foreach($comment_attrs as $filter) { $text = $comment-&gt;$filter; // first remove any nofollow attributes to clean up... not perfect but good enough $text = preg_replace('/&lt;a(.+)rel=["\'](.+)["\'](.+)&gt;/Umi', '&lt;a$1rel="nofollow"$3&gt;', $text); // $text = str_replace('&lt;a ', '&lt;a rel="nofollow"', $text); $text = strip_image_tags($text); $comment-&gt;$filter = $text; } return $comment; } function _notify($comment, $post) { // send email to post author if (!empty($post-&gt;author)) { $config['wordwrap'] = TRUE; $this-&gt;load-&gt;library('email', $config); $this-&gt;email-&gt;from($this-&gt;fuel-&gt;config('from_email'), $this-&gt;fuel-&gt;config('site_name')); $this-&gt;email-&gt;to($post-&gt;author-&gt;email); $this-&gt;email-&gt;subject(lang('blog_comment_monitor_subject', $this-&gt;fuel-&gt;blog-&gt;config('title'))); $msg = lang('blog_comment_monitor_msg'); $msg .= " ".fuel_url('blog/comments/edit/'.$comment-&gt;id)." "; $msg .= (is_true_val($comment-&gt;is_spam)) ? lang('blog_email_flagged_as_spam')." " : ''; $msg .= lang('blog_email_published').": ".$comment-&gt;published." "; $msg .= lang('blog_email_author_name').": ".$comment-&gt;author_name." "; $msg .= lang('blog_email_author_email').": ".$comment-&gt;author_email." "; $msg .= lang('blog_email_author_website').": ".$comment-&gt;author_website." "; $msg .= lang('blog_email_author_ip').": ".gethostbyaddr($comment-&gt;author_ip)." (".$comment-&gt;author_ip.") "; $msg .= lang('blog_email_content').": ".$comment-&gt;content." "; $this-&gt;email-&gt;message($msg); return $this-&gt;email-&gt;send(); } else { return FALSE; } } function _render_captcha() { $this-&gt;load-&gt;library('captcha'); $blog_config = $this-&gt;config-&gt;item('blog'); $assets_folders = $this-&gt;config-&gt;item('assets_folders'); $blog_folder = MODULES_PATH.BLOG_FOLDER.'/'; $captcha_path = $blog_folder.'assets/captchas/'; $word = strtoupper(random_string('alnum', 5)); $captcha_options = array( 'word' =&gt; $word, 'img_path' =&gt; $captcha_path, // system path to the image 'img_url' =&gt; captcha_path('', BLOG_FOLDER), // web path to the image 'font_path' =&gt; $blog_folder.'fonts/', ); $captcha_options = array_merge($captcha_options, $blog_config['captcha']); if (!empty($_POST['captcha']) AND $this-&gt;session-&gt;userdata('comment_captcha') == $this-&gt;input-&gt;post('captcha')) { $captcha_options['word'] = $this-&gt;input-&gt;post('captcha'); } $captcha = $this-&gt;captcha-&gt;get_captcha_image($captcha_options); $captcha_md5 = $this-&gt;_get_encryption($captcha['word']); $this-&gt;session-&gt;set_userdata('comment_captcha', $captcha_md5); return $captcha; } function _get_encryption($word) { $captcha_md5 = md5(strtoupper($word).$this-&gt;config-&gt;item('encryption_key')); return $captcha_md5; } } </code></pre> <p>My goal is:</p> <p><strong>1.)</strong> Enable 'Blog' Module / template / functionality and understand how I did it. I find the docs lacking, I'm also new at code igniter so that could be why. I just want the most basic way to do this for now.</p> <p>And <strong>2.)</strong> I want to create a page 'from scratch' that resolves on the dashboard side as well. I have created pages in <code>/views/</code> but they resolve with that whole string <code>/fuel/application/views/page/</code> I want to create a normal page without all that in the URL. I have tried creating corresponding controllers even variables and haven't had much luck!!!!!!!</p> </div>

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

外包程序员的幸福生活

今天给你们讲述一个外包程序员的幸福生活。男主是Z哥,不是在外包公司上班的那种,是一名自由职业者,接外包项目自己干。接下来讲的都是真人真事。 先给大家介绍一下男主,Z哥,老程序员,是我十多年前的老同事,技术大牛,当过CTO,也创过业。因为我俩都爱好喝酒、踢球,再加上住的距离不算远,所以一直也断断续续的联系着,我对Z哥的状况也有大概了解。 Z哥几年前创业失败,后来他开始干起了外包,利用自己的技术能...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

深入剖析Springboot启动原理的底层源码,再也不怕面试官问了!

大家现在应该都对Springboot很熟悉,但是你对他的启动原理了解吗?

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

2020春招面试了10多家大厂,我把问烂了的数据库事务知识点总结了一下

2020年截止目前,我面试了阿里巴巴、腾讯、美团、拼多多、京东、快手等互联网大厂。我发现数据库事务在面试中出现的次数非常多。

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

在拼多多上班,是一种什么样的体验?我心态崩了呀!

之前有很多读者咨询我:武哥,在拼多多上班是一种什么样的体验?由于一直很忙,没抽出时间来和大家分享。上周末特地花点时间来写了一篇文章,跟大家分享一下拼多多的日常。 1. 倒时差的作息 可能很多小伙伴都听说了,拼多多加班很严重。这怎么说呢?作息上确实和其他公司有点区别,大家知道 996,那么自然也就能理解拼多多的“11 11 6”了。 所以当很多小伙伴早上出门时,他们是这样的: 我们是这样的: 当...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

太狠了,疫情期间面试,一个问题砍了我5000!

疫情期间找工作确实有点难度,想拿到满意的薪资,确实要点实力啊!面试官:Spring中的@Value用过么,介绍一下我:@Value可以标注在字段上面,可以将外部配置文件中的数据,比如可以...

自学编程的 6 个致命误区

嗨,小伙伴们大家好,我是沉默王二。本篇文章来和大家聊聊自学编程中的一些误区——这是我在 B 站上看了羊哥的一期视频后有感而发的文章。因为确实有很多读者也曾私信问过我这些方面的问题,很有代表性,所以我就结合自己的亲身体会来谈一谈,希望对小伙伴们有所启发。 01、追求时髦 所谓基础不牢,地动山摇啊。可很多小伙伴压根就没注意过这个问题,市面上出什么新鲜的技术就想去尝试,结果把自己学的乱七八糟,心灰意冷...

祝贺玄姐,创业两个月,估值近亿,融资几千万,奈学教育,太牛逼了!!!...

玄姐,男,前58同城技术委员会主席,前转转首席架构师,我的10年好友。一月下旬,玄姐找到我,说,哥们我准备创业了。画外音:详见《最好的朋友创业了,我必须为他站台》。番外篇《为何大家都叫...

立即提问
相关内容推荐