Friday, April 01, 2016
I've read a lot core.async
stuffs, in order to get a clearer mind about how to use the library correctly.
one thing I didn't notice before and always wondered is: how can you tell a go block is done it's job?
the answer is very simple, go block ends with putting the evaluated value to a channel and returns it.
Saturday, April 02, 2016
finally upgraded the nvidia driver on my old laptop, it kept crashing when connected with external monitor.
tried all ppa approaches, didn't work. finally succeeded by following this guide: How to Install NVIDIA 346.35 Stable Driver in Ubuntu 14.04
my driver is GeForce 8400M GS, not supported by version 346.xx
mentioned in the article, I need to download the 340.xx
version (the 346.xx
installer will tell you about this)
create /etc/modprobe.d/blacklist-nouveau.conf
, with content:
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
also run these two commands:
$ echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf
$ sudo update-initramfs -u
reboot, Ctrl+Alt+F1
to leave X, and :
$ sudo stop lightdm
then run the 340.xx
installer.
Monday, April 04, 2016
after read this article: The puts and takes of core.async
I tried to find out more about the difference between pending put and parking.
found this: Clojure core.async put! versus go block - Stack Overflow about core.async
Question:
- How does
put!
achieve asynchrony? Does it also uses a thread-pool?- Does
put!
also uses parking?- What is the role of the finite state-machine in the go block? Is it what enables parking?
- Should I always try to use
put!
rather than go because it is cheaper? In that case, does that mean thatput!
achieve the exact same concurrency goodness as go, and that go is only used when I want to reason about complex asynchronous code?
Answer:
- If
put!
is not accepted immediately, it places a pending put (the value to be put on the channel + theput!
callback) on a queue internal to the channel. Note that an exception will be thrown if there is no room in the queue (max capacity is currently fixed at1024
).The callback will be called on a pooled thread if (1) the put is not immediately accepted or (2) an explicit
false
is passed in as a final argument to theput!
call (this argument is calledon-caller?
, seeput!
's docstring for details).
- "Parking", in the context of
go
blocks, refers to suspending execution of ago
block's state machine by recording certain details of its current state and saving them inside a channel, or possibly several channels, so that it can be restarted later. (Note that this arrangement means that if all the channels holding references to a suspendedgo
block are GC'd, thego
block itself can also be GC'd.) In other contexts it similarly refers to putting a thread of control in a state of suspended animation.put!
is just a function (well, it's backed by a protocol method, but then that is just a protocol method), so the concept doesn't apply.- Yes. It basically steps through the code in the
go
block, possibly suspending it when control reaches certain "custom terminals" (<!
,>!
,alt!
).- Not necessarily, you should first consider the risk of overflowing the internal queue (see point 1 above).
also watched this presentation as suggested: Implementation details of core.async Channels - Rich Hickey
the talk has more details about the pending operation queues.
Thursday, April 07, 2016
installed Riemann and tried few things, I really like it, not a drop-in solution but a really simple Concepts.
I'm reading sample chapters of this book: The Art of Monitoring
also reading Mastering Clojure
an interesting article: Overtone Recipes - Recreating Daft Punk's Da Funk, I really want to spend some time on Overtone and Quil
Tuesday, April 12, 2016
got interested in troff
after reading Brian Kernighan on the typesetting of "The Go Programming Language" book
there're few classical macros come with groff
(the GNU troff), mm
, ms
and me
: see Macro packages (the page also provides links for the guide of each macro)
UNIX Document Processing and Typesetting mentions these 3 macros in the Using Macro Packages with nroff/troff section.
leaning the ms
macro from this page UNIX Text Formatting Using the -ms Macros and -ms quick reference, produce pdf file using:
groff -ms [input] | ps2pdf - [output]
and the output was gorgeous.
Mastering Clojure is very good. I read many fundamental books on clojure, but this one still brings me something new.
Wednesday, April 13, 2016
Spinnaker seems using debian package to build the code image (see Hello Deployment), and using s3
as debian repository is very cool. I might need to find a time to try that out.
for other netflix oss components, I'm currently checking on:
- hystrix, wrap your service with latency tolerance and fault tolerance logic, circuit breaker, wiki and Hystrix Examples and a little bit more)
- eureka, middle-tier load balancer, discovery service, wiki
- servo, java application monitoring, wiki
- zuul, dynamic routing, wiki
- evcache, distributed in-memory data store, wiki
- archaius, configuration management, wiki
- ribbon, client side load balancer, wiki
- curator, zookeeper client wrapper (now under apache foundation)
- blitz4j, asynchronous logging, wiki
- vector, monitoring framework, wiki
- raigad, elasticsearch management tool, wiki
- GitHub - Netflix/atlas, time series data collect and query wiki
few links to help to understand:
- Netflix Open Source Software Center
- Getting Started with Microservices Using Netflix OSS & Docker | nirmata
- Building microservices with Spring Cloud and Netflix OSS blog series
it's very heavy java and microservices oriented, could start with:
Thursday, April 14, 2016
found a command online to could be used for clearing the php opcache: php-fpm-cli
$ php-fpm-cli -r 'opcache_reset();' -connect 127.0.0.1:9000
$ php-fpm-cli -r 'var_dump(opcache_get_status());' -connect 127.0.0.1:9000
cgi-fcgi
command can be found on libfcgi0ldbl
package on ubuntu, I've used this command to debug some fastcgi issues, but wasn't thinking could use it to clear the opcode cache.
didn't follow the Toronto Java Users Group for quite a while, they always got interesting topics:
Tuesday, April 19, 2016
saw a funny usage of watch
, when downloading/copying a large file, this command watches the file size every 100ms:
$ watch -n 0.1 du -s filename
Thursday, April 21, 2016
found a very interesting article: Building an offline page for theguardian.com
I tried disconnect my laptop and reload the page, it just loaded ... crazy! (btw, the guardian's frontend is open sourced)
Service workers explained and The Service Worker Cookbook are good starts.
Friday, April 22, 2016
Ubuntu new LTS version 16.04
has been released: The squirrel has landed!
some readings:
- What's New in Ubuntu 16.04
- Systemd Essentials: Working with Services, Units, and the Journal
- Linux Containers - LXD
Upgrade Ubuntu 16.04
on desktop is quit easy:
- make sure everything is update to date in
software updater
(it cleared my previous nvidia update and broke the X, but ran the installer again fixed it.) - under terminal run
sudo update-manager -d
, clickupgrade
.
Sunday, April 24, 2016
playing with new ubuntu desktop, Ubuntu 16.04 Makes Ubuntu Exciting Again has one good tip:
move unity launcher to bottom:
$ gsettings set com.canonical.Unity.Launcher launcher-position Bottom
# revert
$ gsettings set com.canonical.Unity.Launcher launcher-position Left
Friday, April 29, 2016
about unpack an apk
file, it's pretty easy actually. you'll need dex2jar and jd-gui:
- use
unzip
to extract theapk
file. ./d2j-dex2jar.sh someclass.dex
- use
jd-gui
to browse the output.class
file
playing with send commands to tmux
panes, some simple commands
- list sessions:
tmux ls
- list windows:
tmux list-windows
- list pane:
tmux list-panes
- select window:
tmux select-window -t 0
- send command to pane:
tmux send-keys -t 0 'ls Enter'
Blog Archive
- Newer Entries
- 2016 May
- 2016 June
- 2016 July
- 2016 August
- 2016 September
- 2016 October
- 2016 November
- 2016 December
- 2017 January
- 2017 February
- 2017 March
- 2017 April
- 2017 May
- 2017 June
- 2017 July
- 2017 August
- 2017 September
- 2017 October
- 2017 November
- 2017 December
- 2018 January
- 2018 February
- 2018 March
- 2018 April
- 2018 May
- 2018 June
- 2018 July
- 2018 August
- 2018 September
- 2018 October
- 2018 November
- 2018 December
- 2019 January
- 2019 February
- 2019 March
- 2019 April
- 2019 May
- 2019 July
- 2019 October
- 2019 November
- 2019 December
- 2020 August
- 2020 September
- 2020 October
- 2020 November
- 2020 December
- 2021 January
- 2021 February
- 2021 March
- 2021 April
- 2021 May
- 2021 June
- 2021 August
- 2021 September
- 2021 December
- 2022 March
- 2022 April
- 2022 May
- 2022 June
- 2022 July
- 2022 August
- 2022 September
- 2022 October
- 2022 November
- 2022 December
- 2023 January
- 2023 February
- 2023 March
- 2023 April
- 2023 July
- 2023 August
- 2023 September
- 2023 October
- 2023 November
- 2023 December
- 2024 January
- 2024 February
- 2024 March
- 2024 April
- 2024 May
- 2024 June
- 2024 August
- 2024 September
- Older Entries
- 2016 March
- 2016 February
- 2016 January
- 2015 December
- 2015 November
- 2015 October
- 2015 September
- 2015 August
- 2015 July
- 2015 June
- 2015 May
- 2015 April
- 2015 March
- 2015 February
- 2015 January
- 2014 December
- 2014 November
- 2014 October
- 2014 September
- 2014 August
- 2014 March
- 2014 February
- 2014 January
- 2013 December
- 2013 October
- 2013 July
- 2013 June
- 2013 May
- 2013 March
- 2013 February
- 2013 January
- 2012 December
- 2012 November
- 2012 October
- 2012 September
- 2012 August