layout: post title: Simple, clean pure-CSS tooltips ref: http://psacake.com/web/jl.asp categories: Programming
Simple, clean pure-CSS tooltips
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 parametersecretdecservicestampWe 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.
If your users are also your customers, then you are lucky. It makes a lot of design and marketing decisions a lot simpler. You can focus laser-like on providing features that your users are willing to pay for.
However the user is not always the customer. For example, if you are selling software to a large enterprise then the person making the buying decision is not the user, which is why so much software used internally in large companies is so crappy.
And many of you working in the consumer Internet space have the same business model that broadcast television has had for more than half a century: give the service for free to users and get money from advertisers. To be successful you need to simultaneously keep your users (consumers) happy while keeping your customers (advertisers) willing to pay you. This is often hard.
date: '2011-06-19 15:48:26' layout: post slug: rest-nosql-capability-security-unified-document-creation-data-model status: publish ref: http://www.slideshare.net/eobrain/book-widget-embedding-automated-photodocument-publication-on-the-web-and-in-mobile-devices title: 'REST, noSQL, Capability Security, and a Unified Document-Creation Data Model ' wordpress_id: '1213' categories: Programming
View more presentations from Eamonn O'Brien-Strain
This is a presentation I gave earlier this year at the Electronic Imaging conference. There are more details in the paper that went along with the presentation.
date: '2011-03-21 20:41:09' layout: post slug: '1178' status: publish ref: http://www.flickr.com/photos/eob/5537982085/ title: Social Photo Sharing Sessions at SXSW wordpressid: '1178' categories: Product image: http://farm6.static.flickr.com/5214/5537982085fd89cf913c.jpg image-text: SWSW Panel DIscussion
Promiscuity or Private Groups: Mobile Photo Sharing
There were two different sessions at SXSW covering social photo sharing, one a panel and the other a round-table discussion group.
The panel, Photo Sharing – Promiscuity or Private Groups, featured Mayank Mehta from Cooliris the gee-whizz photo browsing company (who have recently added a social photo sharing) and Danny Trinh from Path, the social network that emphasizes private sharing among a select group of real friends. Also on the panel was the blogger Louis Gray who moderated.
The panel noted that online photo activity has moved away from the older services, typified by Shutterfly where people actively upload selected photos from their PC, to the newer services that receive photos automatically uploaded from mobile devices.
On interesting “minus 30 seconds” problem statement they posed how to decide the intent the photographer had when they took out their phone to shoot the photo just before the phone uploaded it. With whom did they intend sharing that photo? A simple approach is to have the user explicitly share with a particular group of social contacts, using the group context to control sharing.
The panel seemed to agree that social validation is the main reason that people post updates or share photos. If they at some point stop getting validated (are not getting many likes, comments, or retweets) they tend to stop sharing.
Finally there was a discussion on how startups could be successful in the age of Facebook. One opinion from the panel was that Facebook is simply a communication channel, and there are many ways to co-exist with it. The important thing was to concentrate on just one thing and to do it well. As for monetization, panelists advised having a paid premium level as well as having app-like things such as Instagram-like lenses sold individually.
Later, in the other session, a round table discussion, called Focusing In On the Future of Social Photography, one particularly interesting participant was Sam Odio head of Facebook Photos, who came in when Facebook acquired Divvyshot to “fix Facebook Photos”. The Facebook photo volume is huge—people upload a Flickr's worth of photographs every month —however Facebook considers that the cost of storing all those photos is more than outweighed by their value to Facebook. According to Odio, the main role of Facebook Photos is to “help users tell stories”, which mostly means providing context.
Instagram was a service that came up a lot in both sessions. There is a lot of buzz around this company because they have had such remarkably high adoption rates. They are an app with software “lenses” that apply effects to photos, which according to the Trinh makes people more willing to share photos because otherwise “most people think they take bad photos”. Instagram also has social networking features that people seem to like a lot. Trinh noted that Path have recently added lenses to their service.
Yan-David Erlich, the moderator of the round-table, said that in their service the most popular pages are the “places”. He also mentioned that concert venues are experimenting with social photography.
In response to a question on face recognition, Odio implied that Facebook do have such technology but that they are wary of deploying it. He said they have a whole team of people responsible for just thinking about the legal and social implications of face recognition.
As regards videos, people share them much less often than they share photos. One reason is that videos are still much more difficult to share online, though this is likely to change in the next few years. Another reason is that although an unskilled person can snap a halfway decent photo with today's devices, it is very difficult for them to shoot a decent looking video.
date: '2011-03-21 17:10:52' layout: post slug: minimalism-is-good-programming-lessons-from-music-and-writing status: publish ref: http://www.flickr.com/photos/eob/5538121276/ title: 'Minimalism is good: programming lessons from music and writing' wordpressid: '1169' categories: Programming image: http://farm6.static.flickr.com/5291/5538121276be254ebb1b.jpg image-text: Jon Dahl
Programming and Minimalism: Lessons from Orwell & The Clash
In his SXSW talk Programming and Minimalism: Lessons from Orwell & The Clash, Jon Dahl from Zencoder asked what other activity is programming like. He acknowledged that it was valid to think of programming being an engineering discipline and valid to think of it as being a craft, but he mostly proposed that programming is like writing, in particular that programming is like writing musical composition.
One analogy he made was of how styles of programming evolve in the same way as styles of musical composition. Music styles tend to get more and more complex over time until some new composers create a new radically simplified style, though keeping the best of the earlier style. Witness Mozart rejecting the Baroque, Phillip Glass rejecting complex early Twentieth century classical music, and the punk rockers rejecting the preening intellectualized operatic rock of the '70s.
Similarly in programming there are similar lurches back to minimalism in programming languages and in frameworks. Dahl did not explicitly talk about this, but I assume he meant the rise of Ruby on Rails and later similar systems which rejected the complex configurations and layering of both J2EE and Microsoft web stacks and replaced them with an elegantly simple framework that emphasized convention over configuration and “don't repeat yourself”. I would also add the earlier eclipsing of C++ by Java is an example of a similar return to simplicity, rejecting pointers, multiple inheritance, and explicit memory management. The speaker also made a foray into the realm of writing prose. He quoted George Orwell who asserted that sloppy writing leads to sloppy thinking, such as how using the passive voice avoids being clear who is responsible for some action. Sometimes writing is deliberately sloppy, such as giving a law the misleading title “The Patriot Act” and not something like “The Enhanced Surveillance and Executive Powers Act”, which would have been more accurate but less likely to get passed by Congress.
All of this was entertaining, but seemed a bit of a stretch in its analogies to programming. I felt it was stroking the egos of programmers a bit, allowing them to see themselves not as code monkeys but as exalted artists. However, he did end up with a list of coding guidelines that I already generally do follow and which I think all programmers should consider:
Programming and Minimalism: Lessons from Orwell and the Clash
View more presentations from Jonathan Dahl
date: '2011-03-21 11:19:19' layout: post slug: what-levels-of-radiation-you-should-worry-about status: publish ref: http://xkcd.com/radiation/ title: What levels of radiation you should worry about wordpress_id: '1162' categories: Science
There has been a lot of irresponsible reporting of the possible dangers from the damaged Japanese nuclear reactors. Even the New York Times was guilty of providing an interactive presentation that gave a misleading impression that the U.S. West Coast was in danger.
Here is one piece of sanity that I urge you to study if you have any concerns about your risks from radiation.
(Thanks to Bob Mayo for the pointer.)
date: '2011-02-19 16:41:49' layout: post slug: blogpost-02202011-a-m status: publish title: This is a nice solution for creating live HTML pages by “welding” JSON data onto HTML prototypes. wordpress_id: '1131' categories: Programming image: img/weld.webp image-text: Weld.js logo
This is a nice solution for creating live HTML pages by “welding” JSON data onto HTML prototypes. If this works as the authors claim it could make it easier for graphic designers and web developers to work together. tags: javascript json web design library programming