JS Lint in Sublime Text 2

Ahhhh, Javascript. A great language, often misunderstood and misused on the web. You might not have a clue what you’re doing if you’re a beginner because almost everything you type can be interpreted in a way that is completely different than what you intended—that flexibility can also be an somewhat of an advantage.

I ‘m a big fan of JS Lint and as a front end web developer I need a linter to help me validate and maintain my code quality against best practices so I can use the language the way it was intended to use, and maintain form. When it comes to editors I use the popluar Sublime Text 2 as my default editor (as many web developers do these days).  Luckily integrating JS Lint by Crockford in Sublime Text 2 is a breeze.

Just follow the steps below:

Sublime Text 2

  • Obviously, you need to install Sublime Text 2. It’s lightweight, cross platform and performs like an athlete on steroids-blazing fast.
  • Using the console, install Sublime Package Control. Paste in the following commands:

While the package is installing you should see installing [ = ] loader on the bottom left. Then all you have to do is to restart Sublime Text 2.

  • Next. Goto: Projects > Package Control > Install Packages and type in “JS Lint”. You’ll immediately see a list of packages you can install. You’ll also notice that another version js lint with node.js. You may also prefer JS Hint. To get to package control in your Mac: CMD + Shift + P ==> Win, Linux users: try these shortcuts
  • Your last step is to get JS Lint to work after you save any javascript file. Go to Preferences > Package Settings > JSLint > Settings > User Then paste in the following commands:

Now on save you should have your linter below where the console pops up:

Sublime Text 2

If you run into problems with the console you can perform manual steps to install package control. Of course for the curious there is are a slew of packages / plugins out there, so go ahead and enjoy playing around with this lovely text editor.

How Javascript Got it’s Name

Netscape LogoSitting with a friend the other day and I was talking to him about Javascript and how’s it’s become the language of the web. I mentioned it’s use outside of the web in PDF documents and desktop widgets, that it was one of the most popular programming languages (often referred to as the language of amateurs). It’s a fact that virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use. Of course that’s because of the technology that’s used in our browsers.

After the aforementioned the first thing he said is that Javascript was a form of Java developed by Sun Microsystems. I tried telling him that it’s actually despite it’s prefix [Java] it’s a completely different programming language and has nothing to do with Java. Java is Java and Javascript (or LiveScript, ECMAScript, MochaScript) was seen in releases of Netscape Navigator 2.

The Wikipedia states it best:

Developed under the name Mocha, LiveScript was the official name for the language when it first shipped in beta releases of Netscape Navigator 2.0 in September 1995, but it was renamed JavaScript[9] when it was deployed in the Netscape browser version 2.0B3.[10]

The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. The final choice of name caused confusion, giving the impression that the language was a spin-off of the Java programming language, and the choice has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web programming language. It has also been claimed that the language’s name is the result of a co-marketing deal between Netscape and Sun, in exchange for Netscape bundling Sun’s Java runtime with its then-dominant browser.

Essentially the renaming came from the Netscape marketing department with no technical basis. Javascript has design errors, but it’s dynamic, Object Orientated and has objects, methods, constructors and supports aggregation and inheritance. Unfortunately it’s a very misunderstood language.

Supercharged Javascript Resources


Super Javascript Resources

Some say the path to mastery requires 10,000 woman hours to achieve. A constant focused learning for days, months and years to finally become a master can be a daunting task. For me the path to mastery starts with the first steps:

  • *Self Inspiration: A willingness to learn through self inspiration and sticking with it. That will automatically equal longevity.
  • Awareness: Awareness of the tools at your fingertips. You just have to look and develop a sense of curiosity.
  • Fundamentals: Understanding basic concepts at their very core. Better yet a deep understanding and knowledge of how things work with the realm of what you want to learn.
  • Practice: Lot’s of practice even when what you feel that everything is going over your head at times. Give your brain time to digest things. If you don’t understand a method or technique make sure you re-visit it after taking a short break.  Don’t give up after seeing the first signs of trouble. Welcome them and cross the dip.

This post is hardly about learning techniques and methods, there are many out there to choose from. Learning begins with taking the first step, instructing yourself and diving in. The above is Part I of useful resources that you’ll find for Javascript including: tools, frameworks, blogs, slides, presentations plugins. I suggest you familiarize yourself with them and add them to your bookmarks if you’re a budding javascript ninja. You can always store them in a session (Chrome, Firefox)  for later reference.

Corruptissima Re Publica Plurimae Leges — Aaron Swartz

Translation: Many are the laws where the State is corrupt. Tacitus.

We’ve all heard the sad story of young Aaron Swartz who committed suicide. Surprisingly I’ve spoken to some younger folk here in Karachi and they have no idea about who he was and how much he contributed to the betterment of our society online.

He was a talented young man that stood for many ideals that we should all support. A brilliant mind. A hero. He was  a rebel, a political activist, a programmer and campaigner that wasn’t fit for corporate life.

There are countless articles on the inter webs. Read one on how the government prosecuted him and lock him up for 35 years.

I did not know Aaron, but I think about him and his courageous efforts to share with the public what he thought was our right-without having to pay for it and sadness overwhelms me. The world needs more like him and within that thought I’d just to share his memory here on my blog. For those who don’t know who he was and what he stood for let’s remember him best by some of his work.

  • Developed a new version of RSS feeds in 2014.
  • Was part of the team that launched Creative Commons.
  • Worked with Tim Berners Lee on enhancing the internet through Semantic Web.
  • Co-founded Demand Progress.
  • Authored the Guerilla Open Manifesto.
  • Obtained the complete bibliographic data for books held by the Library of Congress and posted it in the Open Library.
  • Retrieved 4.8m documents from JSTOR.
  • Countless others if you decide to read up on it.

Aaron, you’re a warm, sensitive, intelligent, passionate young man full of courage and determination. You’re my hero and you will be missed….

Ubuntu For Smartphones

Extremely exciting news, it’s finally upon us. Canonical will be releasing Ubuntu for the smartphone. I’ve seen videos of Ubuntu running on the Galaxy Nexus and the adapted version of the UI for mobiles looks nothing short of fantastic. Everything is at your fingertips as Ubuntu uses natural swiping gestures from the edges of your screen-a touch feature I particularly loved.

Just imagining Unity (a touch ready environment that integrates your apps and workflow) with it’s set of features on my phone is like a wet dream come true.

It brings out the total geek in me, in all of us when using the world’s most favorite Linux distribution.

Ubuntu has taken OEMs, ODMs and network operators in mind by bringing great performance and opening new opportunities for PC convergence. OEMS and operators can also customize their services, content and apps and brand them at their will. For me the most important experience will be that all core applications run at full native speeds with small memory footprints. Performance will be optimal as UI and elements will work fluidly and respond extremely well to the gestures you bring them.

Some of those gestures include:

A short swipe from the left edge of the screen is all it takes to reveal your favourite apps.

A full left-to-right swipe reveals a screen showing all your open apps, while a swipe from the right brings you instantly to the last app you were using.

A swipe from the right edge takes you back to the last app you were using; another swipe takes you back to the app you used before that. It’s natural to keep many apps open at once, which is why Ubuntu was designed for multi-tasking. No other smartphone lets you switch between applications this quickly.

Swiping up from the bottom edge of the phone reveals app controls. You can hide or reveal them instantly, which means they don’t take up room on the screen, leaving you free to focus on the stuff
that matters.

Update. Gruber’s take on the interface, gestures and performance. “Laggy as hell”

Looks OK aesthetically, but the purely swipe-and-gesture based UI is a loser. It’s confusing. Swipe from the right takes you to the next most recently used app, but swipe from the left does something completely different (show a list of favorite apps). I’ve said before: gestures are the touchscreen equivalent of keyboard shortcuts: a convenient alternative, but almost never a good choice for the primary interface for a task. Ubuntu has designed a phone interface consisting entirely of gestures; it’s like a desktop interface with nothing but keyboard shortcuts.

I expect Ubuntu for Phones to be about as relevant as Ubuntu is on the desktop. Vlad Savov at The Verge has hands-on video of the system as it stands today, and — shocker — it’s laggy as hell.

Here’s what The Verge has to say:

There’s a bit of lag while swiping through the phone’s different panels, but overall it looks to be quite the attractive and intelligent interface.
All in all, it’s an attractive-looking OS, and Galaxy Nexus users should be able to flash the Ubuntu phone OS images to install for users soon. However, the first real shipping devices won’t be available until early 2014.

There is more (especially on apps), if you’d like to read the fine print. I’ve compiled some links for the savvy user or developer that might help you learn more about this fantastic ecosystem.

EXTRAS:

Learning:
Go Mobile For the Developer – Learn about QML, native and HTML5 apps.
Go Mobile for the Savvy User – Learn more about the wonderful world of Ubuntu on your smartphone.
Ubuntu for Android –  A superphone that is also a PC.

Specs:
Entry level Ubuntu smartphone – 1Ghz Cortex A9
High-end Ubuntu “superphone” – Quad-core A9 or Intel Atom

 

Whether you’re an individual or business that wants to dock your phone to become a full PC or thin client, Ubuntu is a choice for you. In the years to come we’ll see one of our favorite operating systems not only on smartphones but other handhelds such as tablets as well.

 

I’ll be very interested in seeing this live and in the wild, we definitely need to see more mobile Os’s. The ability to dock the phone and turn it into a full fledged desktop is a wonderful idea, plus the mobile version looks intuitive, fluid and user friendly. If the mobile OS does well and proves itself, it would generate a massive increase in Ubuntu destop users around the world. All in all a great move for Ubuntu :-)