2017年1月2日星期一

Do not use Golang's http.ListenAndServe() in production!

The default http.Server in source code:

func ListenAndServe(addr string, handler Handler) error {
server := &Server{Addr: addr, Handler: handler}
return server.ListenAndServe()
}

It lacks the ReadTimeout or IdleTimeout(go1.8), which will result in many unclosed connections if the client didn't close the connections explicitly. And soon, the server will complain about too many opened files.

instead, using the code like below to avoid the problem

func main() { http.HandleFunc("/rest", realtime.HandleInfo) s := &http.Server{ Addr: ":9001", Handler: http.DefaultServeMux, ReadTimeout: time.Second * 60, //important for closing client with timeout WriteTimeout: time.Second * 60, } log.Fatal(s.ListenAndServe()) }


2012年4月14日星期六

blender's cycles rocks

blender's new render engine Cycles is so coooool and easy to use. Combine with mix shader, there's lots of fun and possibility to create all kinds of material. The plastic key stroke I combined diffuse for color and glossy for reflection, mixed with 0.05 





2011年10月5日星期三

wind blowing and grass in blender 2.59


I made this according to 2 tutorials, but unfortunately it looks not like either of them :D

Cost me a lot of time to tweak the grass's looking, cuz it's not a real modeled grass, it lacks detail. I have to carefully use the ramp color to make them better looking.

I used particle system to generate  the grass and force field to blow, I works like a charm.

here are  the two tutorials I've studied

http://meancreativity.com/07/how-to-make-grass-1/
http://www.blenderguru.com/videos/the-secret-to-creating-realistic-grass
(this one can not work with blender 2.59 it mean to work with the 2.49 version, so don't try to follow the steps, you might get lost some where)

2011年10月4日星期二

fluid milk splash by blender


http://www.blenderguru.com/videos/introduction-to-the-fluid-simulator
Before I followed this tutorial and made this pic, I tried to make some city night scene, but I found I am lack of the light knowledge to make the atmosphere looks right, so I dropped it in middle.

I decide to do more homework before I start my own one,

In this work I didn't use Andrew's source file to only create the fluid simulation. Instead, I modeled everything again and changed some for my own pleasure

Thanks to Andrew Price,  I like his style of making stuff, keep it up and good luck


2011年9月30日星期五

blender add-on directory on macosx

cd /users/yourname/Library/Application\ Support/Blender/2.59/scripts/addons/luxrender/

it's a hidden directory, normally you can find it on Finder

2011年9月29日星期四

I am trying to make some pure water in a glass bottle and splashed by an ice cube. But  after I tried many ways, I found it's difficult to make it in blender's default render. The light and reflection is too complex for the blender internal render. So I googled some tutorials, they get these stuff done in luxrender. I finally get it, but I am not gonna try that right now, I think I should stick to blender for a little bit. Just to make things simpler and easier. I think I will come back to luxrender or other render engine later.

2011年9月26日星期一

blender ice cube followed tutorial

Here's another one, this should be the 3rd one.I still followed the tutorial of Andrew Price, thanks Andrew!
http://www.blenderguru.com/videos/how-to-create-realistic-ice

Icy? hmmm~~