beego 无法获取到页面传值


copyrequestbody = true





    beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
      AllowOrigins:     []string{"*"},
        AllowMethods:     []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
        AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
        ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
        AllowCredentials: true,
    beego.Router("/user/?:id", &userController.UserController{})


type user struct {
    nickname string
    username string
    password string

func (this *UserController) Post() {
      u := user{}   //空的
      c := this.Input().Get("phone")   //空的
        if err := json.Unmarshal(this.Ctx.Input.RequestBody, &u); err == nil {





type user struct {
Nickname string
Username string
Password string

Csdn user default icon

<div class="post-text" itemprop="text"> <p>I try create a simple REST service on Go&amp;Beego.</p> <p>I can not understand the logic of Beego.</p> <p>All examples have information on how to retrieve just one item while I need to get all items.</p> <p>In case of API.</p> <p><strong>Controller:</strong></p> <pre><code>package controllers import ( "api/models" "" ) type UserController struct { beego.Controller } func (u *UserController) GetAll() { users := models.GetAllUsers() u.Data["json"] = users u.ServeJSON() } </code></pre> <p><strong>Model:</strong></p> <pre><code>package models import ( "" ) var ( UserList map[int]*User ) func init() { orm.RegisterModel(new(User)) UserList = make(map[int]*User) u := User{1, "Chandler", "Bing", ""} UserList[1] = &amp;u } type User struct { Id int `form:"id"` First_name string `form:"first_name"` Last_name string `form:"last_name"` Email string `form:"email"` } func GetAllUsers() map[int]*User { return UserList } </code></pre> <p>That works! But, how can I get data from database?</p> <p>Database connections are ok (MySQL)</p> </div>


<div class="post-text" itemprop="text"> <p>I redefined the <code>page_not_found</code> on router.go, </p> <pre><code>func page_not_found(rw http.ResponseWriter, r *http.Request) { t, _ := template.ParseFiles(beego.ViewsPath + "/404.html") data := make(map[string]interface{}) t.Execute(rw, data) } </code></pre> <p>and in <code>init</code> function used </p> <p><code>beego.Errorhandler("404", page_not_found)</code></p> <p>when i called 404 by used <code>this.Abort("404")</code> in controller, the 404 page was not show html, it showed the page html text, liked this</p> <p><img src="" alt="html text/plain"></p> </div>

如何从beego AppConfig获取值并将其呈现在HTML模板中?

<div class="post-text" itemprop="text"> <p>I want to get value of a key defined in beego's <strong>app.conf</strong> and render in html pages. As per documentation on <a href="" rel="nofollow"></a> I can get value of AppConfig by using config function in templates. However there is no example in documentation.</p> <blockquote> <p>Get the value of AppConfig. {{config configType configKey defaultValue}}. configType must be String, Bool, Int, Int64, Float, or DIY</p> </blockquote> <p>After trying many ways I came to this:</p> <pre><code>&lt;div&gt;{{config config.String config.appname "TestDefaultValue"}}&lt;/div&gt; </code></pre> <p>But I am always getting error:</p> <pre><code>&lt;config&gt;: wrong number of args for config: want 3 got 0 </code></pre> <p>What is the correct way to use config template function?</p> </div>


<div class="post-text" itemprop="text"> <p>i am handling session variable by setting time out using </p> <pre><code>globalSessions, _ = session.NewManager("memory", `{"cookieName":"gosessionid", "enableSetCookie,omitempty": true, "gclifetime":5, "maxLifetime": 5, "secure": false, "sessionIDHashFunc": "sha1", "sessionIDHashKey": "", "cookieLifeTime": 3600, "providerConfig": ""}`) go globalSessions.GC() sess, _ := globalSessions.SessionStart(c.Ctx.ResponseWriter, c.Ctx.Request) defer sess.SessionRelease(c.Ctx.ResponseWriter) errU := sess.Set("user1", c.Input().Get("userName")) if errU != nil { fmt.Println("error in settng value") } </code></pre> <p>now how to redirect back to specific page on time out of the current page. I have this application in beego</p> </div>


<div class="post-text" itemprop="text"> <p>The URL I am receiving looks like this:</p> <pre><code>/controller/action?columns[0][data]=foo&amp;columns[1][data]=bar&amp;columns[2][data]=bar&amp;columns[3][data]=bar&amp;columns[4][data]=bar </code></pre> <p>So I have an array of objects. How can I parse this into a slice of structs?</p> <p>What I have in my controller action is this:</p> <pre><code>func (this *MyController) Foo() { type column struct{ Data string } columns := []column{} if err := this.Ctx.Input.Bind(&amp;columns, "columns"); err != nil { log.Fatal(err) } else { log.Println("OK, got:", columns) } } </code></pre> <p>And the output of this is:</p> <pre><code>OK, got: [{} {} {} {} {} {}] </code></pre> <p>Bind successfully detects there are five columns but fails to map the <code>data</code> field. I experimented with this and believe there are two problems:</p> <p>The bind seems to only support the exact syntax shown in the <a href="" rel="nofollow">documentation</a>:</p> <pre><code>?id=123&amp;isok=true&amp;ft=1.2&amp;ol[0]=1&amp;ol[1]=2&amp;ul[]=str&amp;ul[]=array&amp;user.Name=astaxie </code></pre> <p><code>user.Name=astaxie</code> works while <code>user[Name]=astaxie</code> does not.</p> <p>The 2nd problem is, the lower case of <code>data</code>. My experiments have shown <code>user.Name</code> works while <code></code> does not.</p> <p>So the data bind method expects me to get the parameters in the form <code>columns[0].Data=foo</code> while I have <code>columns[0][data]=foo</code></p> <p>The first one indeed works. But I have no control over the URL, I have to accept it as it is, with lower case <code>data</code> in square brackets. The request is generated by <a href="" rel="nofollow">DataTables</a>.</p> </div>


<div class="post-text" itemprop="text"> <p>I am wondering how the correct approach is to load related fields in beego. The <a href="" rel="nofollow noreferrer">doc</a> explains it like this:</p> <pre><code>type User struct { Id int Name string Posts []*Post `orm:"reverse(many)"` } user := User{Id: 1} err := dORM.Read(&amp;user) num, err := dORM.LoadRelated(&amp;user, "Posts") </code></pre> <p>This makes sense as long as I only query one record. What is the correct way to fetch related fields when I query all users?</p> <p>A possible solution would be like this:</p> <pre><code>var users []*User o.QueryTable(new(User)).All(&amp;users) for _, user := range users { o.LoadRelated(controlCategory, "Posts") } </code></pre> <p>However, this means I have to loop everytime over the complete list and make for every record a DB query to load all records. </p> <p>Any suggestions? Thanks!</p> </div>

如何在Golang Beego中解析表单数组

<div class="post-text" itemprop="text"> <p>How to parse html form array with Beego.</p> <p> <code>&lt;input name="names[]" type="text" /&gt; &lt;input name="names[]" type="text" /&gt; &lt;input name="names[]" type="text" /&gt;</code></p> <p>Go Beego</p> <pre class="lang-html prettyprint-override"><code>type Rsvp struct { Id int `form:"-"` Names []string `form:"names[]"` } rsvp := Rsvp{} if err := this.ParseForm(&amp;rsvp); err != nil { //handle error } input := this.Input() fmt.Printf("%+v ", input) // map[names[]:[name1 name2 name3]] fmt.Printf("%+v ", rsvp) // {Names:[]} </code></pre> <p>Why Beego ParseForm method return an empty names?</p> <p>How to get values into rsvp.Names?</p> </div>


<div class="post-text" itemprop="text"> <p>My template file:</p> <pre><code>{{range $index, $option := .alternatives}} &lt;div id="splashAlternative{{$index}}" class="col-sm-2"&gt; &lt;select id="flashSrc_{{$index}}"&gt; {{template "alternative_src.html" $option}} &lt;/select&gt; &lt;/div&gt; {{end}} </code></pre> <p>I want pass <code>$option</code> to template, and <code>alternative_src.html</code> code :</p> <pre><code>{{if compare .option ""}} &lt;option value="" selected="selected"&gt; &lt;/option&gt; {{else}} &lt;option value=""&gt;&lt;/option&gt; {{end}} {{if compare .option "xxx"}} &lt;option value="xxx" selected="selected"&gt;xxx&lt;/option&gt; {{else}} &lt;option value="xxx"&gt;xxx&lt;/option&gt; {{end}} </code></pre> <p>but I get problem below:</p> <pre><code>executing "alternative_src.html" at &lt;.option&gt;: can't evaluate field option in type string </code></pre> </div>


<div class="post-text" itemprop="text"> <p>Upon getting session information of type <code>map[string]interface{}</code> with <code>this.GetSession("session_key")</code>, I did have to explicitly set the context and type assert the session like this in order to explicitly pass the data to the template.</p> <pre><code>// Get the session profile := this.GetSession("profile") // Have to add data to the template's context this.Data["nickname"] = profile.(map[string]interface{})["nickname"].(string) this.Data["picture"] = profile.(map[string]interface{})["picture"].(string) // Render template this.TplNames = "user.html" </code></pre> <p>The session data (type <code>map[string]interface{}</code>) looks like this:</p> <pre><code>{"nickname": "joe", "picture": "urltotheimg"} </code></pre> <p>However, according to the Beego's session <a href="" rel="nofollow">doc</a>, it looks like the session is passed implicitly without any need of type assertions or context passing (the template has immediate access to session values i.e. <code>{{.nickname}}</code> and <code>{{.picture}}</code>)</p> <p>This is the controller setting the session before redirecting to <code>/user</code></p> <pre><code>// Inherit beego's base controller type MyController struct { beego.Controller } func (this *MyController) Get() { // code for getting token here // Getting the User information client := conf.Client(oauth2.NoContext, token) resp, err := client.Get("https://" + domain + "/userinfo") if err != nil { this.Redirect("/error", 500) return } // Reading the body for user's information raw, err := ioutil.ReadAll(resp.Body) defer resp.Body.Close() if err != nil { this.Redirect("/error", 500) return } // Unmarshalling the JSON of the Profile var profile map[string]interface{} if err := json.Unmarshal(raw, &amp;profile); err != nil { this.Redirect("/error", 500) return } // Saving the information to the session. this.SetSession("profile", profile) // redirect to /user this.Redirect("/user", 301) } </code></pre> <p>This is the controller of "/user"</p> <pre><code>type UserController struct { beego.Controller } func (this *UserController) Get() { // get the saved session profile := this.GetSession("profile") // without setting the template data here, the session data won't be // available in user.html this.Data["nickname"] = profile.(map[string]interface{})["nickname"].(string) this.Data["picture"] = profile.(map[string]interface{})["picture"].(string) this.TplNames = "user.html" } </code></pre> <p>Only this then I can map the template to the data like this:</p> <pre><code>&lt;img src="{{ .picture }}"&gt; &lt;p&gt;Hello, {{ .nickname }}&lt;/p&gt; </code></pre> <p>I'm quite sure it's necessary to set the template data. I'm just not sure why the above doc didn't do that. </p> <p>Any help would be appreciated.</p> </div>


<div class="post-text" itemprop="text"> <p>I am using Beego framework for my purpose and i have two html view files one is login and other is landing login.html </p> <p></p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form action="/commonDashboard" name="loginForm" method="post" autocomplete="off" id="loginForm" &gt; &lt;input type="text" placeholder="Enter your user name" id="userName" name="userName" taborder="1"&gt; &lt;input type="password" class="qwerty" placeholder="Enter your password" id="userPassword" name="userPassword" taborder="2"&gt; &lt;input type="button" value="Login" onclick="validatelogin();" taborder="3"&gt; &lt;input type="button" value="Clear" onclick="resetForm();" taborder="3"&gt; &lt;span class="forgot"&gt;&lt;a href="#"&gt;forgot password ?&lt;/a&gt;&lt;/span&gt; &lt;!-- Virtual Keyboard --&gt; &lt;span class="virtual"&gt;&lt;a href="#" id="passwd" class="tooltip-tipsy" title="Click to open the virtual keyboard"&gt;Virtual Keyboard &lt;/span&gt; &lt;/form&gt; </code></pre> </div> </div> <p>and landing page is</p> <p></p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;header class="top"&gt; &lt;div class="container-fluid"&gt; &lt;aside class="logo"&gt;&lt;img src="img.jpg" class="img-responsive"&gt;&lt;/aside&gt; &lt;aside class="top-right"&gt; &lt;div class="profile"&gt; &lt;ul&gt; &lt;li class="name"&gt;&lt;img src="../static/img/profile-img.jpg" alt="Shri Ram"&gt; Hi &lt;a href="#"&gt;Shri&lt;/a&gt;&lt;/li&gt; &lt;li class="logout"&gt;&lt;a href="/login"&gt;Logout&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Contacts&lt;/a&gt;&lt;/li&gt; &lt;li class="last"&gt;&lt;a href="#"&gt;Help&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="login-time"&gt; &lt;ul&gt; &lt;li&gt;&lt;span&gt;Current Login:&lt;/span&gt; Mon 22 Sep 2014 03:28 PM&lt;/li&gt; &lt;li class="last"&gt;&lt;span&gt;Last Login:&lt;/span&gt; Sun 21 Sep 2014 02:28 PM&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/aside&gt; &lt;/div&gt; &lt;/header&gt;</code></pre> </div> </div> <p>and controller is as follows</p> <p></p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>package controllers import ( "fmt" "" ) type MainController struct { beego.Controller } func (c *MainController) Get() { c.TplNames = "login.html" fmt.Println("login Get Method") } type LoginController struct { beego.Controller } func (c *LoginController) Post() { c.TplNames = "commonDashboard.html" fmt.Println("this is dashboard") password := c.Input().Get("userPassword") username := c.GetSession("userName").(string) c.SetSession("userName", username) c.Data["user"] = username fmt.Println("password:" + " " + password) } type HeaderController struct { beego.Controller } func (c *HeaderController) Get() { fmt.Println("this is Header") username := c.Input().Get("userName") fmt.Println(username) c.TplNames = "commonHeader.html" } type FooterController struct { beego.Controller } func (c *FooterController) Get() { fmt.Println("this is footer") c.TplNames = "commonFooter.html" } type MenuController struct { beego.Controller } func (c *MenuController) Get() { fmt.Println("this is menu") c.TplNames = "commonMenu.html" }</code></pre> </div> </div> <p>i want to display the currently logged in username in header of html file </p> </div>

在Angular js中从Go模板获取数据

<div class="post-text" itemprop="text"> <p>I am new in Angular Js. I managed to receive the data from golang in angular js. But it's giving an output <strong>[object Object]</strong> when used in an alert box. I tried changing the delimiters of golang from <strong>{{ }}</strong> to <strong>&lt;&lt;&lt; &gt;&gt;&gt;</strong>, but the problem was not solved.</p> <p>Go code: (I am using beego)</p> <pre><code>func (receiver *AdsController) LoadNewCampaignPage() { view := viewmodels.NewCampaignPageViewModel{} view.Title = "New Campaign" receiver.Data["vm"] = view receiver.Layout = "layouts/ads_header.html" receiver.TplName = "templates/ads_add_campaign.html" } </code></pre> <p>Struct <strong>viewmodels.NewCampaignPageViewModel{}</strong></p> <pre><code>type NewCampaignPageViewModel struct { Title string ProfileName string ProfilePicture string UnUsedBoxes []models.Box ErrorMessage string } </code></pre> <p>Html</p> <pre><code>&lt;div ng-controller="AddBoxForAdsCtrl"&gt; &lt;button class="_button _button-3" ng-click="showHiddenForm()"&gt;Add Box&lt;/button&gt; &lt;/div&gt; </code></pre> <p>JS</p> <pre><code>var addBoxForAds = angular.module('addBoxForAds', []); addBoxForAds.controller('AddBoxForAdsCtrl', function ($scope, $http){ var title = $http.get('&lt;&lt;&lt;.vm.Title&gt;&gt;&gt;'); //Data from GO; delimiters are changed. alert(title); }); </code></pre> <p>What are the mistakes I made here? How can I get the data from golang in angularjs? How to use use the struct element <strong>UnUsedBoxes</strong>(which is an array of struct)?</p> </div>


<div class="post-text" itemprop="text"> <p>I have two web apps running in the same virtual machine. One is Beego listening to port 443, and another is Centrifugo messaging server at port 8000. </p> <p>If a user is not allowed to connect port 8000 due to his ISP, is it possible that I forward <a href="https://my.domain/chat_api" rel="nofollow noreferrer">https://my.domain/chat_api</a> (intercepted by Beego at port 443) to <a href="https://my.domain:8000/chat_api" rel="nofollow noreferrer">https://my.domain:8000/chat_api</a> (served by Centrifugo at port 8000), so that my chat client connects port 443 just like connecting port 8000? If yes, how do I implement under Beego's structure?</p> </div>


<div class="post-text" itemprop="text"> <p>I have to append parameter in JSON response after request processing is completed and before sending. I can do in <code>after exec</code> filter. Here I defined filter like this,</p> <pre><code>beego.InsertFilter("*", beego.AfterExec, AddRequestAfterExec, false) </code></pre> <p>Now in this <code>AddRequestAfterExec</code> method, I am unable to read JSON response. I need to read JSON response and add parameter to it. I searched many things, but did not find any thing useful. So far I have left it empty. </p> <pre><code>func AddRequestAfterExec(c *context.Context) {} </code></pre> <p>Can anybody help, how to read Response in this function and modify it?</p> <p>Also I am sending response from API controller like this </p> <pre><code>authController.ServeJSON() </code></pre> </div>

如何在beg orm中获取最终的sql字符串

<div class="post-text" itemprop="text"> <p>I want to get the finally sql string in the beego's orm.</p> <p>but I can not find the interface that can get sql string.</p> <p>I want to make a Logging for database Operating.</p> <p>I want to find other ways that do not need to turn on the orm.Debug. </p> <pre><code>orm.Debug = false </code></pre> </div>


<div class="post-text" itemprop="text"> <pre><code>bee :1.4.1 beego :1.6.1 Go :go version go1.6.3 windows/amd64 set GOARCH=amd64 set GOBIN= set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\GoSites set GORACE= set GOROOT=C:\Go set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GO15VENDOREXPERIMENT=1 set CC=gcc set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 set CXX=g++ set CGO_ENABLED=1 </code></pre> <p>I am busy using the Beego framework for golang, and I am trying to modify the directory structure. </p> <p>I moved the controllers, models, static, and views directories into a new directory 'app' in order to clean up the directory structure, this caused a number of routing and file path errors eg:</p> <blockquote> <p>can't find templatefile in the path:index.tpl</p> </blockquote> <p>How do I modify the project to account for the changing of the directory structure without causing errors?</p> <p>Thanks</p> </div>

beego api发布插入数据

<div class="post-text" itemprop="text"> <p>First of all. I use postman to POST data. How to take data from the postman key. It works by using this way (in my code I set it by myself).</p> <p>I want to get firstname, lastname, email in form-data. I want to use as below.</p> <pre><code>func InsertOneUser(user User) *User { o := orm.NewOrm() qs := o.QueryTable(new(User)) i, _ := qs.PrepareInsert() var u User user.FirstName = "firstname" &lt;----- this user.LastName = "lastname" &lt;----- this user.Email = "" &lt;----- this user.Password, _ = hashPassword(user.Password) user.RegDate = time.Now() id, err := i.Insert(&amp;user) return &amp;u } </code></pre> <p><a href="" rel="nofollow noreferrer"><img src="" alt="enter image description here"></a></p> </div>

Beego Controller中的JSON响应

<div class="post-text" itemprop="text"> <p>I'm a newbie to beego trying to get a JSON response on a route.</p> <p>I have a controller defined as such.</p> <pre><code>package controllers import ( "" ) type ErrorController struct { beego.Controller } type ErrorJson struct { s string d string } func (this *ErrorController) Get() { var responseJson ErrorJson responseJson = ErrorJson{ s: "asdf", d: "qwer", } this.Data["json"] = responseJson this.ServeJson() } </code></pre> <p>My router is defined as </p> <pre><code>beego.Router("/api", &amp;controllers.ErrorController{}) </code></pre> <p>When I visit the route, I get an Empty JSON object without any properties.</p> <pre><code>{} </code></pre> <p>If I replace the json struct with a string, I get a response. So beego is aware of the controller and the method. </p> <pre><code>this.Data["json"] = "Hello World" </code></pre> <p>What am I doing wrong?</p> </div>


<div class="post-text" itemprop="text"> <p>I'm trying to make simple POST request using VueJS to an application which is written in Beego framework (GoLang) but the application doesn't see any input request. Everything is ok when I use standard form request (no ajax). This is my VueJS code:</p> <pre><code>storePost: function(event) {"/api/posts/store", {body: "test"}).then(function(response) { if ( == 200) { this.posts.push(; }else { console.log("error"); } }, function(response){ console.log("error"); }); } </code></pre> <p>and this is my Beego code:</p> <pre><code>// router.go beego.Router("/api/posts/store", &amp;controllers_API.PostsController{}, "post:Store") // PostsController.go func (this *PostsController) Store() { fmt.Println(this.GetString("body")) // some irrelevant code which handles the response... } </code></pre> <p><code>fmt.Println</code> always prints nothing. When I use standard forms <code>fmt.Println</code> prints the value of the <code>body</code> with no problems.</p> </div>


<div class="post-text" itemprop="text"> <p>For example</p> <pre><code>{{ range .cars }} {{.color}} , ${{.price}} {{ end }} </code></pre> <p>The array size of 'cars' is 10. How do I get the index value?</p> <p>When the index is 5, I want do some process.</p> <p>I am using Beego web framework.</p> </div>


大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...


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



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

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

和黑客斗争的 6 天!

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


“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...


loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...






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






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




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

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

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


不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...






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


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



你打算用Java 8一辈子都不打算升级到Java 14,真香



编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

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





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



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


一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...