Chrome missing feature…

I have been using Chrome for long time, before that I used Firefox which is also great browser but in Linux FF has this ugly title bar which can not be hidden. Off curse this is not the only reason why I mainly use Chrome.

Well it is not all so great when you are developing AJAX based sites you need to deal with different file formats like JSON and XML. Most of the browsers have really good XML built in formatting as the XML has been out for really long time, but what we are missing today is the support for JSON formatting.

Here is example of the formatted XML:
XML format in chrome

JSON example without formatting, currently it is readable but when more data needs to be handled makes it complicated to read:
JSON without formatting

At least we have extensions which can save the situation, I liked this extension called . What makes this extension good is that you can easily switch back to raw format.
Screenshot - 06102013 - 12:15:23 PM

Possible encode problems UTF-8

The common problem with fresh projects in php is that, when developing with Windows you sometimes might start programming with notepad. Well the problem arises when saving your work, because the default notepad saves your work in ANSI format. Looking the work in browser you only see strange characters and äüõü will not be displayed. To solve the problem is to save it as UTF-8 and make sure it changes the encoding.

You might see strange characters also by fetching and displaying data from database. To avoid that set the database “DEFAULT CHARACTER SET utf8″ or by setting the value individually for each table. Well I did this, but the problem remains. Also set the MySQLi’s extension charset $mysqli->set_charset(“utf8″).

How does the browser know which encoding to use ? Basically browser parses the DOM tree and looks for meta tag on top with the correct charset like this

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">.

Sublime text 2

59Avastasin antud teksti redaktori juhuslikult ning koheselt sain aru kui hea sellega on tööd teha. Siiani olen küll kasutanud (G)vimi, kuid mõned pisiasjad on härivad ning pole saanud piisavalt head lahendust või puudub oskus neid ära lahendada.

Sublime 2 saab tõmmata leheküljelt http://www.sublimetext.com/2, tegemist pole küll tasuta versiooniga kuid litsentsi ostma ei pea. Litsentsi hind on 59$ mitte ostmise puhul tüütab sind mõni kord salvestamise ajal alert window, et võimalus on osta kuid see pole väga häiriv.

Omadused mis Sublime text 2 huvitavaks teeb:

  • Mahult väike ning kiirelt avanev
  • Autocomplete sõltumata siis programeerimise keelest
  • Pluginate kirjutamine on tehtud lihtsaks(python)
  • Pluginate lisamine on kerge
  • Välimuselt on vaikimisi hea theme valitud
  • Koodi scrollimise jaoks on väike koodi minimap pandud
  • Projektide tugi, jätab meelde näiteks viimati avatud projekti kausta
  • Koodi template tugi
  • Stabiilne ning töötab kiirelt, sama ei saa väita java põhiste editoride või IDEde kohta

Pluginaid on suhteliselt palju ning nende installeerimine on võimalik ka Sublime siseselt(Install packages). Hetkel kasutan ühte pluginat, mis lihtsustab html-i kirjutamist nimega ZenCoding. Lisan pildikese, kuidas Sublime text 2 välja näeb. Kindlasti tasuks proovida seda editori, eelnevalt jäi mainimata et tegemist on cross platform editoriga võibolla asendab Notepad++ Sublime2-ga.