Using Disqus without any plugins

At TurnGeek we recently had the task to include Disqus (which is great by the way) into our site, so readers of our books can leave comments for each chapter.

For a couple of reasons we couldn’t use their WordPress plugin although the site is running on WordPress. If you’re running in the same issue or you just don’t want the dependency of another plugin, you can paste the following snippet in your WordPress posts (by the way, this also works with non WordPress sites):

Using the data-name attribute you have to set the shortname you’re using on Disqus. This means you have to replace my_disqus_shortname with this shortname, in our case it is turngeekpress, so our snippet looks like this:

Have fun using this and let me know your thoughts.

Cloud Tutorial – Java EE

If you know standard Java and want to quickly learn something more about the core components of the Java Enterprise Edition (Servlets, JSP, JSF, CDI and EJB), you should have a look at this new tutorial I have written with Martin called Cloud Tutorial – Java EE.
We call it a cloud tutorial, because you learn everything step by step using an Online IDE. That way you don’t have to struggle with any software configuration and you can directly start learning.
You can work yourself in one day through the tutorial – if you now a quicker way to learn that much about Java EE, let us know. Happy coding!

Proxy Your Requests With Grunt

Probably you’re already using grunt to serve your local frontend code. Everything is fine, but if you’re developing your backend with something different than JavaScript (Being a Java developer I heard that might happen), you will have problems accessing this backend while running grunt server.
With grunt-connect-proxy there exists a grunt module to help you out. It basically delegates requests that match a given URL to a different backend of your choice. Unfortunately I found it rather difficult to configure, if you are unaware of the connect middleware concept.

Basically you just need to add two things to your Gruntfile.js file:

Firstly add the connect server configuration to your config JSON inside of grunt.initConfig. This example delegates all requests to http://localhost:8000/services to http://localhost:8090/services – keep in mind the grunt server is running on port 8000 and the backend on port 8090:

Secondly register your grunt server task:

then you can call your grunt server with the configured proxy via :
grunt server
from the command line.


Restart a ExtJS 4.2 Application by recreating the Viewport

If you are debugging your ExtJS application, it could be helpful from time to time to restart the application. Sure, simply pressing F5 usually does the trick, but it might happen that you want to keep the state of the application and just restart the viewport.

This is simply done by typing the following lines in your favorite JavaScript console:

  1. Remove existing viewport with a ComponentQuery
  2. Recreate viewport, here the viewport’s class name is myApp.myClass


Using Codenvy (Online IDE) to run Ext JS 4.2.1 Samples

Reader’s of my blog (are there any?) know I love JSFiddle. With it you can easily embed a running example of your JavaScript snippet. This is fine for single-file examples but it gets a bit complicated for more complex ones.
To showcase them, Codenvy is a very nice solution. It is an Online IDE that has a very nice feature called Codenvy Factory. This one lets you share the actual state of your workspace by distributing a simple link. People clicking on the click will get a copy of your workspace and can work in their own sandbox. No worries, the original workspace is not touched, so it is ideal for teaching purposes.
To demonstrate its versatility, I just made a workspace containing all ExtJS 4.2.1 examples for you to play around with.

Just click the link below and you can run all ExtJS examples and edit them as you wish online. And you even don’t have to sign up or login:

If you encounter any problems running the examples, please let me know – I already did some modifications to the original, so they are running under Codenvy.