Zen Coding: A Speedy Way To Write HTML/CSS Code

In this post we present a new speedy way of writing HTML code using CSS-like selector syntax — a handy set of tools for high-speed HTML and CSS coding. It was developed by our author Sergey Chikuyonok and released for Smashing Magazine and its readers.

How much time do you spend writing HTML code: all of those tags, attributes, quotes, braces, etc. You have it easier if your editor of choice has code-completion capabilities, but you still do a lot of typing.

We had the same problem in JavaScript world when we wanted to access a specific element on a Web page. We had to write a lot of code, which became really hard to support and reuse. And then JavaScript frameworks came along, which introduced CSS selector engines. Now, you can use simple CSS expressions to access DOM elements, which is pretty cool.

But what if you could use CSS selectors not just to style and access elements, but to generate code? For example, what if you could write this…

div#content>h1+p

…and see this as the output?

<div id="content">
<h1></h1>
<p></p>
</div>

Today, we’ll introduce you to Zen Coding, a set of tools for high-speed HTML and CSS coding. Originally proposed by Vadim Makeev (article in Russian) back in April 2009, it has been developed by yours truly (i.e. me) for the last few months and has finally reached a mature state. Zen Coding consists of two core components: an abbreviation expander (abbreviations are CSS-like selectors) and context-independent HTML-pair tag matcher. Watch this demo video to see what they can do for you.

source:

http://coding.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/

Naming Convension CakePHP

Naming Convension CakePHP « To ~ reizen.

Setelah postingan sebelumnya membahas tentang Tutorial dasar cakePHP dan Penggunaan fungsi Bake, thread kali ini akan mencoba membahas tentang Naming Convension Using CakePhp atau tata acara penamaan didalam CakePHP. Didalam CakePHP, penamaan memegang peranan yang penting dan strict/ketat sekali. Dan aturan tersebut harus dipenuhi. Beberapa aturan tersebut, akan saya coba rangkum seperti dibawah ini :

Database & Table
Beberapa aturan penamaan didalam cakephp untuk database & table, yaitu :
a. Nama table sebaiknya dalam bahasa inggris.
b. Nama dari table harus menggunakan kata jamak (plural) dengan suffix s/es.
c. Jika nama table terdiri dari 2 (dua) nama maka harus menggunakan karakter ‘_’ contohnya: customers, books, authors, line_items.
d. Jika menggunakan join table, maka penamaannya berdasarkan alphabetical order dengan karakter ‘_’ sebagai pemisah. Contohnya: authors_books; bukan books_authors.
e. Tiap table harus memiliki field id sebagai primary key-nya.
f. Tiap table memiliki field created dan updated (Optional). Field ini optional, yang tidak akan mengganggu kinerja dari CakePHP jika field tersebut tidak dibuat. Jika field-field tersebut tersedia di dalam table, maka CakePHP akan mengisinya secara otomatis setiap kali ada operasi create atau update.

Model
Beberapa aturan penamaan didalam cakephp untuk Models, yaitu :
a. Ekstensi file berupa *.php
b. Nama class didalam model harus diberi nama dengan format tunggal/single, CamelCased dan disarankan sama dengan nama tabel yang dikelolanya agar mendapatkan automagic loading variable, function dan sebagainya. Contoh : Blog (nama tabel blogs), Shoe (nama tabel shoes).

View
Beberapa aturan penamaan didalam cakephp untuk Views, yaitu :
a. Ekstensi file berupa *.ctp.
b. Untuk view, file-filenya diletakkan di dalam folder tersendiri sesuai nama controller-nya. Misalkan, posts untuk PostsController. Sedangkan nama file-filenya sesuai nama action (function) yang didefinisikan di controller yang bersangkutan.

Controller
Beberapa aturan penamaan didalam cakephp untuk Controller, yaitu :
a. Ekstensi file berupa *.php
b. Nama class didalam controller harus diberi nama dengan format jamak/plural (diakhiri dengan s/es), CamelCased dan adanya suffix (akhiran) Controller. Contoh : BooksController, NewStudentsController.
c. Nama file harus menggunakan huruf kecil.
d. Nama file mengikuti nama controller dan dipisahkan garis bawah antar katanya. Contoh : books_controller, new_students_controller.

By Tamas Amon (sajt)

This is the Cake Conventions from the old wiki site.
  1. tables names are plural and lowercased
  2. model names singular and CamelCased: ModelName
  3. model filenames are singular and underscored: model_name.php
  4. controller names are plural and CamelCased with *Controller* appended: ControllerNamesController
  5. controller filenames are plural and underscored with *controller* appended: controller_names_controller.php
  6. associations should use the ModelName, and the order should match the order of the foreignKeys: var $belongsTo = ‘User’;
  7. foreign keys should always be: table_name_in_singular_form_id: user_id (foreign key) -> users (table)
  8. many-to-many join tables should be named: alphabetically_first_table_plural_alphabetically_second_table_plural ie: tags_users
  9. columns in many-to-many join tables should be named like other foreign keys ie: tag_id and user_id
  10. columns named created and modified will automatically be populated correctly
  11. components should be CamelCased: MyComponent : my_component.php : var $components = array(‘MyComponent’); $this->MyComponent->method();
  12. helpers should be CamelCased: MyHelper: my_helper.php: var $helpers = array(‘MyHelper’); $myHelper->method();