Avatar

RAM9

@robotarmyma / robotarmyma.tumblr.com

RAM9 is Hacker, Artist, Coder, DJ, Producer, and Perma-culturalist.
Avatar
Avatar

Unix Haters Handbook - Appendix - B - They Apologize for C

Appendix B, Unix Haters Handbook. (pg308)

In an announcement that has stunned the computer industry, Ken Thompson, Dennis Ritchie, and Brian Kernighan admitted that the Unix operating system and C programming language created by them is an elaborate April Fools prank kept alive for more than 20 years. Speaking at the recent UnixWorld Software Development Forum, Thompson revealed the following:

"In 1969, AT&T had just terminated their work with the GE/AT&T Multics project. Brian and I had just started working with an early release of Pascal from Professor Nichlaus Wirth's ETH labs in Switzerland, and we were impressed with its elegant simplicity and power. Dennis had just finished reading Bored of the Rings, a hilarious National Lampoon parody of the great Tolkien Lord of the Rings trilogy. As a lark, we decided to do parodies of the Multics environment and Pascal. Dennis and I were responsible for the operating environment. We looked at Multics and designed the new system to be as complex and cryptic as possible to maximize casual users' frustration levels, calling it Unix as a parody of Multics, as well as other more risque allusions. "

Then Dennis and Brian worked on a truly warped version of Pascal, called "A."

When we found others were actually trying to create real programs with A, we quickly added additional cryptic features and evolved into B, BCPL, and finally C. We stopped when we got a clean compile on the following syntax:

for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/ 8)%2))P("|"+(*u/4)%2);

To think that modern programmers would try to use a language that allowed such a statement was beyond our comprehension! We actually thought of selling this to the Soviets to set their computer science progress back 20 or more years. Imagine our surprise when AT&T and other U.S. corporations actually began trying to use Unix and C! It has taken them 20 years to develop enough expertise to generate even marginally useful applications using this 1960s technological parody, but we are impressed with the tenacity (if not common sense) of the general Unix and C programmer.

"In any event, Brian, Dennis, and I have been working exclusively in Lisp on the Apple Macintosh for the past few years and feel really guilty about the chaos, confusion, and truly bad programming that has resulted from our silly prank so long ago."

Avatar
Avatar

The most exciting computing science event for me this year.

I have been discovering and exploring a strong, fast and safe alternative to RSA and AES. Safe[4] Elliptic Curves! I have a degree in mathematical sciences and statistics and focused on discrete math mostly because i’m interested in computing applications of math - and I myself needed a good primer.  I recommend footnote [1] as an introduction.

I know this is not news to most crypt-scientists - however to me this is one of the biggest things that is happening in modern computing science!

What is really exciting is seeing adoption and spread. Cryptology is only as effective as it’s ubiquity - having access to the algorithums and libraries in a variety of context is what makes the general difference.

I’m so excited because I believe we are past the tipping point. Curve25519, X25519, ED25519 are part of general library concerns and also portions of these specific Elliptic Curve[1] standards are integrated into fundamentally into TLS 1.3 (and somewhat TLS 1.2), OpenSSH and various other secure libraries.

This is coming from a HUGE amount of work by the general cryptography community and universities around the world. The relaxation of the Encryption export conditions that I grew up with are mostly gone as of 2009 and all the cryptography focus around bitcoin and derivative coins is really creating a rich time for cryptography world wide!

Some of the things that drive my excitement in this area:

Keybase.io [5] gaining steam and  providing a long needed mechanism for providing abstraction around keychain and identity.

Large companies like google have recognized the advantage and strength of stream based cyphers and has been contributing to the aformentioned changes in TLS. [2]

Libsodium[3] is audited, released and well supported with many programming language integration providing the general developer with high quality strong encryption and key generation based on Daniel J. Bernstein‘s work on Curve25519 and Salsa20  / ChaCha20.

:) Good times ahead!

Avatar
Avatar
reblogged

erlang:hibernate

Avatar
robotarmyma

erlang:hibernate(Module, Function, Args) -> no_return()

Types:

Module = module()

Function = atom()

Args = [term()]

Puts the calling process into a wait state where its memory allocation has been reduced as much as possible, which is useful if the process does not expect to receive any messages in the near future.

The process will be awaken when a message is sent to it, and control will resume in Module:Function with the arguments given by Args with the call stack emptied, meaning that the process will terminate when that function returns. Thus erlang:hibernate/3 will never return to its caller.

If the process has any message in its message queue, the process will be awaken immediately in the same way as described above.

In more technical terms, what erlang:hibernate/3 does is the following. It discards the call stack for the process. Then it garbage collects the process. After the garbage collection, all live data is in one continuous heap. The heap is then shrunken to the exact same size as the live data which it holds (even if that size is less than the minimum heap size for the process).

If the size of the live data in the process is less than the minimum heap size, the first garbage collection occurring after the process has been awaken will ensure that the heap size is changed to a size not smaller than the minimum heap size.

Note that emptying the call stack means that any surrounding catch is removed and has to be re-inserted after hibernation. One effect of this is that processes started using proc_lib (also indirectly, such as gen_serverprocesses), should use proc_lib:hibernate/3 instead to ensure that the exception handler continues to work when the process wakes up.

Avatar
Avatar

Clojure Koans - Recursion

(defn recursive-reverse [coll] (loop [coll coll acc '() ] (if (= (count coll) 0) acc (recur (rest coll) (cons (first coll) acc)) ) ) )

I struggled with this one for a while - I don't want to admit it, but honestly even though i have been coding since I was 16 years old - there are still many areas where I am rusty or weak.

There is actually a surprising amount of low level concepts operating in a list recursive reverse in clojure.

  • tail-call recursion
  • accumulator
  • loop construct

I have some questions about how this "special form"  loop operates with recur

I think I need to make sure that I always remember the following :

  • the arity of the recur call must match the arity of the loop form
  • recur must be in the tail position.

I'm not sure how this loop / recur mechanism is implemented in the JVM - I imaging that the binding created by 'loop' is associated with registers that are overwritten as part of the call to 'recur'. The documentation says the bindings are rebound on call of recur in parallel and the execution of recur - is done in order.

My questions are

  • Is recur causing some kind of local jump after each binding?
  • What happens with the return address? 
  • If recur doesn't consume stack - what is going on with the return address? 
  • Is the return address always the same for the same recursive call?

More importantly - Is there a chapter in Knuth AOC that could help me with this? Any other resources?  

I feel like I am really missing some context.

Avatar
Avatar
You can go fast, you can go smooth, but you are going to have to get out of thinking you can go fast and smooth - if you want to be really fast - you need to start with smooth [ Curtis Schofield : Racing Cars and Developing Software]
Avatar
Avatar

media query practices

I'm currently playing with using a 'column' definition and then redeclaring it's width for each device i'm supporting - tablet, desktop.

Using the 'base' unset media query as lowest common denominator.

Avatar
Avatar

Chef + Capistrano + rvm gemset

I spent the last few days struggling with chef.

What can i tell you so that you need not have to have the same struggle.

What ended up confusing me the most:

Essentially ruby needs to exist on the server side - I use RVM because it is easy to script and i know it well enough. The client side Capistrano script expects the gem bundler to exist on the client side and to be part of the gemset described in Capistrano - this gemset is named 'blazing_gemset_for_client_xxx' for the purpose of this post.

Design problem: 

[RVM + Chef-Solo ]:: Server Side -> responsible for bootstrapping a fresh ubuntu 10.10 LTS machine into complete ready state (DB+WEB)

[RVM + Capistrano ]:: Client Side -> cap production deploy should just work as it always does in the regular dev-cycle

Design Principles:

 Easy to start a new production machine from scratch

 Developers do not need root to deploy

What is less than vanilla in our setup:

 Had some legacy perl that expected to have apache.

What web stack did we choose :

 Passenger 3

What did I end up doing in the end

  1.  Install apache as the same user as is running the rails app (avoid permission issues and isolate user from root )
  2. System Wide RVM
  3. Create Gemset and manually bootstrap bundler into the gemset

What I wish i could do differently

  1. Didn't like having to couple the name 'blazing_gemset_for_client_xxx' (the rvm gemset that the capistrano script knows about) into the chef scripts

What I like about what was accomplished 

  1. Implemented a Internet-friendly chef-solo bootstrap script
  2. Installed vim and my jan repo for nicer editing experience server side
  3. discovered the tricky part about capistrano  + chef + rvm

What was in the way from taking a userland based approach for RVM

  1. Passenger is a server side component that requires a config file with pointers to ruby runtime - because of this - 'client' knowledge ended up embedded in the chef repository
  2. Capistrano assumes that a machine is setup in a particular configuration and it's RVM support did not seem to include bootstrapping a gemset - event if it did - there would be more work to integrate it into passenger

Notes

  1. Unicorn runs in a different model and wouldn't have encountered exactly this same issue
  2. There would still be the issues of coupling gemset name between Capistrano and chef - a detail that i think only one should know about. 

About Me

  1. I have been a unix script banger since i was a teenager.
  2. I've been coding ruby since 2003 and rails since 2005.
  3. I've used Capistrano on pretty much every project.
  4. I deploy my node.js scripts with chef and it works ok.
  5. This is my second chef based machine rollout package and my first time integrating it with capistrano.
  6. I just started learning how to plie.

Footnote 1 :

I implemented a internet-hostile standalone chef-solo system for unpacking complete systems inside user accounts on lockdown intranet virtual machines as well - this was a build based solution and did not use rvm - but took a userland based ruby approach.

Avatar
Avatar

erlang notices

When using ’export’ a typo of ’exports’ will result in a warning that your functions are not used. a function declaration seems to be a collection of ’,’ separated statements ending in a period. If a process executes a function with a runtime error then an error report will be generated and the exit value, the error with it will be described.

Avatar
Avatar

Bees, Javascript, Worms , Javascript, Javascript, Javascript

While riding my fixie up and down Geary street this morning - I had very little time to think about bees, worms, or javascript - for the past week that’s what’s generally been on my mind, that and the occasional cardamon infused coffee.

On the Javascript front BlazingCloud has released a online university class dictated by your’s truly - Mr Curtis Jennings.

I haven’t found a way to work worms or bees into the Javascript curriculum - when i do it is going to be awesome.

And what is this javascript curriculum i’m talking - imagine the combined power of Sarah Allen, Alex Chaffee and myself - in hybrid magic glowing brontosaurus shaped bus - traveling the galaxy sprinkling programming nuggets on the new javascript programmers. I’m building on their great work and on the great work of a thousand monkey ninja coders with blogger accounts.

When I say nuggets - I’m not talking about black gold - [ by that i mean worm compost - ( it’s the goods to mix in that soil compost mixture you know you want to make from your leftover rice) ].

Nuggets of Javascript Awesomeness - like closures and object patterns and even that blasted new operator.

I’ve been pumping out these videos for 2 weeks and there isn’t an end in sight.

The course is up and running - i’m making small tweaks to it as we go - there is a discount through women 2.0.

http://www.udemy.com/beginning-javascript-and-behavior-driven-development-with-jasmine/

I heard the myth that bumble bees wings are much to small to achieve lift - i wrote an article for a small art group that was made up of myself and myself with a different name - and now today - science can share with you that Bumble bees fly through ‘brute force’ - rather they got massive energy and they just get it done - not so much finesse but just by doing it. *1

Much like the bumble bee - Bombus Terrestris - i am a power pack of energy and right now it’s been going into javascript lessons for you.

I’ve put up some awesome free walkthroughs of the lessons in the paid course for those of you that ‘just can’t get enough’*2 of me saying ‘HELLO PROGRAMMERS’

http://www.youtube.com/blazingcloudnet

Footnotes:

*2  You think it’s hard to sort through rotten food with your bare hands so you can feed worms? Try being Depeche mode and writing an awesome love song - mission accomplished - 1981 - ‘Just Can’t Get Enough’ : Key of G

Colophon:

font in images: NuSans Mono Italic

author : 

Curtis wrote this article while concerned that he might be a drone bee - then he remembered how often he is producing something and went back to typing hip lines into his full screen, green and black word processor while dreaming that he brought his headphones so he could listen to the awesome Beirut album he downloaded in the BlazingCloud.net Office. 

Avatar
Avatar

CrashPlan and you

I was looking for a backup solution for my servers. I needed it to not run as root - and to give me the option to not background the process.

Daemontools gives us a nice way to monitor jobs that stay in the foreground.

The instructions on crashplan's support site are on how to connect to the engine on the server.

http://stgsupport.crashplan.com/doku.php/how_to/configure_a_headless_client

I also wanted to have another copy of the application for running on my local machine. I made a copy of the CrashPlan.app on my Mac - the folder was locked - with good reason as /Library/LaunchDaemons/com.crashplan.engine.plist references the directory name. This file is installed so that MacOSX can keep the engine running and bring it back alive if it crashes. ( Like daemontools on gnulinux/unix). After modifying the directory path /Applications/CrashPlan.app to /Applications/CrashPlanLocal.app i restarted the job. # note - the first time i tried this - i installed the LaunchDaemon in my local user# launchctl - I'm glad i can do that - but it would take further configuration to get the# OS X version running that way. I'm not as concerned about a potential backdoor on # my dev machine - on my production machine - i'm glad to be able to run as a non-# privaleged user#sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist CrashPlan is really well written software for the average mac, windows, linux, opensolaris user - It's also delightful to be able to change small things (like the startup script on linux to not fork and the engine port.

Avatar
Avatar

What is with prototype?

You'll find when you start learning javascript that there are a few different ways to encapsulate code. Many different libraries use many different ways to emulate object oriented behavior.

Javascript is a prototype oriented language - which is to say - there is an instance that is created by the new operator - this instance is connected to a constructor attribute (what is invoked by new) and a prototype attribute (the start of a chain of where to look for functions if they do not exist on the current instance).

One of the 'sharp, pointy edges' of javascript has to do with the looseness of the language spec, the myriad ways of implementing javascript pseudo OO programming.

For this reason I am presenting a general survey - as continued with much more care and attention - by douglas crockford. 

Sponsored

You are using an unsupported browser and things might not work as intended. Please make sure you're using the latest version of Chrome, Firefox, Safari, or Edge.