background preloader

Programming

Facebook Twitter

Primrose: Canvas-based text editor. Try Primrose undefined now! Primrose is a source code editor control that can be used in WebGL/WebVR projects. Use it to experiment with new ideas on productivity UIs in virtual spaces. A live-demo of Primrose is running on the background of this page. Follow the instructions below to use it. Go VR! Hit ESC to exit. Go full-screen hit ESC to exit. WebVR is a growing web standard! MozVR.com The latest in WebVR news. Instructions: Use a one-finger drag or mouse to interact with editor. Primrose undefined: the syntax-highlighting text editor for WebGL Primrose is a cross-browser, syntax-highlighting code editor control for use in WebGL applications. Buy a license$10.00 to use Primrose in closed-source projects. ERROR! Thank you! Your license key is: Please download the Primrose include file and keep your license key in a file named "PRIMROSE_LICENSE" in the same directory in which you keep the Primrose include file. dismiss About Primrose undefined Screenshots Primrose in 3D Primrose in 2D.

Language semantics

Norris Numbers. June 1, 2014 (Russian translation: Числа Норриса в программировании) In 2011 John D. Cook wrote the following blog post: My friend Clift Norris has identified a fundamental constant that I call Norris’ number, the average amount of code an untrained programmer can write before he or she hits a wall. Clift estimates this as 1,500 lines. Beyond that the code becomes so tangled that the author cannot debug or modify it without herculean effort. I don’t know enough novice programmers to confirm this effect, but I had independently noticed the next wall in the programmer’s journey, which happens at 20,000 lines. I ran into the 20,000-line wall repeatedly in my first job out of college, as did my co-workers (who were all as young as I). In mid-1996 I was tasked with writing the DreamWorks lighting tool (with two other programmers) and knew that this would be far larger than 20,000 lines of code.

Edsger Dijkstra wrote in 1969: What’s the key to breaking past that? Mikov's Blog: You Don't Like Google's Go Because You Are Small. When you look at Google's presentations about Go, they are not shy about it. Go is about very smart people at Google solving very BIG problems. They know best. If you don't like Go, then you are small and are solving small problems.

If you were big (or smart), you would surely like it. For example, you might naively think that printing the greater of two numbers should be as simple as std::cout << max(b(),c()) That is because you think small. t1 := b() if t2 := c(); t1 < t2 { t1 = t2 } fmt.Print( t1 ) Isn't it much better? If you wanted to extract an attribute of an optional parameter, you may be used to typing something like: a = p ? Or even: a = p && p->a You just make me sad because obviously what you really want is: a = 0 if p ! It is so much more readable. Collections? If you really, really, are deluded enough to believe you need a different collection, be prepared to remember how you coded in 1987 in C, except you don't have macros, so all typecasts are explicit. Oops, forgot to mention. Where Smalltalk Went Wrong. In a recent post, Christopher Petrilli speculates on why people don't get Smalltalk. This response remains only half-baked, but I'm choosing to let it go anyway.

To quote: Also, it reminds me a bit of what happened when I worked on Zope and the ZODB (Zope Object Database), which contained almost everything originally for the system. People wanted to work on things as though they were files. I think it's wrong to underestimate the problems with Smalltalk's system image and the ZODB. Well, starting from causes, I think Smalltalk's insularity is its greatest flaw.

These could be resolved if someone really wanted to do so (though no group of people seems to want it enough to effect the basic culture of the language in order to break down that insularity of syntax). I'm sure Smalltalk has tools that solve this too. Well, that's a long diatribe. Update: Please read or comment on this post, which I hope will be less misunderstood. The Quick Hack v. Developing Software. I find that I operate in one of two modes when I’m writing software. I’m either approaching a project as a quick hack or as developing software. As much as anything else, this affects how I approach the project and what kinds of results that I get.

When I’m operating under the auspices of the quick hack, everything is moving toward and subordinate to the goal. The end product of the quick hack is everything. I approach the actual hacking in a fit of pique, it’s annoying that this thing isn’t done yet. When I set out to develop software my mindset is different. The natural habitat of a quick hack is a framework. Libraries are what support developing software. Lastly, I worry that time and brainpower that I pour into frameworks goes unrewarded.

I think that it is time that we, as software developers, become responsible for our own fate. A tour of Opa · MLstate/opalang Wiki. A tour of Opa Opa is a full-stack open source web development framework for JavaScript that lets you write secure and scalable web applications. Opa generates standard Node.js/MongoDB applications, natively supports HTML5 and CSS and automates many aspects of modern web application programming: Ajax/Comet client-server communication, event-driven and non-blocking programming models. Opa enables to write full-stack applications: server (backend) programming (running on Node.js),client (frontend) programming (compiled to JavaScript) anddatabase programming (using MongoDB).

Throughout the pages of this manual, we will introduce you to the many features of Opa. Full-stack Opa handles all aspects of web programming: frontend (client code), backend (server code) and database queries are all written in one consistent language and compiled to standards of the web: JavaScript frontend, Node.js backend and MongoDB for the database. The database code can also be written directly in Opa. Easy workflow. A Generation Lost in the Bazaar. The Bike Shed Development Poul-Henning Kamp Thirteen years ago, Eric Raymond's book The Cathedral and the Bazaar (O'Reilly Media, 2001) redefined our vocabulary and all but promised an end to the waterfall model and big software companies, thanks to the new grass-roots open source software development movement.

I found the book thought provoking, but it did not convince me. On the other hand, being deeply involved in open source, I couldn't help but think that it would be nice if he was right. The book I brought to the beach house this summer is also thought provoking, much more so than Raymond's (which it even mentions rather positively): Frederick P. Thirteen years ago also marks the apogee of the dot-com euphoria, where every teenager was a Web programmer and every college dropout had a Web startup. I have not seen any competent analysis of how much bigger the IT industry became during the dot-com years. I updated my laptop.

Modularity and code reuse are, of course, A Good Thing. M. E. Using Uninitialized Memory for Fun and Profit. This is the story of a clever trick that's been around for at least 35 years, in which array values can be left uninitialized and then read during normal operations, yet the code behaves correctly no matter what garbage is sitting in the array. Like the best programming tricks, this one is the right tool for the job in certain situations. The sleaziness of uninitialized data access is offset by performance improvements: some important operations change from linear to constant time. Alfred Aho, John Hopcroft, and Jeffrey Ullman's 1974 book The Design and Analysis of Computer Algorithms hints at the trick in an exercise (Chapter 2, exercise 2.12): Develop a technique to initialize an entry of a matrix to zero the first time it is accessed, thereby eliminating the O(||V||2) time to initialize an adjacency matrix. Jon Bentley's 1986 book Programming Pearls expands on the exercise (Column 1, exercise 8; exercise 9 in the Second Edition): add-member(i): dense[n] = i sparse[i] = n n++

Solving the Mystery of Link Imbalance: A Metastable Failure State at Scale. As we’re building and running systems at Facebook, sometimes we encounter metastable failure states. These are problems that create conditions that prevent their own solutions. In gridlocked traffic, for example, cars that are blocking an intersection keep traffic from moving, but they can’t exit the intersection because they are stuck in traffic. This kind of failure ends only when there is an external intervention like a reduction in load or a complete reboot.

This blog post is about code that caused a tricky metastable failure state in Facebook’s systems, one that defied explanation for more than two years. It is a great example of interesting things that happen only at scale, and how an open and cooperative engineering culture helps us solve hard problems. Aggregated Links Some packets inside a data center traverse several switches to get from one server to another. An aggregated link uses multiple network cables to carry traffic between the same source and destination. The Clue. What is Gradual Typing | Jeremy Siek. Gradual typing is a type system I developed with Walid Taha in 2006 that allows parts of a program to be dynamically typed and other parts to be statically typed. The programmer controls which parts are which by either leaving out type annotations or by adding them in.

This article gives a gentle introduction to gradual typing. The following were our motivations for developing gradual typing: Large software systems are often developed in multiple languages partly because dynamically typed languages are better for some tasks and statically typed languages are better for others. With a gradual type system, the programmer can choose between static and dynamic typing without having to switch to a different language and without having to deal with the pain of language interoperability.

Before describing gradual typing, let’s review dynamic and static type checking. Dynamic type checking A number of popular languages, especially scripting languages, are dynamically typed. Static type checking. Zeroing buffers is insufficient. On Thursday I wrote about the problem of zeroing buffers in an attempt to ensure that sensitive data (e.g., cryptographic keys) which is no longer wanted will not be left behind. I thought I had found a method which was guaranteed to work even with the most vexatiously optimizing C99 compiler, but it turns out that even that method wasn't guaranteed to work. That said, with a combination of tricks, it is certainly possible to make most optimizing compilers zero buffers, simply because they're not smart enough to figure out that they're not required to do so — and some day, when C11 compilers become widespread, the memset_s function will make this easy.

There's just one catch: We've been solving the wrong problem. With a bit of care and a cooperative compiler, we can zero a buffer — but that's not what we need. Now, some parts of the stack are easy to zero (assuming a cooperative compiler): The parts which contain objects which we have declared explicitly. It gets worse. The skyline problem. Programming31 August 2014 You are given a set of rectangles in no particular order. They have varying widths and heights, but their bottom edges are collinear, so that they look like buildings on a skyline. For each rectangle, you’re given the x position of the left edge, the x position of the right edge, and the height. Your task is to draw an outline around the set of rectangles so that you can see what the skyline would look like when silhouetted at night. How shall we proceed? If you’re drawing a blank, it’s always good to get a really awful solution on the table right away so that you have something to think about and improve upon.

The first thing I thought of was to construct a 1-dimensional heightmap. For each rectangle r: for each heightmap cell c starting at r.left and ending at r.right: c gets the max of r.height and the previous value of c OK, so this works as a first attempt at a solution. What now? Here’s a first stab at what the code would look like: Looks good! The poisoned NUL byte, 2014 edition. Posted by Chris Evans, Exploit Writer Underling to Tavis Ormandy Back in this 1998 post to the Bugtraq mailing list, Olaf Kirch outlined an attack he called “The poisoned NUL byte”. It was an off-by-one error leading to writing a NUL byte outside the bounds of the current stack frame. On i386 systems, this would clobber the least significant byte (LSB) of the “saved %ebp”, leading eventually to code execution. Back at the time, people were surprised and horrified that such a minor error and corruption could lead to the compromise of a process.

Fast forward to 2014. Well over a month ago, Tavis Ormandy of Project Zero disclosed a glibc NUL byte off-by-one overwrite into the heap. Inspired by the success of the wargame, I decided to try and exploit a real piece of software. Step 1: Choose a target distribution I decided to develop against Fedora 20, 32-bit edition. Why Fedora and not, say, Ubuntu? If __gconv_max_path_elem_len is even, then the malloc() size will be odd. Step 2: Bypass ASLR. The fundamental problem of programming language package management. Why are there so many goddamn package managers?

They sprawl across both operating systems (apt, yum, pacman, Homebrew) as well as for programming languages (Bundler, Cabal, Composer, CPAN, CRAN, CTAN, EasyInstall, Go Get, Maven, npm, NuGet, OPAM, PEAR, pip, RubyGems, etc etc etc). "It is a truth universally acknowledged that a programming language must be in want of a package manager. " What is the fatal attraction of package management that makes programming language after programming language jump off this cliff?

Why can't we just, you know, reuse an existing package manager? You can probably think of a few reasons why trying to use apt to manage your Ruby gems would end in tears. The fundamental problem is that programming languages package management is decentralized. This decentralization starts with the central premise of a package manager: that is, to install software and libraries that would otherwise not be locally available.

Decentralized systems are hard. Pinned versions. On bananas and string matching algorithms. Blog/why-dependently-typed-programming-will-one-day-rock-your-world.html. Why Dependently Typed Programming Will (One Day) Rock Your World April 26, 2014 — Evan Jenkins You can #timestamp it, folks. I’ve seen the future, and it’s dependently typed. We won’t merely teach the homeless to code. Rather, me and you and everyone we know will have a whole new framework in which to think, learn, and interact with the world. When the day comes to start running software on our brains, we’ll only need to upload one program: a type checker. I know what you’re thinking: he’s totally lost it.

All right, what you’re actually thinking, assuming you’re still reading this, is “what the heck are dependent types, and why is this man getting so unreasonably worked up about them?” Programming languages can be roughly divided into two classes: imperative languages and functional languages. The problem is that like your in-laws, computers are hard to talk to. This is the fundamental flaw with most programming languages, particularly the functional kind. If (bar ! Why is this useful? Gists/gentle-introduction-monad-transformers.md at master · kqr/gists · GitHub.

(7) Are there any programming concepts not yet implemented? What are they? Light Table. SBCL: The Ultimate Assembly Code Breadboard - Paul Khuong mostly on Lisp. I've made a Massive Multiplayer Planetary game in 2 weeks. McSema is Officially Open Source! – ...And You Will Know Us by the Trail of Bits. Pozorvlak | Srelipmoc ni esruoc tsrif a. Regexper. Functional programming - What is referential transparency?

Tigress.cs.arizona.edu. ICPC Problem Archive. Static checking of units in Servo | Mozilla Research. Light Table Blog. 100+ Interesting Data Sets for Statistics. Principles of high performance programs | libtorrent blog. Early Superoptimizer Results. Why bad scientific code beats code following "best practices" 'Most ingenious' marble run science project winner! Bramcohen: Great Programmers. Why Don’t We Have a General-Purpose Tree Editor? | Philip's Perspective. Blind Pair Programming Interviews - Early Experience Report. More shell, less egg. When Should You Think? The-emacs-problem - steveyegge2.

AI, Machine Learning, etc.

Hardware. Wiki Pages - prooftoys - Visual proof assistant based on higher-order logic. Introduction to proofs. Programming With Types, Not Tutorials - School of Haskell. iSICP 1.1 - The Elements of Programming. What's wrong with 2006 programming? Game development. Identity et al (was Re: [E-Lang] Authority -- what is its dual?) Sed - An Introduction and Tutorial. Destroy All Software Screencasts. Places to hack. Graphics / Computer vision. JS / presentation coolness. Languages. Destroy All Software Screencasts.