TCP is handy for simple, reliable communications like this tiny toy logger. I run the server and clients in separate consoles on the same machine:
# TCP log server
nc -kl 8000 > server-log.txt
# TCP logging from netcat client
date | nc 127.0.0.1 8000
# TCP logging from socat client
date | socat STDIN TCP:localhost:8000
# TCP logging from Bash client
date > /dev/tcp/127.0.0.1/8000
The only bummer about TCP is that–in my example–other clients have to wait in line. We are logging so I want fast, one-way communication from any number of clients to the server, and reliability of every log message is probably not critical. Let’s try UDP! I could just add -u to the netcat server args to use UDP datagrams, but a netcat UDP server gets a little wonky
. The easy workaround is to use socat as the server instead. socat happily accepts any datagram from multiple clients, simultaneously.
# UDP log server
socat UDP-RECV:8000 STDOUT > server-log.txt
# UDP logging from netcat client
date | nc -q1 -4 -u 127.0.0.1 8000
# UDP logging from socat client
date | socat STDIN UDP-DATAGRAM:localhost:8000
# UDP logging from Bash client
date > /dev/udp/127.0.0.1/8000
Use at your own risk. The TCP version is surely simplest, safest (ahem, still no auth – this is just a toy) and reliable. I don’t know much about what’s going on under the hood here. Insight welcome! Messages from different clients might get mangled together, too. Tested on Ubuntu 14.04.
I’ve heard a lot of Meteor news lately, but somehow I missed Sandstorm. Your own personal cloud. Install services easier than installing apps on your phone. Add machines and they self-organize into a cluster. This sounds just way too awesome. Looks like they use Meteor heavily. Jade Wang (formerly of the Meteor Development Group) is a co-founder.
Apps must be packaged for Sandstorm (made into “grains”). The list of ported apps is pretty inspiring. Included are: draw.io, LibreBoard, HackerSlides, Let’s Chat, Paperwork… All were new to me, several are written in Meteor, and I was able to check out all of these in seconds. I’m hooked.
I’ll be speaking about Meteor dev with Vim at the Seattle Meteor Meetup on Worldwide Meteor Day. Come on down!
If you’ve ever set up a machine by hand, you’ve probably had to decide how much of your disk to set aside as swap.
I’ve often wondered “why swap at all”? This quote by Nick Piggin from 2004 finally helped me answer the question.
no matter how much ram you have, swap can increase performance by allowing unused anonymous memory to be paged out, thereby increasing your maximum effective RAM
Found via this post on Hacker News, where the poster raises the point that some filesystem buffers might be extremely “hot” (frequently used), but might only fit in physical RAM (where they should be) if some swap space is available to page out other “cold” information.
Update 2016-12-22: except for Kubernetes nodes, apparently.
The Seattle Disaster Relief Trials was a blast! Great idea, Jesse.
The balloon got wedged into my helmet at the 1st checkpoint and just stayed there the whole ride.
There’s also a *very* brief cameo of me buckling in a bucket of water at the 2nd checkpoint (1min 52sec in) in http://q13fox.com/2013/06/21/bike-heroes-prepare-for-disaster/
I’m proud that LJ accepted my Hadoop/MapReduce article for the April 2013 issue! If you’re new to MapReduce and are interested in learning about same, this article is for you.
I’ll also be presenting a talk based on the article at LinuxFest Northwest 2013.
More and more great tech books are marked-up plain text stored in version control and render-able to ebook/HTML/PDF.
Turns out many ideas in this approach are recycled. Heck, Knuth released TeX in 1978.
One new-ish piece is this GitHub thing. GitHub provides a social coding service based on a popular software development power tool called git. GitHub is spreading like wildfire. Sure there’s lots of code on GitHub, but lots of other stuff too. Bike paths, home-renovation projects, and all German law! Srsly. This is just fun.
Anyone seen any novels on GitHub? Cory Doctorow, are you listening? If anyone turns out a popular novel on GitHub, it’ll be you!
It’s pretty fun for little experiments. I can imagine certain kinds of websites it would be good for (web-based chat, HTML5 games, collaborative editors, and one-webpage apps — same stuff I think vanilla Node.js excels at) and some it would not (mobile, CRUD with an RDBMS). I’m wondering if it would/should work well with larger web apps.
Meteor isn’t the only game around, it’s just the one I’ve looked at.
I enjoyed You are NOT a Software Engineer! by Chris Aitchison. It’s a fun analogy. Writing software certainly does feel more like something roughly planned and growing organically or evolving rather than something perfectly specified and executed. And I think this is OK.
Another thing we coders often forget: we are also authors. We write code for humans (others and our future selves) to read. I want you to be stoked when you read what I write! And coding is writing.