5 ms·
Go Hercule
- alixaxel 12y agoI'm clueless about what this is... Can I use it? Is the source code available?
- opendais 12y agoIts an autocomplete for their search engine with machine learning. I think its purely closed source based on the article.
- axk 12y agoIt wouldn't be very helpful, the algorithm and the problem are very specific to Thumbtack. That being said, we plan to extract and free common code as we use Go for more projects. We love free / open source software!
- scarboy 12y agoNot sure if it was your intention, but your weekly update case will reset every time there is a manual update. I avoid time.After for recurring tasks in a select loop for this reason. time.Ticker is great if you want to repeat the task at approximately the same interval. time.Timer is what I use when I want the task to repeat a certain time after the previous task has finished. You can also conveniently use timer.Reset(0) to trigger an immediate tick.
- axk 12y agoIt's intentional. The update doesn't have to happen at the same time every week, we just wanted the model to be no more than 1 week old. `time.Ticker` looks handy, I will definitely use it for another project.
- doragcoder 12y agoFYI: for i, v := range array will give you the indexes and values. If you just want the values then use "_" in place of i to "throwaway" the index. http://play.golang.org/p/JZZ40FMOMz http://play.golang.org/p/JZZ40FMOMz
- axk 12y agoThe funny thing is that I knew it, but wrote `for v := range array` anyway at least a few times! My point is, it's not very intuitive. Thankfully, the compiler catches that, unless it's `[]int`.
- jnks 12y agoThe idea is it's `for k := range object` to iterate over the keys, and `for k, v := range object` to iterate over the keys and values, whether the object is a slice, array, map or string. The only exceptional case is a channel, which has no indices/keys.
- axk 12y agoIt does make perfect sense, just goes against muscle memory from years of Python coding :)
- Queue29 12y ago> "Slicing past the end of array results in a runtime panic. Ignoring out of bound indices is more convenient (and consistent with how other languages handle this)." Ignoring logic bugs sounds like a horrible idea
- axk 12y agoIt's not always logic bugs. For example, here's how you would limit your slice to max N elements: arr = arr[:N] ...compared how it has to be done to avoid a panic: if len(arr) > N { arr = arr[:N] } Not a big deal though, just slightly more verbose.