Maker and maintainer of Internet things. Likes to play with interesting new stuff.
14 stories
·
0 followers

March of the Penguins

3 Comments and 5 Shares
You ARE getting older, though.
Read the whole story
stevenewey
3534 days ago
reply
Alt text: "You ARE getting older, though."
Bedfordshire
Share this story
Delete
1 public comment
bronzehedwick
3534 days ago
reply
Ha! This is good.
Tarrytown, NY

Universal Converter Box

5 Comments and 19 Shares
Comes with a 50-lb sack of gender changers, and also an add-on device with a voltage selector and a zillion circular center pin DC adapter tips so you can power any of those devices from the 90s.
Read the whole story
stevenewey
3538 days ago
reply
Alt text: "Comes with a 50-lb sack of gender changers, and also an add-on device with a voltage selector and a zillion circular center pin DC adapter tips so you can power any of those devices from the 90s."
Bedfordshire
tedder
3538 days ago
any of those devices from the 90s = windows laptops :)
2bithacker
3538 days ago
And still no Lightning support...
jstripinis
3538 days ago
And where is Display Port?
jth
3538 days ago
No BNC either.
popular
3538 days ago
reply
Share this story
Delete
4 public comments
satadru
3538 days ago
reply
So much love for this.
New York, NY
Dadster
3535 days ago
Yeah, only why no BIG parallel, 1/4" audio, or cannon audio? All as old as airline pneumatics.
obidamnkenobi
3538 days ago
reply
Only AKI octane rating? What about RON and MON??
JayM
3538 days ago
reply
Awesome.
Atlanta, GA
veracity
3538 days ago
reply
It's a bit like this...
Sydney, Australia

Why I Hate HATEOAS

1 Comment

Most of the population of people who have read Roy Fielding's dissertation tell us that, while we may understand HTTP verbs, we don't know anything about hypermedia. Our REST APIs, they say, are not really RESTful, and certainly do not exhibit Hypertext As The Engine Of Application State, or HATEOAS. The fact that we have APIs you need to read documentation to understand is a clear signal, they tell us, that the client is using out-of-band information to navigate the server. Hypermedia, they say, is the answer. We simply embed enough information in our responses that the client can intelligently choose what action to take next using only the contents of the HTTP response.

Why This Is Tremendously Stupid

When designing a hypermedia API, you're really designing for a client that does not, and will never, exist. Imagine you're asked by your manager to create a "REST API" for your business. Knowing the latest trends in API design, you come up with a hypermedia-driven design that uses HAL or some such nonsense. When your manager asks you if the API is ready, you answer in the affirmative.

When he asks if the documentation is ready as well, you gleefully tell him that such extraneous information is not necessary, and that your API responses include enough information for smart clients to use the API without any explicit documentation, minus a brief spec that describes what your rel values mean and so-forth.

Your manager then asks you again: "Is the documentation also ready?"

At this point, you hurry to write the "standard" REST documentation with explicit endpoints, the verbs they accept, and how to use them.

What you've really provided by writing the "standard" documentation is exactly the thing that makes hypermedia APIs ridiculous: lack of semantic understanding. There is no magical "smart client" that somehow knows that rel=comments means that the link leads to comments about the current resource and can figure out it should POST there to create a new comment. It has no idea what the hell a "comment" is.

Unless you tell it explicitly. But using out-of-band information to give meaning to your content is not acceptable. Instead, you must wait for the "smart client" that will never exist. Why am I sure of that? Because if it did, then it would effectively be a single client that could make use of every single (properly built) REST API in existence without requiring documentation. What would that even mean?

Here's a question:

Why are we collectively trying to build servers for which there can never be acceptable clients.

People are trying to wrangle their APIs into hypermedia formats or (worse) inventing new ones, all because someone decided that everything must be self-documenting, despite the fact that the consumers of that implicit documentation (machines) have no hope of understanding it.

Why are we killing ourselves to build HATEOAS systems? Are today's "don't call me REST" REST APIs so broken that we must write code with our heads in the sand, pretending that if we solve the server side issues, the client side will eventually catch up? Well, news flash. It won't catch up. Ever.

Keep Doing What You've Been Doing

Rather than striving for hypermedia systems, design ones that people can actually use without having to read 12 different specs and no documentation. Today's automated REST API documentation tools are fantastic, use them. Keep building "REST" APIs and calling them that, because there is no sensible alternative.

Of course, if you want to design a system using principles which, by definition, your system can never be said to use, go right ahead. In the meantime, I'll be getting stuff done.

      
 
Feed Ads by FeedBlitz
powered byad choices
 
Read the whole story
stevenewey
3606 days ago
reply
HATEOS never made pragmatic sense to me. Jeff expresses why so clearly.
Bedfordshire
Share this story
Delete

President

2 Comments and 5 Shares
Anyone who thinks we're all going to spend the 2032 elections poring over rambling blog posts by teenagers has never tried to read a rambling blog post by a teenager.
Read the whole story
stevenewey
3622 days ago
reply
Alt text: Anyone who thinks we're all going to spend the 2032 elections poring over rambling blog posts by teenagers has never tried to read a rambling blog post by a teenager.
Bedfordshire
Share this story
Delete
1 public comment
eraycollins
3622 days ago
reply
My goddaughter has begun limiting her Tumblr posts. I'm pretty sure it's a sign of her advanced teenage years.

Go development environment for Vim

1 Share

The reason for creating vim-go

Go has a very versatile toolchain and commands that makes Go programming fun. One of the famous tools is gofmt, which automatically reformats the code according to some predefined rules. However there are many other tools like goimports, oracle, godef, etc.. which help to provide a more productive workflow.

There are many independent vim plugins that integrate these tools into Vim. We also have the offical Vim plugins that provides some basic Go support for Vim. However there are many flaws with these plugins:

  • Gofmt destroy the undo history and it's impossible to do undo on your code
  • Building, running or testing are not integrated, all of these needs additional settings.
  • Binary paths are hard coded
  • Plugins are not using the same format. Each plugin is built differently, some support lookup under the cursor, some do not.
  • Syntax highlighting can't highlight functions
  • Auto completion needs a package and additional settings.
  • Many other small flaws..

The main reason to create vim-go was to integrate all these plugins, fix the flaws and provide a common and seamless experience.

Vim-go features

vim-go improves and supports the following features:

  • Improved Syntax highlighting
  • Auto completion support
  • Integrated and improved snippets support
  • Gofmt on save, keeps cursor position and doesn't break your undo history
  • Go to symbol/declaration
  • Automatically import packages
  • Compile and build package
  • Run quickly your snippet
  • Run tests and see any errors in quick window
  • Lint your code
  • Advanced source analysis tool with oracle
  • Checking for unchecked errors.

vim-go automatically installs all necessary binaries if they are not found in the pre-defined path ~/.vim-go (can be disabled if not desired). It comes with pre-defined sensible settings. Under the hood it uses goimports, oracle, godef, errcheck, gocode and golint. Let's see how we can make use of those tools.

Installation

vim-go is a pathogen compatible bundle. To use it just clone it into your bundle directory:

$ cd ~/.vim/bundle $ git clone https://github.com/fatih/vim-go.git

Auto completion is enabled by default via <C-x><C-o>, to get real-time completion (completion by type) install YCM:

$ cd ~/.vim/bundle $ git clone https://github.com/Valloric/YouCompleteMe.git $ cd YouCompleteMe $ ./install.sh

Development with vim-go

On first usage it tries to download and install all necessary binaries. Let's see what commands we now can use. Below is a list of commands vim-go supports, most of the commands are improved and new ones were introduced (some of them are just from the official Go plugin).

vim-go uses goimports and reformats whenever you save your file. However you have the option to disable goimports and explicitly import/drop packages:

:Import <path> :ImportAs <localname> <path> :Drop <path> :DisableGoimports :EnableGoimports

Godoc can be called on any identifier. Just put your cursor under the identifier and call :Godoc, it will open a new view and show the necessary documentation.

:Godoc :Godoc <identifier>

Godef is one of my favorites tools. It's find the source definition and jumps to that file (go to definition). To use it just put your cursor under a identifier and hit :Godef. It opens a new buffer (just like ctags). You might add the following settings to your vimrc, to open the definitions in vertical, horizontal or new tab with :

au Filetype go nnoremap <leader>v :vsp <CR>:exe "GoDef" <CR> au Filetype go nnoremap <leader>s :sp <CR>:exe "GoDef"<CR> au Filetype go nnoremap <leader>t :tab split <CR>:exe "GoDef"<CR>

Building, testing, running are all important steps in development workflow and should be seamless integrated. vim-go has several features that you can use. First check out the build commands:

:make :GoBuild

:make is the default Vim command to build a project. vim-go integrates it in way that it doesn't produce any binary. That it is really useful because it doesn't pollute your work environment. Any errors are listed in a quickfix window and can be jumped easily with default :cnext and :cprevious. :GoBuild is similar to :make, but it creates a binary for the given main package.

Sometimes we only have small main package that we can want to run and see the output. For that we have:

:GoRun :GoRun <expand>

Just calling :GoRun is going to include all files that belongs to the main package (useful for multi file programs). To run a single file just run `:Gorun %`. You can map this to a key, like <leader>r:

au Filetype go nnoremap <leader>r :GoRun %<CR>

To call `go test` just run:

:GoTest

Another tool we have is errcheck, which checks unchecked errors:

:GoErrCheck

Linting is useful to print out mistakes or tips about coding style. For example if you don't provide any documentation comment for a function golint will warn you. To call it just execute:

:Lint

To see the dependencies of your current package run :GoDeps. If you have multiple files you can easily see all source files (test files are excluded) via :Gofiles.

And then we have the still experimental but powerful "oracle" tool. See the extensive official documentation for more info: Oracle docs vim-go implements and includes the following commands (which are part of the offical oracle vim plugin):

:GoOracleDescribe :GoOracleCallees :GoOracleCallers :GoOracleCallgraph :GoOracleImplements :GoOracleChannelPeers

These are useful especially if you want to find out how your Code is structured, how your channels are interacting with each other, which struct is implementing which interface, etc...

Summary and Thanks!

Thanks for the following users and projects to make this project happen:

  • Go Authors for offical vim plugins
  • Gocode, Godef, Golint, Oracle, Goimports, Errcheck projects and authors of those projects.
  • Other vim-plugins, thanks for inspiration (vim-golang, go.vim, vim-gocode, vim-godef)

Check out the github page for fare more information (snippets, settings, etc..):

github.com/fatih/vim-go

There is also a Youtube vide that shows vim-go in action:

Youtube: Go development in Vim

There are still tons of modifications and improvements one can make to this setup. vim-go is a new project. Check it out and try it to see how it fits your needs. Any improvements and feedback are welcome.

Read the whole story
stevenewey
3668 days ago
reply
Bedfordshire
Share this story
Delete

Why Procrastinators Procrastinate

14 Comments and 24 Shares
pro-cras-ti-na-tion |prəˌkrastəˈnāSHən, prō-|
noun
the action of delaying or postponing something:your first tip is to avoid procrastination.

Who would have thought that after decades of struggle with procrastination, the dictionary, of all places, would hold the solution.

Avoid procrastination. So elegant in its simplicity.

While we're here, let's make sure obese people avoid overeating, depressed people avoid apathy, and someone please tell beached whales that they should try to avoid being out of the ocean.

No, "avoid procrastination" is only good advice for fake procrastinators—those people that are like, "I totally go on Facebook a few times every day at work—I'm such a procrastinator!" The same people that will say to a real procrastinator something like, "Just don't procrastinate and you'll be fine."

The thing that neither the dictionary nor fake procrastinators understand is that for a real procrastinator, procrastination isn't optional—it's something they don't know how to not do.

In college, the sudden unbridled personal freedom was a disaster for me—I did nothing, ever, for any reason. The one exception was that I had to hand in papers from time to time. I would do those the night before, until I realized I could just do them through the night, and I did that until I realized I could actually start them in the early morning on the day early the morning they were due. This behavior reached caricature levels when I was unable to start writing my 90-page senior thesis until 72 hours before it was due, an experience that ended with me in the campus doctor's office learning that lack of blood sugar was the reason my hands had gone numb and curled up against my will. (I did get the thesis in—no, it was not good.)

Even today, this post won't be up until late Tuesday night because I spent a bunch of hours doing things like seeing this picturesitting on my desktop from the last post, opening it, looking at it for a long time thinking about how easily he could beat me in a fight, then wondering if he could beat a tiger in a fight, then wondering who would win between a lion and a tiger, and then googling that and reading about it for a while awhile (the tiger would win). I have problems.

To understand why procrastinators procrastinate so much, let's start by understanding a non-procrastinator's brain:






Pretty normal, right? Now, let's look at a procrastinator's brain:





Notice anything different?

It seems the Rational Decision-Maker in the procrastinator's brain is coexisting with a pet—the Instant Gratification Monkey.

This would be fine—cute, even—if the Rational Decision-Maker knew the first thing about how to own a monkey. But unfortunately, it wasn't a part of his training and he's left completely helpless as the monkey makes it impossible for him to do his job.



















The fact is, the Instant Gratification Monkey is the last creature who should be in charge of decisions—he thinks only about the present, ignoring lessons from the past and disregarding the future altogether, and he concerns himself entirely with maximizing the ease and pleasure of the current moment. He doesn't understand the Rational Decision-Maker any better than the Rational Decision-Maker understands him—why would we continue doing this jog, he thinks, when we could stop, which would feel better. Why would we practice that instrument when it's not fun? Why would we ever use a computer for work when the internet is sitting right there waiting to be played with? He thinks humans are insane.

In the monkey world, he's got it all figured out—if you eat when you're hungry, sleep when you're tired, and don't do anything difficult, you're a pretty successful monkey. The problem for the procrastinator is that he happens to live in the human world, making the Instant Gratification Monkey a highly unqualified navigator. Meanwhile, the Rational Decision-Maker, who was trained to make rational decisions, not to deal with competition over the controls, doesn't know how to put up an a effective fight—he just feels worse and worse about himself the more he fails and the more the suffering procrastinator whose head he's in berates him.

It's a mess. And with the monkey in charge, the procrastinator finds himself spending a lot of time in a place called the Dark Playground.* Playground.

The Dark Playground is a place every procrastinator knows well. It's a place where leisure activities happen at times when leisure activities are not supposed to be happening. The fun you have in the Dark Playground isn't actually fun because it's completely unearned and the air is filled with guilt, anxiety, self-hatred, and dread. Sometimes the Rational Decision-Maker puts his foot down and refuses to let you even do the unfun fun leisure play, and since the Instant Gratification Monkey sure as hell isn't gonna let you work, you find yourself in a bizarre purgatory of weird activities where everyone loses.**


(Most of you are probably reading this article in the Dark Playground right now.)




And the poor Rational Decision-Maker just mopes, trying to figure out how he let the human he's supposed to be in charge of end up here again.








Given this predicament, how does the procrastinator ever manage to accomplish anything? something?

As it turns out, there's one thing that scares the shit out of the Instant Gratification Monkey:




The Panic Monster is dormant most of the time, but he suddenly wakes up when a deadline gets too close or when there's danger of public embarrassment, a career disaster, or some other scary consequence.











The Instant Gratification Monkey, normally unshakable, is terrified of the Panic Monster. How else could you explain the same person who can't write a paper's introductory sentence over a two-week span suddenly having the ability to stay up all night, fighting exhaustion, and write eight pages? Why else would an extraordinarily lazy person begin a rigorous workout routine other than a Panic Monster panic monster freakout about becoming less attractive?

And these are the lucky procrastinators—there are some who don't even respond


Thanks
to the Panic Monster, and in the most desperate moments they end up running up the tree with the monkey, entering a state of self-annihilating shutdown.

Quite a crowd we are.

Of course, this is no way to live. Even for the procrastinator who does manage to eventually get things done and
the procrastinator will usually end up getting things done when he needs to and will probably remain a competent member of society, something has to change. society. But this isn't a great way to live. Here are the main reasons why: issues:

1) It's unpleasant. Far too much of the procrastinator's precious time is spent toiling in the Dark Playground, time that could have been spent enjoying satisfying, well-earned leisure if things had been done on a more logical schedule. And panic isn't fun for anyone.

2) The procrastinator ultimately sells himself short.He ends up underachieving and fails to reach his potential, which eats away at the him over time and fills him with regret and self-loathing.

3) The Have-To-Dos may happen, but not the Want-To-Dos.Even if the procrastinator is in the type of career where the Panic Monster is regularly present and he's able to be fulfilled at work, the other things in life that are important to him—getting in shape, cooking elaborate meals, learning to play the guitar, writing a book, reading, or even making a bold career switch—never happen because the Panic Monster doesn't usually get involved with those things. Undertakings like those expand our experiences, make our lives richer, and bring us a lot of happiness—and for most procrastinators, they get left in the dust.

So how can a procrastinator improve and become happier? That's the topic of We'll discuss in next week's post.

---------

* A lot of you are probably reading this article while in the Dark Playground.

** I spent two hours in the Dark Playground right before I drew the Dark Playground drawing, because I was dreading having to draw the signpost, which I knew would be hard and take forever (which it did).






Like this post on Facebook:

Like Wait But Why on Facebook:
Read the whole story
stevenewey
3819 days ago
reply
Bedfordshire
popular
3820 days ago
reply
Share this story
Delete
12 public comments
howcross
3816 days ago
reply
I hate it when the monkey is in charge (except when I love having the monkey in charge). Yup, I'm writing from the Dark Playground right now.
Howcross Castle
adamrmorris
3817 days ago
reply
Nhhhhice.
emdeesee
3818 days ago
reply
QFT

Is there anyone, though, who doesn't see themselves in this? Just curious...
Sherman, TX
WorldMaker
3818 days ago
reply
Yup.
Louisville, Kentucky
Cafeine
3820 days ago
reply
Oh I know that monkey... :(
Paris / France
nealkemp
3820 days ago
reply
The meta is strong with this.
London
Michdevilish
3820 days ago
reply
My procrastinating Panic Monster anxiously awaits the next post...
Canada
superiphi
3820 days ago
reply
Cute. Oversimplifies though - the monkey is often invited willingly not just because of gratification but diversion... diversion from fear. Fear about the work - fear of mistakes, fear of not being good enough. Thats why it's displaced by a bigger fear
Idle, Bradford, United Kingdom
jhamill
3822 days ago
reply
Yup.
California
ScottInPDX
3822 days ago
reply
This could have spilled right from my brain. If I had bothered to do it, of course...
Portland, Oregon, USA, Earth
TARDIS75
3823 days ago
reply
Ummmmm, yup!
Rockford, Illinois
glenn
3823 days ago
reply
Sooo true
Waterloo, Canada
Next Page of Stories