block设置为nil,任然会执行回调! 5C


在界面1里:myDev.connectBlock = nil;
//连接状态 = ^(NSInteger state, NSString *connection) {




if (self.callBackBlock) {
    一般在执行Block 的回调时都会判断当前Block 是否存在,如果你同样也是添加了这个方法在Xcode 8 里还会照样执行的话,建议参照一楼大哥的回答
    是不是在你设置成 nil 之后又在别的地方修改了,所以当前Block 不为nil 了。没有安装Xcode 8 不能做具体的调试。
Csdn user default icon

请教各位大神一个愚蠢的问题,友盟分享没有回调是什么原因, appdelegate里的- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options有调用, [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:nil completion:^(id data, NSError *error) { }]中的回调block却没有调用? 两个openurl方法都已添加,URL Schemes设置也都正确,就是没有回调,急急急,求各位大神帮小弟解惑答疑。

为什么是“ err!= nil”? [重复]

<div class="post-text" itemprop="text"> <div class="question-status question-originals-of-duplicate"> <p>This question already has an answer here:</p> <ul> <li> <a href="/questions/29138591/hiding-nil-values-understanding-why-golang-fails-here" dir="ltr">Hiding nil values, understanding why golang fails here</a> <span class="question-originals-answer-count"> 2 answers </span> </li> </ul> </div> <p>I have a situation where the value of a variable "err error" value can only be "nil" but asserts "( err == nil ) == false" once it has been reassigned.</p> <p>Example code below:</p> <pre><code>package main import ( "fmt" "log" ) type TestError struct { Message string } func (e *TestError) Error() string { return e.Message } func NewTestError(err error) *TestError { if err == nil { return nil } log.Printf("NewTestError( ... ): creating new NewTestError err = %s", err) return &amp;TestError{Message: err.Error()} } func main() { var err error _, err = fmt.Printf("excuse. ") err = NewTestError(err) log.Printf("main( ... ): err == nil. %v", (err == nil)) log.Printf("main( ... ): err = %#v", err) } </code></pre> <p>I get the following output from the above code:</p> <pre><code>excuse. 2015/07/30 08:28:28 main( ... ): err == nil. false 2015/07/30 08:28:28 main( ... ): err = (*main.TestError)(nil) </code></pre> <p>How can those last two lines be output?</p> </div>


<div class="post-text" itemprop="text"> <p>I have an array that holds many objects. When I set the array to nil, will gc collect all the objects holded by the array?</p> <pre><code>package main import ( "time" "runtime" ) type B struct { bb []int } func NewB() *B { return new(B) } func main() { var bs = make([]*B, 10) for i:=0; i&lt;10; i++ { bs[i] = NewB() bs[i].bb = make([]int, 1000000) } time.Sleep(time.Second) println("begin gc") //for i:=0; i&lt;10; i++ { // bs[i] = nil //} bs = nil runtime.GC() time.Sleep(time.Second*2) runtime.GC() time.Sleep(time.Second*2) } </code></pre> <p>First, I set <code>bs = nil</code>, all the two gc infos show <code>76-&gt;76-&gt;76 MB</code>, this means gc does not free the memory. Then, I add the for loop code in the slash statement, the first gc info shows <code>76-&gt;76-&gt;0 MB</code>, the second gc info shows <code>0-&gt;0-&gt;0 MB</code>. So I'm confused that, when I set <code>bs = nil</code>, there is no pointer referenced to all the objects, why gc does not free the objects? should all the objects explicitly set to nil?</p> </div>

golang:将类型struct设置为nil [关闭]

<div class="post-text" itemprop="text"> <pre><code>type Ptr struct { ID *big.Int IpAddress string Port string } var NewVar Ptr </code></pre> <p>After initializing the NewVar with values I then want to set NewVar to nil. How can I do this?</p> </div>

使用Golang中的reflect将通过interface {}传递的结构体的指针设置为nil?

<div class="post-text" itemprop="text"> <p>I am trying to use reflect to set a pointer to a struct to <code>nil</code> passed in through an <code>interface{}</code> in Go.</p> <p>I have this example program but it always prints false as a is not set to <code>nil</code>. What am I doing wrong?</p> <pre><code>package main import "reflect" type MyStruct struct {} func main() { a := &amp;MyStruct{} wipePassed(a) println(a == nil) } func wipePassed(r interface{}){ v := reflect.ValueOf(&amp;r) p := v.Elem() p.Set(reflect.Zero(p.Type())) } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>It's a bit hard to write a title that match with my current problem.. I have a main() function which uses a function in another package (database_sql). This function initializes a global variable sql.DB*. After the initialization, the variable isn't nil, but for the others functions, this variable is still nil.. Let see the code below !</p> <p>main.go</p> <pre><code>package main import ( "net/http" db "./database_sql" router "./router" ) func main() { db.Init_SQL(); router.Init_routes() http.ListenAndServe(":8080", router.GetRouter()) } </code></pre> <p>db.go</p> <pre><code>package database_sql import ( "fmt" "database/sql" _ "" ) var DB *sql.DB // global variable to share it between main and the HTTP handler //var dbi *databaseinfos func Init_SQL() { dbi := databaseinfos{ user: "something", password: "something", name: "something", address: "something", port: "2323", url: ""} dbi.url = (dbi.user + ":" + dbi.password + "@tcp(" + dbi.address + ":" + dbi.port + ")/" + db_init_var, err := sql.Open("mysql", dbi.url) if err != nil { fmt.Println("Error on initializing database connection: %s", err.Error()) } err = db_init_var.Ping() if err != nil { fmt.Println("Error on opening database connection: %s", err.Error()) } // Here, as you can test, my variable is initialized if err == nil { DB = db_init_var if DB == nil { fmt.Println("NIL DB !!") } if db_init_var == nil { fmt.Println("NIL db_init_var !!") } fmt.Println(dbi.url) } } </code></pre> <p>Now, everything is ok ! I will now test <a href="http://xxxxxxx/login" rel="nofollow">http://xxxxxxx/login</a> with an username/password. Everything's working fine and now, it's the time to make a request in the database with my DB variable declared above.</p> <p>request_user.go</p> <pre><code>package database_sql import ( "encoding/json" "fmt" "net/http" m "models" ) func CanLogin(user m.User) (bool, m.User, m.StatusBack) { // Prepare statement for reading data stmtOut, err := DB.Prepare("SELECT username, password, token FROM users WHERE username = ? AND password = ?") if err != nil { return false, user, m.StatusBack{ToString: err.Error(), IdStatus: http.StatusInternalServerError} } defer stmtOut.Close() // Query the user err = stmtOut.QueryRow(user.Username, user.Password).Scan(&amp;user.Username, &amp;user.Password, &amp;user.UUID) // WHERE user is registered if err != nil { return false, user, m.StatusBack{ToString: "User not found.", IdStatus: http.StatusNotFound} } else { j, err := json.Marshal(user) if err == nil { return true, user, m.StatusBack{ToString: string(j), IdStatus: http.StatusOK} } else { return false, user, m.StatusBack{ToString: err.Error(), IdStatus: http.StatusInternalServerError} } } } </code></pre> <p>However, when I'm making my sql request, the following line says that DB is nil. <strong>stmtOut, err := DB.Prepare("SELECT username, password, token FROM users WHERE username = ? AND password = ?")</strong></p> <p>I made lot of test such as trying to initialize it with '=' and no ':='. I tried 'if DB == nil' statement and DB is always nil.. Why? I initialize my database var before initialize my router, so technically, when my router give a redirection to a function, this function wouldn't use a database var (DB) nil, isn't?</p> <p>Thank for your answers !</p> <p><strong>EDIT 2</strong> I red your answers and then, I edited my code like you asked with some adds. After init_SQL, DB isn't nil !</p> <p>main.go</p> <pre><code>package main import ( "fmt" "net/http" db "./database_sql" router "./router" ) func main() { if db.Init_SQL() == true { if db.DB == nil { fmt.Println("db.DB is nil !") } if router.Init_routes() == true { http.ListenAndServe(":8080", router.GetRouter()) } } } </code></pre> <p>So, now my 2 init functions return true on success and false on failure. I thought it could be an asynchronous problem, I made it like that to wait the end of each functions to continue my 'step by step'</p> </div>

__weakSelf 和__strongSelf 为nil

![图片说明]( 如图第一次进来weakSelf有值,但是在weakSelf声明好了在这个方法走了一圈在回到这个block中就变成nil 了


<div class="post-text" itemprop="text"> <p>I'm trying to get AES encryption and decryption working in my go API, I create a new block using aes.NewCipher(mykey) and the block seems to be valid, but then when I call cipher.NewCBCDecrypter(block, iv) the function causes a "invalid memory address or nil pointer dereference" error at line 26 in cbc.go when it tries to call b.BlockSize().</p> <p>So I tried calling block.BlockSize() from my own code and I also get an exception, but when I check the block var it's not nil.</p> <pre><code>func Decrypt(data []byte) (result []byte, err error) { logger := logrus.New() logger.Infof("Starting decryption for string: %s ", string(data[:])) var block cipher.Block if block, err := aes.NewCipher([]byte(app.Config.AESKey)); (err != nil) || (block == nil) { logger.Infof("Failed to create block ") return nil, err } if len(data) &lt; aes.BlockSize { logger.Infof("Input too short ") return nil, nil } cbc := cipher.NewCBCDecrypter(block, []byte(app.Config.AESIV)) cbc.CryptBlocks(data, data) return data, nil } </code></pre> <p>I would expect the function to work properly since aes.NewCipher doesn't return an error.</p> </div>


<div class="post-text" itemprop="text"> <p>There is a function that sets a pointer to a <code>nil</code> value:</p> <pre><code>func nilSetter(x *int) { x = nil } </code></pre> <p>I have such snippet of code:</p> <pre><code>i := 42 fmt.Println(&amp;i) nilSetter(&amp;i) fmt.Println(&amp;i) </code></pre> <p>Which prints:</p> <pre><code>0xc42008a000 0xc42008a000 </code></pre> <p>While I expect:</p> <pre><code>0xc42008a000 nil </code></pre> <p>I know that it happens because function <code>nilSetter</code> just copy address and sets to nil that copy. </p> <p>But how can I do it correctly? </p> </div>


<div class="post-text" itemprop="text"> <p>As is shown by the following code: <code>n := localplugin.NewPluginNet()</code>, the type of <code>n</code> is <code>localnet.Net</code>, which is a interface implemented by the struct pointer <code>*localnet.DomainSocket</code>. Function <code>func NewPluginNet() localnet.Net</code> returns a nil pointer to <code>n</code>.</p> <pre><code>var n localnet.Net n = localplugin.NewPluginNet() fmt.Println("----&gt; ", n) if n == nil { fmt.Println("n is nil") }else{ fmt.Println("n is not nil : ", n) } fmt.Println(reflect.TypeOf(n), reflect.TypeOf(nil), n) </code></pre> <p>The following is the output of the code above.</p> <pre><code>----&gt; &lt;nil&gt; n is not nil : &lt;nil&gt; *localnet.DomainSocket &lt;nil&gt; &lt;nil&gt; </code></pre> <p>Why does n is not nil ?</p> <p>===================================</p> <pre><code>var n1 *localnet.DomainSocket n1 = nil fmt.Println("&gt;&gt; ", n1) if n1 == nil { fmt.Println("&gt;&gt;n1 is nil") }else{ fmt.Println("&gt;&gt;n1 is not nil : ", n) } fmt.Println(reflect.TypeOf(n1), reflect.TypeOf(nil), n1) </code></pre> <p>However, it's correct for this case:</p> <pre><code>&gt;&gt; &lt;nil&gt; &gt;&gt;n1 is nil *localnet.DomainSocket &lt;nil&gt; &lt;nil&gt; </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I'm trying to set an internal value of an interface to <code>nil</code> something like the following :</p> <pre><code>typ := &amp;TYP{InternalState: "filled"} setNil(typ) fmt.Printf("Expecting that %v to be nil", typ) </code></pre> <p>And I need to know how to implement the <code>setNil(typ interface{})</code> method.</p> <p>For more details <a href="" rel="nofollow noreferrer">see this code in</a>.</p> </div>


在程序编译时报出错误:`Incompatible pointer to integer conversion` 出错代码: [UIView animateWithDuration:0.3f delay:0.0f options:nil animations:^{ [menuView setFrame:CGRectMake(0.0f, 64.0f, 320.0f, 54.0f)]; menuView.alpha = 1.0; } completion:nil]; 屏幕截图: ![CSDN移动问答][1] 如能帮忙解决感激不尽。 [1]:


<div class="post-text" itemprop="text"> <p>I'm still relatively new to Go and I've decided to try some OpenGL since there exists a Go library which provides bindings for this. As part of setting up OpenGL I need to use the Go <a href="" rel="nofollow noreferrer">glfw library</a>. I need to use the glfw library function <a href="" rel="nofollow noreferrer">SetFramebufferSizeCallback</a> which requires an argument of type <a href="" rel="nofollow noreferrer">FrameBuffersizeCallback</a>; so I essentially need to pass a function that matches that type's signature which I believe I have done. However, I keep getting the following error:</p> <blockquote> <p>./main.go:43:35: cannot use fbCallback (type func(*glfw.Window, int32, int32)) as type glfw.FramebufferSizeCallback in argument to window.SetFramebufferSizeCallback</p> </blockquote> <p>And I'm really not sure why this is happening. I've checked that my glfw version matches the documentation; I've checked the code for the implementation on github and my machine and it is all consistent. So I have no clue what I'm doing wrong. Here is my code, it shouldn't do anything interesting if built, but demonstrates the error:</p> <pre><code>package main import ( "" "" "log" "runtime" ) func fbCallback(window *glfw.Window, width int32, height int32) { gl.Viewport(0, 0, width, height) } func init() { runtime.LockOSThread() } func main() { err := glfw.Init() if err != nil { panic(err) } defer glfw.Terminate() glfw.WindowHint(glfw.ContextVersionMajor, 3) glfw.WindowHint(glfw.ContextVersionMinor, 3) glfw.WindowHint(glfw.OpenGLProfile, glfw.OpenGLCoreProfile) window, err := glfw.CreateWindow(640, 480, "Testing", nil, nil) if err != nil { panic(err) } window.MakeContextCurrent() if err := gl.Init(); err != nil { log.Fatalln(err) } gl.Viewport(0, 0, 800, 600) window.SetFramebufferSizeCallback(fbCallback) //Does not work } </code></pre> <p>My understanding of how this should really work is demonstrated in the following short program which works. I'd be happy for someone to point out why this short example works and the above does not. I may have some holes in my understanding.</p> <pre><code>package main import ( "fmt" ) type callback func(int, int) int func sum(x int, y int) int { return x + y } func useCallback(cb callback) { result := cb(2, 3) fmt.Println(result) } func main() { useCallback(sum) } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I'm learning Go, and as an exercise I wanted to implement a linked list. For reference I looked at the official Go code (<a href="" rel="noreferrer"></a>) . One thing that stuck with me are these lines:</p> <pre><code> 108 // remove removes e from its list, decrements l.len, and returns e. 109 func (l *List) remove(e *Element) *Element { 110 = 111 = e.prev 112 = nil // avoid memory leaks 113 e.prev = nil // avoid memory leaks 114 e.list = nil 115 l.len-- 116 return e 117 } </code></pre> <p>I am curious as to how does setting pointers to nil in this case prevent memory leaks? If possible I would like to construct a program which has this flaw and see it while profiling with pprof (I would use a modified verion of the list.go without this nil pointer setting).</p> <hr> <p><strong>For clarity of answer</strong>: If one of the nodes has an external pointer to it, then all of the adjacent removed nodes will have an active reference through that pointer and won't be removed. <a href="" rel="noreferrer"><img src="" alt="enter image description here"></a></p> <ol> <li>We create an external pointer pointing to Node2 </li> <li>We remove nodes 2-4 from the list</li> <li>You would expect at this point only for the Node 1,2 &amp; 5 to be alive and the rest to be GC-ed. However, due to Node2 still pointing to Node3 &amp; etc., the entire chain remains uncollected.</li> </ol> </div>


<div class="post-text" itemprop="text"> <p>I have a function with interface argument:</p> <pre><code>func f(e error) { if e == nil { fmt.Println("YEY! NIL") // how to get here? } else { fmt.Println("NOT NIL :(") } } </code></pre> <p>How do I pass it a nil value via <code>reflect</code> so that it passes <code>== nil</code> check?</p> <p>Approach 1:</p> <pre><code>func main() { rf := reflect.ValueOf(f) nilArg := reflect.Zero(reflect.TypeOf((error)(nil))) // panic: reflect: Zero(nil) rf.Call([]reflect.Value{nilArg}) } </code></pre> <p>Approach 2:</p> <pre><code>type MyError struct{} func (e MyError) Error() string { return "" } func main() { rf := reflect.ValueOf(f) nilArg := reflect.Zero(reflect.TypeOf(&amp;MyError{})) // NOT NIL :( rf.Call([]reflect.Value{nilArg}) } </code></pre> <p>Second approach doesn't work due to <a href="" rel="nofollow noreferrer"></a></p> <p>Playground: <a href="" rel="nofollow noreferrer"></a></p> </div>


<div class="post-text" itemprop="text"> <p>Need to check if parameter being passed to func is nil and return 0.</p> <p>Below is my intended code </p> <pre><code>func (t *Transaction) GetOperationCount(input bean.Request) (int, error) { var result int = 0 if input == nil { //error here return result, nil } // Other code here!!!! return result, nil } </code></pre> <p><code>bean.Reques</code> is a struct. However it had issue: "cannot convert nil to type bean.Request input Request". I have trying </p> <pre><code>if (bean.Request{})== input </code></pre> <p>But it gives : </p> <pre><code>"json:\"MV_STATUS\""; NDFNFFP string "json:\"NDF_NFFP\""; NDFNFMV string "json:\"NDF_NFMV\"" } "json:\"attr\"" } "json:\"marke t_value\"" } "json:\"market_values\"" } "json:\"tick\"" } "json:\"insertion\"" } "json:\"operation\"" } "json:\"transaction\"" } cannot be compared) </code></pre> <p>Should I change the parameter to "input *bean.Request" ?</p> </div>


<div class="post-text" itemprop="text"> <p>When unmarshalling a string of json, using Golang's <code>json.Unmarshal()</code> function, I always unmarshal the string into a <code>map[string]interface{}</code> - <em>I'm not sure weather there is a more optimal way of decoding json.</em></p> <p><strong>To get to the point:</strong> </p> <p>Sometimes the json's unmarshalled type is <code>nil</code>, not <code>string</code> (or <code>int</code> etc.). This always throws a panic, saying:</p> <blockquote> <p>interface conversion: interface is nil, not int</p> </blockquote> <p>How can I avoid this panic or check if the interface's type is <code>nil</code> or not?</p> <p><strong>Example:</strong></p> <p>Here is an example of my problem in action: <a href="" rel="nofollow noreferrer"></a></p> </div>

为什么在golang中打印(nil)映射会产生非“ <nil>”结果?

<div class="post-text" itemprop="text"> <p>In golang, if you create a struct with a map in it, which is uninitialized, printing the map yields a non <code>&lt;nil&gt;</code> string.</p> <p>Why does "print" of a nil map output "map[]" instead of <code>&lt;nil&gt;</code> ? </p> <pre><code>// Assume above there is a struct, a.AA, which is created but which otherwise // has not created the map. //output: //map[] //map[] fmt.Println(a.AA) fmt.Println(make(map[string]int64)) </code></pre> </div>


<div class="post-text" itemprop="text"> <p>Is it possible to pass a method on a struct as a callback function in golang ? </p> <p>E.g. Register a message handler :</p> <pre><code>func (mc MQTTClient) MessageHandler(client MQTT.Client, msg MQTT.Message) { fmt.Printf("TOPIC: %s ", msg.Topic()) fmt.Printf("MSG: %s ", msg.Payload()) } func (mc MQTTClient) AddMessageHandler(){ //.. //subscribe to the topic /go-mqtt/sample and request messages to be delivered //at a maximum qos of zero, wait for the receipt to confirm the subscription if token := c.Subscribe("go-mqtt/sample", 0, mc.MessageHandler); token.Wait() &amp;&amp; token.Error() != nil { fmt.Println(token.Error()) os.Exit(1) } } </code></pre> <p>Thank you very much !</p> </div>


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




一、分而治之的思想 分而治之方法与软件设计的模块化方法非常相似 分而治之通常不用于解决问题的小实例,而要解决一个问题的大实例。一般步骤为: ①把一个大实例分为两个或多个更小的实例 ②分别解决每个小实例 ③把这些小实例的解组合成原始大实例的解 二、实际应用之找出假币 问题描述 一个袋子有16个硬币,其中只有一个是假币,这个假币比其他的真币重量轻(其他所有真币的重量都是相同的)...


一 前言 此篇文章的内容也是学习不久,终于到周末有时间码一篇文章分享知识追寻者的粉丝们,学完本篇文章,读者将对token类的登陆认证流程有个全面的了解,可以动态搭建自己的登陆认证过程;对小项目而已是个轻量级的认证机制,符合开发需求;更多精彩原创内容关注公主号知识追寻者,读者的肯定,就是对作者的创作的最大支持; 二 jwt实现登陆认证流程 用户使用账号和面发出post请求 服务器接受到请求后使用私...

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

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


刚才邻居打了个电话说:喂小灰,你家wifi的密码是多少,我怎么连不上了。 我。。。 我也忘了哎,就找到了一个好办法,分享给大家: 第一种情况:已经连接上的wifi,怎么知道密码? 打开:控制面板\网络和 Internet\网络连接 然后右击wifi连接的无线网卡,选择状态 然后像下图一样: 第二种情况:前提是我不知道啊,但是我以前知道密码。 此时可以利用dos命令了 1、利用netsh wlan...




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






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




即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...


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


如果世界上都是这种不思进取的软件公司,那别说大部分程序员只会写 3 年代码,恐怕就没有程序员这种职业。

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

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


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


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






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


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


硅谷科技公司上班时间OPEN早已不是什么新鲜事,早九晚五是常态,但有很多企业由于不打卡,员工们10点、11点才“姗姗来迟”的情况也屡见不鲜。 这种灵活的考勤制度为人羡慕,甚至近年来,国内某些互联网企业也纷纷效仿。不过,硅谷普遍弹性的上班制度是怎么由来的呢?这种“流行性迟到”真的有那么轻松、悠哉吗? 《动态规划专题班》 课程试听内容: 动态规划的解题要领 动态规划三大类 求最值/计数/可行性 常...




爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4


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

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





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


前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...