layout: post ref: http://www.quora.com/What-are-some-of-the-most-ingenious-algorithms-in-computer-science categories: Programming
(7) What are some of the most ingenious algorithms in computer science? – Quora
Great collection of CS algorithms.
layout: post ref: http://www.quora.com/What-are-some-of-the-most-ingenious-algorithms-in-computer-science categories: Programming
(7) What are some of the most ingenious algorithms in computer science? – Quora
Great collection of CS algorithms.
layout: post ref: http://www.eamonn.org/blog/ categories: Meta
This is now a beta location new location for my blog. Once I sort out some remaining formatting issues on so of the old articles on the new location, I am going to retire the old location.
I finally decided that WordPress installation on a shared Dreamhost server was just too slow. So I made the leap to the Jekyll platform.
Instead of hacking around in WordPress’ PHP I can now customize my blog in Ruby and Coffeescript. And because the blog is statically served I am hosting it out of S3, giving much faster, scalable performance.
For those that care, you can see the source behind the blog, which started as a template by Kris Brown.
layout: post ref: http://net.tutsplus.com/tutorials/javascript-ajax/getting-started-with-node-js-and-geddy categories: Programming
JavaScript code to make your website comply with the new EU Cookie Law.
layout: post title: Feeling Like JQuery Is Too Bloated? ref: https://web.archive.org/web/20121028233133/http://ender.no.de:80/ categories: Programming
Feeling like JQuery is too bloated? Ender provides an alternative package-manager approach for assembling light-weight JavaScript libraries.
layout: post title: Simple, clean pure-CSS tooltips ref: http://psacake.com/web/jl.asp categories: Programming
Simple, clean pure-CSS tooltips
http://javascript.crockford.com/private.html
Here are two different ways of defining a class in Coffeescript:
class Container
constructor: (@member) ->
secret = 3
dec = ->
if secret > 0
secret -= 1
true
else
false
service : ->
if dec() then @member else null
Container::stamp = (string) ->
@member + string
Container = (param) ->
@member = param
secret = 3
dec = ->
if secret > 0
secret -= 1
true
else
false
@service = ->
if dec() then @member else null
null
Container::stamp = (string) ->
@member + string
Both of these define a class called Container
with
member
initialized by a constructor parametersecret
dec
service
stamp
We can use both in the same way:
myContainer = new Container 'abc'
console.log myContainer.member # abc
console.log myContainer.stamp 'def' # abcdef
console.log myContainer.service() # abc
console.log myContainer.service() # abc
console.log myContainer.service() # abc
console.log myContainer.service() # null
The version above on the left is the special class syntax that Coffeescript provides. However, to me, this extra layer of syntax seems to depart a bit from the “Coffeescript is just JavaScript” philosophy.
The version above on the right is a translation of Douglas Crockford's pattern, using his example.
Which is better? The left is a bit easier to read for a newcomer to the language, but I find the right more elegant because there is less “magic”.
And there is another advantage to the Crockford style. Consider this small modification:
Container = (param, decrementBy) ->
@member = param
secret = 3
dec = ->
if secret > 0
secret -= decrementBy
true
else
false
@service = ->
if dec() then @member else null
null
Container::stamp = (string) ->
@member + string
Here we have generalized the class by adding a decrementBy
parameter to the constructor. We do not copy this to a property, but any of the private or privileged methods in the class can use it. (Don't you love closures!). There is no way to do this using the Coffeescript class
syntax in a way that would prevent the decrementBy value being modified from outside the object.
I think I might switch to using the Crockford-style classes.
One of the really nice things about the sbt build system (for building Scala projects) or the coffeescript compiler is that they have a “watch” mode.
When you invoke a command in that mode (prepending with “~” (tilde) in sbt or adding the “—watch” argument to coffee) they continuously monitor your files and execute the compile or build action as soon as you save one of your source files to disk. Some IDEs, such as Eclipse, have that feature too — saving a file triggers an immediately compile.
But what if you are using an older build system like make, ant, or maven?
Well, if you are working on Linux, you can add this continuous build mode to any build system.
First, install inotify-tools
, which on Ubuntu and similar distributions means doing:
sudo apt-get install inotify-tools
Then, for make, create an executable script called “~make” somewhere in your path with the following contents
#!/bin/sh -x
make $*
while inotifywait -e modify .
do
make $*
done
Now where you would normally type
make something
you can type
~make something
and start editing files. Every time you save a file the make will execute.
For ant, maven, or any other command-line build system, just modify the script to replace make
in the two places it occurs.
date: '2012-01-21 23:01:28' layout: post slug: day-after-occupy-protest-bank-modification status: publish ref: http://www.flickr.com/photos/eob/6740579771/ title: 'Day after Occupy protest: Bank Modification' wordpressid: '3184' categories: Society image: http://farm8.staticflickr.com/7145/67405797712acd3116d1_d.jpg image-text: Bank of America building on Montgomery St, San Francisco
Day after Occupy protest: Bank Modification
Walking down Montgomery Street in San Francisco, the day after an Occupy march, we saw that Bank of America had been subject to some modification.