Javascript: Using Netbeans

This entry is part 3 of 27 in the series Javascript Tutorial

If you are not ready to purchase a copy of Webstorms from Jetbrains, you can always use Netbeans.

Netbeans has been supporting HTML5 development since version 7.2.

1.  The first thing that you need to do is to download the bundle that support HTML5/Javascript.  Try to download the all bundle version instead.

2.  If you are using Chrome, you need also to download a Netbeans connector.

3.  Netbeans connector provides integration between Netbeans IDE and Google Chrome browser.

4.

netbeansconnector

5. From Chrome, navigate to the link above and click on Add to Chrome.

6. Since you are having a full bundle version, it should support HTML5/Javascript.

7.  Launch Chrome

8.  html51

9.  As shown in the screenshot above, click on HTML5 and HTML5 Application.  Click on Next.

10. After clicking next, you should see the screenshot below.

html52

11.  Simply click on Next.

12.

html53

13.  In the step to select site template, click on No Site Template.

14.  Next, you might not need jQuery now but let’s add jQuery to it.

15.

html55

 

16.  A template with the following screenshot will be created.

17.  html56

 

18.  Now click on the green arrow button to run it.

html57

19.  The Chrome browser will be loaded as shown in the following screenshot.

20.

html58

C++: Constructor in C++ 11

This entry is part 50 of 61 in the series C++

C++ 11 introduces a new syntax for creating the constructor.

Prior to C++ 11, this example in an earlier post shows how we would create a constructor.

#include <iostream>

using namespace std;

// Base class

class Music {
    
private:
    string singer;
    int top10;

public:

    string printOut() {
                
        return this->singer;
    }
    
    Music() : singer("Katy Perry"), top10(10) {};
};

int main(void) {

    Music music;
    
    cout << music.printOut();
    
    return 0;
}

The C++ 11 constructor is shown in line 20.

Notice that there are 2 curly braces {} at the end of the constructor.

constructor1

C++: Assessing private members of the base class

This entry is part 49 of 61 in the series C++

In the previous example, we have used only public members for the base class.

However, there are 3 types of data members for a class, public, private and protected.

If a data member is declared as private, this data member could only be accessible by its member functions.

Consider the following example.

#include <cstdlib>
#include <iostream>

using namespace std;

// Base class

class Music {
    
private:
    string singer;
    string title;

public:

    string printOut() {
        
        this->singer = "Katy Perry";
        
        return this->singer;
    }
};

// Derived class

class Rock : public Music {

public:
    
    string album;
    
};

int main(void) {

    Rock rock;

    cout << rock.printOut();
    
    return 0;
}

Rock is a derived class of Music.  For it to access the private members of the base class, in this case, the singer variable, we have another public method called printOut.

It is through this printOut method that we are able to access the private member singer.

private

C++: Members of a subclass

This entry is part 48 of 61 in the series C++

Here we work out a simple example of a base class and a subclass shown in the example below.

#include <cstdlib>
#include <iostream>
 
using namespace std;
 
// Base class
 
class Music {
 
public:
    string singer;
    string title;
};
 
// Derived class
 
class Rock : public Music {

public:    
    string album;

};
 
int main(void) {
     
    Rock rock;
    
    rock.singer = "Katy Perry";
    cout << rock.singer;
 
    return 0;
}

Rock is a subclass (or derived class) of Music and therefore it inherits all Music members (base class) other than constructors.

An instance of Rock therefore has 3 data members: singer, title and album.

subclass

 

 

 

Intro to Ruby

This entry is part 1 of 2 in the series Ruby

My introduction to Ruby, started off like many others – at a Startup Weekend event. Despite having the best marketing team and a solid business model, there were no developers in my group. It  meant that we could not  actually execute on the technology side of the idea. In fact, of the 50 participants at the event, only 3-4 people knew how to code!

By the end of the weekend, I decided to learn to program. I decided to learn Ruby on Rails, because it was one of the more popular web frameworks for startups.

But what actually is Ruby? This article gives you an introduction into the Ruby programming language and why its so popular at the moment.

 

Enter Yukihiro Matsumoto

Ruby was born 1993. It originated during a discussion between Yukihiro Matsumoto (“Matz”) and a friend, before any code was developed! Matsumoto decided to chose the name “Ruby” because its was the birthstone of one of his colleagues. Ruby is an object-oriented language suitable for writing day to day scripts as well as full-scale applications.

 

Growth

So Ruby has been around for the last 22 years , but in the last few years , it has really taken off because of Ruby on Rails. The Ruby on Rails framework is a brand new framework. Built with the Ruby language by David Heinemeier Hansson and has really changed the way people create web applications today.

 

Around the world software developers really enjoy it.  In fact the Ruby on Rails has a community that’s vibrant and fanatical about developing great code.

 

Philosophy

What I love about this programming language is the philosophy behind it , in a interview in Matsumoto did in 2003 he told the interviewer he wanted to invent a language that made him productive while being fun to use!

 

For me this is a breath for fresh air, many times we spend many hours in front of the screen , especially in the business world, trying to build the next big thing, but sometimes we have to look at the big picture in life – is this enjoyable and fun?  For me it is!

Later on in the Interview Matsumoto is says  that instead of focussing on machines all the time, trying to make them faster and more efficiently, we should focus on humans. At the end of the day , we are the master the computers are the slaves , but I think this is changing, we are becoming the slaves and machines are becoming the masters!

 

Ruby Success Stories

 

Here are few samples of the real world usage of Ruby

Basecamp, a web-based project management application developed by 37signals, is programmed entirely in Ruby.

43 Things allows you to keep a list of goals and share it with the world. It was developed entirely in Ruby.

A List Apart, a magazine for people who make websites that has been around since 1997, has recently been revamped and uses a custom application built with Ruby on Rails.

 

Final Thoughts

Matz wanted a programming language that suited his needs, so he built one. This is a great story of software development.

For me Ruby is a great language to learn. Nobody can predict the future of the Ruby or another programming language, but in my opinion it will grow because of the amazing community and people I have met. With more and more people making Ruby applications the future is definitely bright !

I shall leave the last word with matz when the interviewer asked why Ruby made him happy

You want to enjoy life, don’t you? If you get your job done quickly and your job is fun, that’s good isn’t it? That’s the purpose of life, partly. Your life is better

 

Regards

Neil Patel

Ruby on Rails Coder & Marketer

www.neilpatel.co

@neilp666