Monthly Archives: May 2014

Use node.js and bower in the IntelliJ IDEA IDE

Here are some clues, how to use node.js and bower in the jIDEA IDE. I need to use it for managing packages in a project for my bachelor thesis. There I use the set up to manage libraries like angularjs, bootstrap and lawnchair.

Nodejs installlation and plugin support in jIDEA

First of all, install node.js – the installer files are provided from their homepage. After that, open jIDEA and go to the settings (IDE Settings -> Plugins) and make sure that “NodeJS” is installed – if not, install it from here:

Install the NodeJS plugin from the settings.

Install the NodeJS plugin from the settings.

Install bower

In my case (Mac OS 10.9.2), node.js was installed to /user/local/bin. Install bower globally by running the following in command line:

/user/local/bin/npm install -g bower

You will maybe require admin/sudo rights to run this command! The output in the command line will show, if the installation was successful.

Use bower package manager in a project

Assuming you already added the project in jIDEA, use the command line and cd the project directory. Simply run

bower init

some questions need to be answered on the command line – after that the bower.json file will be added to the project root. Now you can go back to the IDE and open the settings (Project Settings -> JavaScript -> Bower). Fill out the three required fields “Node interpreter”, “Bower executable” and “bower.json”.

Make the settings for bower in jIDEA.

Make the settings for bower in jIDEA.

Add packages with bower

Since bower is set up for the project, you can easily add packages. From the projects settings you may click the plus, to add a package. After clicking the plus, another window will open showing all the available packages. A great benefit is also the dependency management – if you install a package which depends on another package – the dependency will be installed automatically.

Workaround: Twitter application write access when mobile number is not accepted from the Twitter website

I recently added a Twitter application and I needed it to have write access, so it can use the service to follow users on Twitter. This service requires the application to have write access so I just tried switching to write access from the backend. This changed requires having the mobile number saved in the Twitter account. Since I am living in Bulgaria and my current carrier is Globul, I was not able to add the phone number – I got the message:

Sorry, we don’t have a connection to your mobile provider yet!
Don’t worry, we’re on it and will let you know once things are set up. In the meantime, use one of our long codes. Learn more (https://support.twitter.com/articles/14226-how-to-find-your-twitter-short-code-or-long-code)

There doesn’t seem to be a way to work around this. Several users are talking about that in the forum, another user blogs about it here.

Anyway, there is a workaround for that problem. In order to use this workaround, you need to have a smart phone and install the Twitter mobile application. This workaround works for me in iOS – it also seems to work in Android like people report in the Twitter forum. Like this you will be able to switch to Twitter application write access, although the Twitter websites doesn’t accept your phone number.

After installing the Twitter mobile application, go to the tab on the right, it’s the screen showing your user details. Hit the wheel (it’s shown under the amount of tweets) and click “Settings”.

User screen of the Twitter mobile application

User screen of the Twitter mobile application.

After clicking on “Settings”, another view opens where you have to click on your account.

This view shows the settings of your account in the Twitter application.

This view shows the settings of your account in the Twitter application.

The following view shows the options for your Account – scroll all the way down and click “Security”.

This view shows the account options, on the bottom you can find "Security".

This view shows the account options, on the bottom you can find “Security”.

After hitting the Security option, the application will ask you to add a phone:

This view opens after selecting Security when no phone number was added yet.

This view opens after selecting Security when no phone number was added yet.

After clicking “Add phone”, the mobile browser will open and require you to insert your phone number:

Here you have to insert your phone number and press save.

Here you have to insert your phone number and press save.

After adding the phone number and pressing save, wait a few minutes. Twitter will send you a link to the phone number you just added to verify it. After clicking the link in the SMS the phone number is approved and you should be able to switch the application access to “write”.