Zen Coding 175
Download Squad has a quick review, with video, of Zen Coding (Google Code project page here), an extremely well-thought-out accelerator for anyone who codes HTML. Its syntax is CSS-like. Zen Coding has been around for a while — here's its author Sergey Chikuyonok's introduction in Smashing Magazine from last November — and it has now picked up support for more than a dozen editing environments, including Notepad++ and TextMate.
Vim? (Score:3, Informative)
Re:Vim? (Score:5, Informative)
Check the TUTORIAL file in the repo to either turn on by filetype or globally
Re: (Score:3, Informative)
Actually, the official page [google.com] does mention it, under "Unofficial implementations":
Vim (crossplatform) - Sparkup [github.com], Zen Coding for Vim [vim.org]
Re: (Score:3, Informative)
Re: (Score:1, Informative)
there's this one http://www.vim.org/scripts/script.php?script_id=2981 a clone
It has some portability advantages as it doesn't need python support
don't mock the Notepad++ (Score:4, Interesting)
don't mock the Notepad++....it's very powerful, yet lightweight and unbloated.
I'm sure many slashdotters here also live by the "Notepad++ code"....
forgot to mention Notepad++'s line dup (Score:1)
yea...Ctrl-D is very useful.
So is Ctrl-T
Tab and Shift-Tab for formatting.
Also like "nano" but I still prefer N++ since it's got syntax highlighting, support for tab-formatting AND tabs....etc.
Re: (Score:2, Insightful)
GNU nano also has syntax highlighting, http://how-to.wikia.com/wiki/How_to_use_syntax_highlighting_with_the_GNU_nano_text_editor [wikia.com]
Re: (Score:3, Funny)
Re: (Score:1)
BBEdit FTW!
Re: (Score:3, Insightful)
Re: (Score:3, Interesting)
Re: (Score:2, Informative)
emEditor isn't open source let alone a $0 software
Re: (Score:3, Insightful)
Yeah, god forbid someone pay money for software they use and like.
Re:don't mock the Notepad++ (Score:4, Insightful)
Yeah, god forbid someone pay money for software they use and like.
The price and license are important software characteristics whether you like it or not. A non-zero price can make it a practical impossibility to use in many organizations because of the paperwork involved. A license that doesn't allow you to install it where ever you need it, as you need it can also be a problem.
Since their are many free alternatives available in this category it's easily possible that the pay software is more trouble than it's worth even if it is otherwise superior, as the GPP was implicitly pointing out.
---
Like software, intellectual property law is a product of the mind, and can be anything we want it to be. Let's get it right.
Re: (Score:2, Interesting)
A non-zero price can make it a practical impossibility to use in many organizations because of the paperwork involved.
But not always, and definitely isn't at home.
Since their are many free alternatives available in this category it's easily possible that the pay software is more trouble than it's worth even if it is otherwise superior, as the GPP was implicitly pointing out.
And apparently that's not true for the poster who originally mentioned it.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
I've noticed this too. Seems they broke something in the last couple of months.
It's a specialized Lisp REPL (Score:2)
It's a specialized Lisp REPL, or something like it.
Zen (Score:5, Insightful)
Re:Zen (Score:5, Funny)
Is there a better commentary on the west's general inability to grok zen than our endless bastardization of the word, zen?
ZEN is not a ticker symbol on the NYSE yet, so I guess not.
Re: (Score:2)
> ZEN is not a ticker symbol on the NYSE yet, so I guess not.
Not so fast, have you checked with the USPTO?
Re: (Score:3, Funny)
Is there a better commentary on the west's general inability to grok zen than our endless bastardization of the word, zen?
That's so ironic. *ducks*
Re: (Score:3, Informative)
Re: (Score:2, Insightful)
It's mysticism, so it doesn't matter how "serious" you try to be, It's still dressed-up psychobabble in the vein of similar New Age practices. Just because it's old, doesn't mean it should automatically get belief or respect (see also: Christianity, Islam).
Re: (Score:2)
Isn't the only reason it's still mysticism is because there currently isn't enough neurological evidence about what meditation does to the brain?
Re: (Score:2)
Zen is not about study. It's about practice.
Re: (Score:2)
Re: (Score:2)
So what you're saying is, it takes lots of training to convince yourself it's not just a mind game? Kind of like the Trinity, I suppose.
Re: (Score:3, Insightful)
The wise programmer is told about Tao and follows it. The average programmer is told about Tao and searches for it. The foolish programmer is told about Tao and laughs at it.
The master told me (Score:5, Funny)
The master told me to mediate on the sound of one parenthesis closing. I am ashamed that I don't know what this means. Or was that his point.
Re: (Score:2)
The master told me to mediate on the sound of one parenthesis closing. I am ashamed that I don't know what this means. Or was that his point.
The sound of one parenthesis closing depends on which error WAV file does you editor play when it finds no opening parenthesis.
Re: (Score:2)
Mmm, stack underflow.
Sounds like a crispy crackling burning noise.
Re: (Score:2)
The Real Programmer knows it's all a bunch of BS and does whatever it takes to get the job done.
Re: (Score:2, Informative)
Re: (Score:3, Interesting)
Actually, I agreed with you, in having been ignorant about anything but the romantic western views on “zen”. :)
So I read up on the actual philosophies behind it. And now I just as much won’t to come near zen, as I don’t want to come near any other religious insanities. (Please bear with me. Or at least read the points, down there where it’s marked bold. Thank you.
See, the goal of Zen, as far as I see, is so get into a “total zero” state. One that they call “en
So, you don't understand Zen. (Score:3, Insightful)
Re: (Score:2)
Sorry, but its clear to me that you don't really know much about Zen.
Which books did you read? There is a very large conceptual/language barrier that causes many westerners to misinterpret or get confused over what Zen is about.
We can't expect everyone to know about all other concepts in the world, but surely we should know about such limitations and not spread FUD about something we aren't familiar with?
Re: (Score:2)
Too trendy. Bastards will have their way with it and there's nothing you can do.
Re:Zen (Score:4, Interesting)
Oh come on, try to make an effort.
It should be "Zen has nothing to do with spirituality and everything to do with spirituality" or "The student asked about the spirituailty in Zen. 'Lemons', replied the master, and the student was enlightened".
Re: (Score:3, Funny)
Mod parent "+mu, Has Buddha Nature"
The lesser known Zen Coding koans (Score:3, Funny)
such as:
* What is the sound of one interrupt flapping?
* If an exception gets thrown in an operating system, and no one is around to catch it, does it make a sound?
Re:The lesser known Zen Coding koans (Score:4, Funny)
Re: (Score:2)
Re: (Score:2)
"does it make a sound?"
Not on Linux.
Re: (Score:2)
Let's see... (Score:5, Insightful)
Re:Let's see... (Score:5, Insightful)
Please keep your SQL and HTML separate. Don't punish those who will come after you.
Re: (Score:2)
Please keep your SQL and HTML separate. Don't punish those who will come after you.
Now where's the fun in that?
Re:Let's see... (Score:5, Interesting)
Maybe you should make that, please keep your SQL, PHP, JavaScript, CSS and HTML seperate.
Re: (Score:2)
They didn't actually say they were all in the same file.
Re: (Score:3, Insightful)
How do you suggest separating PHP, HTML, and JS? Sure, the bulk of your code - especially reused libraries - should be separate but how do you use them without inline JS? And if you're using PHP, what are you using it for if not writing HTML (with the aforementioned JS)? Your PHP, even if it calls stored procedures, will also have SQL in it - and do you really need a stored proc for every one-shot thing? Repeated code, sure, but... And do you make one-shot CSS classes or blocks for everything?
Half of what y
Re: (Score:3, Informative)
how do you use them without inline JS?
http://en.wikipedia.org/wiki/Unobtrusive_JavaScript [wikipedia.org]
Re: (Score:3, Informative)
It is trivial to have not a singe line of Javascript in your HTML, other than the link to the external Javascript file.
See, for instance, http://api.jquery.com/category/events/ [jquery.com] for a set of jQuery methods for attaching events, using css-like selectors. (Most of these methods are special cases of "bind".)
To avoid mixing HTML and PHP, you can use a templating engine like Smarty (http://www.smarty.net/crashcourse.php). (I prefer those that use a different syntax from regular PHP to help enforce the distinction
Re: (Score:2)
Wow. Ok. I'm a web developer by trade, so let's break this down from lowest hanging fruit on up:
JS: separating JS from HTML is supremely trivial. Rather than enclosing your JS in js code, call out to a source file: . If you doing funky old school coding like using onload, replace that with a good JavaScript library and events (jQuery is my preferred flavor, but they're all good.)
PHP: think of it like this: there are essentially two key actions your PHP is responsible for: getting data and building a display
Re: (Score:2)
And keep your actual content out of any of those. (Or you will be punished with problems with translations and others. :)
I preferred to keep content in custom XML formats individualized for the actual content. But nowadays, I have my own lightweight binary (EBML-like) markup format, which, with a tag mapper information file or block, is just as easy, but (other than XML) very efficient.
Re: (Score:2)
I think you mean "Those who will punish will come after you".
Re: (Score:3, Insightful)
What the hell, why not add another syntax?
To be fair, the syntax is very much like CSS. Further, it's not like it stays in the file for those who come after; it's just that the editor expands things for you.
Re: (Score:2)
Re: (Score:3, Insightful)
So it's kind of like Lisp macros, except that they are expanded in the source to make maintenance both more difficult and less efficient than just starting over from scratch.
If that's your attitude, feel free to go ahead and use Markdown or ASCIIDoc or one of the other markup lanugages that you can compile to HTML.
However, this is something you can use in documents that are already HTML, need to be HTML because that's what your employer or customer demands, etc. without affecting the end result. Saying "let
Re: (Score:2, Insightful)
But again, with the instant feedback when it expands it for you, if that happens you can just hit undo and type it out yourself.
Re: (Score:2)
That’s what TypoScript is for. ;))
You could see them all as domain-specific languages. (Except for HTML and CSS, which are not programming languages at all.)
Semantics: HTML
Aesthetics: CSS
Logic: (3 layers)
JavaScript - UI layer
PHP - back end layer
SQL - data layer
So, in a way it makes sense. (Except for TypoScript, which makes no fucking sense at all [wikipedia.org], since PHP already is a easy template language. [PHP = PHP Hypertext Preprocessor!])
Of course, after 10 years o
Re: (Score:2)
It's not another syntax, it's basically CSS.
zen haikus (Score:1)
Re: (Score:2)
So instead of writing HTML and CSS, you need to know this tool, plus HAML and SASS, and HTML and CSS.
That sure simplifies everything.
Unless you skip the whole "know" part, that is, in which case what you produce shouldn't be unleashed upon others -- you won't be able to troubleshoot it in any meaningful way, for one thing.
Not sheer genius (Score:5, Insightful)
TFA shows how Zen lets you type in a terse message and have it expanded into a chunk of html code and describes it as sheer genius. Thats neat but I have nedit macros which do pretty much the same thing. They are time savers for sure.
But nothing which you couldn't do a thousand ways. With perl, awk or sed.
Re: (Score:2)
I shall, though I don't think its anything new
Nice... oh, maybe not (Score:2, Informative)
Zen Coding? (Score:2, Informative)
I nominate this for all-time... (Score:5, Informative)
...crappiest article ever to get frontpaged on slashdot.
It's a couple hundred words worth of "OMG!" with a code example.
Re:I nominate this for all-time... (Score:5, Funny)
You should save your vote for when its dupe shows up in a couple of days.
Re: (Score:2)
Accelerator (Score:5, Insightful)
I don't think that word means what you think it means.
Re: (Score:2)
I don't think that word means what you think it means.
Actually, it means almost exactly that. [wikipedia.org]
Here's the Emacs version (Score:3, Informative)
Emacs users can find the relevant package here [emacswiki.org] with screenshots and demonstration Youtube video.
Confirmed (Score:1, Funny)
How to program the onboard computer of the Liberator
for those ruby railers (Score:3, Informative)
I recommend sass and haml for doing css and html respectively.
http://haml-lang.com/ [haml-lang.com]
http://sass-lang.com/ [sass-lang.com]
Codes.... HTML... NOTEPAD?! (Score:3, Funny)
Why not go all the way? (Score:2, Interesting)
z0mg zen! As far as I am concerned it's a nice gimmick. If you are going to 'Zen' up your html, why not go all the way and switch to Haml [haml-lang.com]? You actually code in this CSS-like syntax and let Haml compile it to html for you.
It's not called "coding". (Score:2)
Writing source code is called "programming", not "coding". Coding is converting readable text to some sort of encrypted text.
And for the observant reader, yes writing Perl source code can be both called programming and coding.
Writing HTML is not programming (Score:3, Insightful)
HTML is a formatting language, not a programming language
Re: (Score:2)
Erm... right. But then it's still "writing" HTML and not "coding".
No it isn't (Score:2)
Re: (Score:2)
But you didn't define the term "source code", nor make clear that "encrypted text" includes any code that is decipherable by the computer, directly, but may not be immediately decipherable to humans. Perl is hardly unique in it's ability to obscure underlying algorithms. I've seen plenty of obscure C and C++ code, and lets not even begin with assembler...that's encrypted to 99% of humans, by its design.
Programming -- the art of taking concepts and translating them to discreet machine-implementable concept
Re: (Score:2)
You don't "code" HTML (Score:4, Insightful)
You code in java,C++,javascript, but HTML is a formatting language - you do not code in it because it isn't a coding language. I know it makes fluffy web page designers feel like their playing with the big boys to talk about "coding" in HTML but you might was well talk about "coding" .ini files.
Re: (Score:2, Funny)
Re: (Score:2, Interesting)
"Code" is a pretty broad concept. Perhaps you should look at this: http://en.wikipedia.org/wiki/Code [wikipedia.org]
Any asshat can substitute letters for their corresponding number in the alphabet, but does that make it less of a "code"?
No. Sorry but I am not convinced and this merely strikes me the same as when people argue the
Re: (Score:2)
I dunno - you look up a big telephone book of business practices, pick a cryptic utterance that matches your needs and is utterly obscure to everyone else in the industry, then tap it into a telegraphic keyboard - HTML sounds like coding [wikipedia.org] to me!
Mods (Score:2)
I know this is Slashdot, but since when is elitism considered "insight?"
A code is simply a system of rules that you use to translate one form of communication into another form. If that's all you're doing when you're programming, turn in your keyboard now. Writing HTML is coding but it is not programming. Programming is writing a program - a system of instructions which inform the computer how to perform a novel task. HTML is scripting however, even if the script is trivial - it says "Do what this says"
Re: (Score:2)
Programmers don't consider CSS or HTML to be "code. It's markup.
You don't have any assignment or logic in HTML or CSS (unless you're talking about javascript).. therefore, it's not code.
Re: (Score:2)
No, I don't, it's not code.
http://dictionary.reference.com/browse/code [reference.com]
There are no instructions or statements in HTML/CSS. It's not code.
Re: (Score:2)
I'd call it coding, I just wouldn't call it programming. Programming implies imparting methodical logic into something.
What about declarative and functional languages? Would writing a one-line function definition in Haskell or a Prolog rule count as 'programming' by your definition? What about writing a bunch of data blocks in Lua? Or the same ones in JSON or YAML?
Does marking up data magically become 'programming' if you write a loop or do it in an imperative language, or should we focus more on whether it's done cleanly and done right?
Re: (Score:2)
Just because something you have written contains logic-related program code does not mean you have imparted logic into it. Even idiots can write code that works, if you've imparted logic into it, it works properly.
I'd argue that an intelligently crafted bit of HTML with elegantly cascading classes in CSS takes as much art as writing a device driver (and I've done both enough to know how to do either right.)
Think of it as a history lesson (Score:2)
Those who do not learn vi are doomed to reimplement it. Poorly.
Reverse Zen Notation (TM) (Score:2)
The True Path To Enlightenment (TM) lies in using Reverse Zen Notation (TM):
So "div#page>div.logo+ul#navigation>li*5>a" becomes
a>5*li>ul#navigation+div.logo>div#page
Re: (Score:2)
a5*ilnoitagivan#lu+ogol.videgap#vid
Re: (Score:3, Informative)
It's not a format, its just special syntax that you type into your editor that will get expanded to the full regular HTML. It's just there to save you typing, not replace .html files.
Re: (Score:2)
Yeah, but my editor already has auto complete and macros to insert stuff. I've seen our designer at work use this, but as a developer, I wouldn't touch it. I'm generally just jamming stuff into an insert point anyway and let them handle the views.