Yoga Can Improve Your State Of Mind & Body

More and more people are turning to Yoga as one of the best ways to keep themselves looking and feeling great. In Manhattan, yoga studios are available in every neighborhood from the Upper West Side to the Lower East Side. No matter where you are in New York City, yoga is just right around the corner. You can find personalized and attentive service, group classes, and even one on one sessions if you prefer. In some cases a Manhattan yoga instructors can even come to your home for a private session. People participate in yoga for several reasons. While it is hard to sum up the myriad of benefits one can gain from doing yoga, here are the more commonly derived benefits Manhattan residents mention when asked why they love to do yoga!

Special breathing techniques are used in yoga to teach people to time their breaths to flow smoothly. This improves endurance and leads to intense relaxation. Over time and continuous practice of yoga breathing techniques, you will become more relaxed, leading to the release of stress and an overall sense of calmness. This alone may be the single most important reason for Manhattan residents to practice yoga!

Make no mistake, yoga is challenging. At the same time, it is very rewarding and a great way to exercise without adding stress on your joints. Performing yoga for an extended period of time will improve your posture, help you tone up, and help with overall calorie burn. This can be accomplished in a few minutes of devotion each day. Losing weight naturally means you have a better chance of maintaining this new healthy weight once youRve reached your goal. Flexibility is also greatly increased through yoga, while decreasing the risk of injury. Yoga postures require using all parts of the body and stretching them, offering this great flexibility.

You’ve probably heard other yogis mention that yoga Manhattan is good for your health. Past studies have shown that yoga Manhattan offers a great deal of health benefits. Some of the most commonly mentioned are lower back pain relief, lower blood pressure, regulating asthma, and even a great way to maintain a healthy weight. Those who practice yoga are also shown to have an increase in energy throughout the day.

As touched on before, yoga can have a positive affect for oneRs state of mind. Yoga has many spiritual benefits. Practicing yoga can offer mental clarity and stability. It helps you to think clearer so you can make better decisions. Yoga has also shown to improve serotonin levels in the brain, resulting in a decrease in depression, helping one make better decisions while having a more postive outlook and image of themselves.

Hospitals in Delhi Offering World-Class Treatments

Are you considering having a knee replacement? But still have many questions? Here, you can find answers to all your doubts. Knee surgery is the most common type of surgery. Many people suffer from arthritis but do not know what is the right time to have a knee replacement surgery is. Moreover, there is also confusion about what to expect from a knee surgery. You can find all your answers here in this article. Arthritis is the inflammation of the joints whereas many people think that it is the wearing away of the cartilage in a joint, which is actually the end result of inflammation within the joint. Inflammation can lead to cartilage loss and exposed bone, instead of a smooth joint surface. During knee replacement surgery, affected knee surfaces are replaced with an artificial metal and plastic joint (called prosthesis). Plus, a knee replacement improves your overall quality of life and dramatically reduces the pain.

Delhi has always been an attraction for many things. Many people visit Delhi for travelling and some section of the people visit Delhi to avail world class treatment and healthcare facilities available in the city. One can see a large number of international patients coming to India for availing medical facilities, since India is a country that lays emphasis on English education, most of the hospitals in Delhi are backed with English speaking staff. Hospitals in Delhi have all the basic amenities and are considered one of the topmost hospitals in Asia. AIIMS, Escorts, Max Super Speciality Hospitals, Medanta, Fortis and ISIC. Doctors and surgeons in these hospitals provide comprehensive and super speciality services to every patient. Plastic surgery in India is also one of the treatments which are gaining momentum day by day. Available at an affordable cost, it is offered by experienced and skilled surgeons combined with state-of-the-art facilities. Plastic Surgeon India India are qualified and offer safe successful outcomes with fewer complications in the surgery.

Occupational therapy has gained much popularity in recent years owing to its long lasting effect and various advantages. Occupational therapy can help you with your aches and pains in a way that you may have not thought to be possible. This kind of therapy helps in relieving tense muscles and help in free blood circulation which eases pain and tension. Moreover, occupational therapy makes use of a number of hands-on techniques like soft tissue massage and myofascial release to restore muscle movement and provide easy mobility.

ISIC is the most advanced spinal Hospitals in India. ISIC is a Hospitals in Delhi and it is best in Occupational Therapy, it is also considered a training institute and teaching hospital affiliated to a leading university of the country.

Related Articles – Knee Replacement, Hospitals in Delhi, Plastic Surgeon India, Occupational Therapy,

Email this Article to a Friend!

Receive Articles like this one direct to your email box!
Subscribe for free today!

Watch your child climb the ladder of success with Heritage Education Funds

It is the survival of the fittest that matters in any walk of life. In the world that we live in today, there is intense competition for securing jobs. In such a scenario, it is important for children to successfully pursue higher education, in order to be placed in a well paid job. For this very reason, opting for Registered Educational Saving Plan (RESP) is an excellent choice which you must consider.

RESP involves making an investment for a specified period with an authorized RESP provider. Your RESP fund will be used for low-risk investments so that you get the maximum returns with minimal market risks. RESP reaches maturity when your child is ready for their higher education. During the RESP plan, you will not only get a tax-saving benefit but once you opt for payout, the tax has to be paid on that is paltry. You get the dual benefit of making a safe investment as well as securing your child’s future.

Heritage Education Funds provides a wide variety of customizable options for RESP. They have been in this field for over fifty years. With over $600 million in payouts, they have managed to reach out to a large number of parents and guardians who have used Heritage RESP to successfully fund their children’s higher education within Canada, and even for children who have opted for higher studies abroad. They invest in secure federal bonds and other investments that are backed up by the federal or municipal governments or those with principal guarantees to maximize your returns.

The cost of living has increased, inflation is higher and whether you are the guardian of a teen or a newborn, the earlier you invest in a plan like RESP, the more beneficial it would be for the future of your child when it comes to education. Through Heritage Education Funds, your child can be assured of an excellent higher education to any university of their choice and your foresight will see to it that your child scales the heights of success.

About: Heritage RESP Representatives are all the way active to support the needy parents with Heritage Education Funds. Parents can contact representatives of Heritage by simply dialing 1.800.739.2101.

Why Your Flash Website Needs a Redesign by Raleigh’s Web Design Experts

Don’t let Flash web design hold you back. Whether you’re a Raleigh web designer, small business owner or eCommerce marketing manager, it’s time to say goodbye to Adobe Flash and start reaping the benefits of modern web design techniques.

When you launched your website years ago, designing with Adobe Flash probably seemed like a good idea; your Raleigh web design firm created an attractive site with cutting edge graphics. But if your Flash website hasn’t delivered the marketing results you expected, there’s a reason: Flash isn’t search engine-friendly…and in many cases, it isn’t even user-friendly.

Still using Flash? Here’s why it’s time for a website redesign:

Flash is bad for SEO. Flash files are basically invisible to search engines, meaning that if your site is entirely Flash web design, potential customers are unlikely to see you in Google search results and you’re missing out on the number one source of online lead generation.

Flash hurts your mobile marketing strategy. Recent data predicts that by 2015, mobile web use will eclipse desktop internet use. But if you have a Flash website, you’ll be left in the dust. iPhones, iPads and many other mobile devices aren’t compatible with Flash, meaning your website simply won’t show up.

Flash is harder to update. Because Flash elements are difficult to integrate with a CMS (content management system), they’re harder and more expensive to change…meaning many Flash websites have become outdated.

Flash isn’t user-friendly. Besides being slower, Flash websites also require users to have an up-to-date Adobe plug-in in order to view the site.

Flash isn’t open-source. Because Flash is proprietary Adobe software, your site relies on a third party to display information. Open standard software like HTML5 offers greater accessibility for your Raleigh website viewers — no Adobe plug-in required.

Attractive, interactive web design — no Flash required!

With modern web design techniques, there’s no need to rely on Adobe Flash for attractive graphics and interactive website elements. Open standard programming languages like HTML5 offer the best alternative, enabling Raleigh web designers and developers to create all the design features of a Flash website, with none of the negative effects.

So when you’re ready to for a new website design, say no to Flash. Equip your website for optimal search engine rankings and lead conversion — choose high-end, custom web design from a Raleigh web design company like Click Optimize.

Essential House Painting Tips

Of course, at some point in time, you would have been convinced about a revamp in your home. We would say it is pretty important to consider some kind of renovation on a regular basis; it could even be to change your drapes or move your furniture to give your home a new look. You can also certainly consider painting your home also, because, it gives it a complete face lift. Besides just that, house painting helps treat a lot of termites and other insects and also is a kind of extensive cleaning, which might not happen otherwise.
Additionally, when this is happening, you can expect your home to dazzle with some new and bright hues. If you have already gotten your home painted once, you will agree that it is quite some back breaking work. From choosing the right shades to getting expert advice on them and also arranging appropriate contract is very vital to this process. Needless to say, it is not a frequent thing, and ought to be done with utmost precision. From selecting the right color for the mood and the feel of the home to getting the work done efficiently, it requires constant supervision.
Another important thing you have got to look at is the painting cost. Quite obviously, if you have decided to get your home painted, you must have set aside a budget for it. Ideally, you have to look around for quotes that fit your budget, if not, look at how much you can stretch your painting costs, because it is not something you get done frequently. Besides all these considerations, one important thing that has been mentioned is the choice of room painting colors.
This is very crucial because, it forms the crux of the whole activity. So we would advice you to check with your painting contractor a catalogue of room painting colors; this catalogue will essentially give you a clear picture. Some of these contractors also have a setup wherein, you can use these paints on your walls and see for yourself how it might turn out; virtually.
Author bio
Jaydensmith is a skilled writer who has done comprehensive online research on home decoration, Interior designing and home beautification. His study focused on finding Room Painting Colors and evaluation of Interior House Paint Color. To know about Home Painting Colors visit www.bergerpaints.com

What Qualities Should a Good Parent Possess

Striving to be a good parent in a difficult world full of trials and temptations is a daunting task. What qualities should a good parent possess is a question well worth the asking. Read this article to get some valuable input on how to be a better parent in trying times. Maybe you are a single parent struggling to raise a teenager on your own or you may be an overworked parent trying to raise tiny children. The qualities you will need to possess remain the same with few adjustments as the years roll by.

Read on to find out what mothers the world over consider as the answer to the question, “what qualities should a good parent possess.”

Patience with a capital “P” heads the list. You are going to have to call upon hitherto untapped resources to find the patience to deal with day to day circumstances that arise when raising children.

Let your children know how much you love them and never be backward to demonstrate the love you have for them. This will teach them to express their feelings and emotions and help them grow into caring individuals.

Pay attention to what your children are trying to tell you. Listen without judging and try to understand the reasons behind their actions. Talk to them without getting angry and frustrated and they will talk back to you. Your children need to feel confident in coming to you with their problems; they need a listening ear and someone to guide them when they go off track. If you rant and rave you will only succeed in pushing them away from you and you can bet they are not going to come to you when in a crisis.

Make time for your children, set aside family time that is totally devoted to them. Take the time to get creative when planning family activities and make sure that you include their personal favorite activities as well. Every one is always busy and has plenty to do but that will not work as an excuse. Your children need and deserve your attention – give it to them!

Treating your children with respect means they will in turn respect you, your authority and your decisions. While they may not always agree with your decisions, especially when it restricts television or telephone talk time, they will respect what you say. This is the best way to encourage obedience.

Learning to laugh and stay cool in situations where you would rather explode is an excellent quality to have. This provides a calm and stable environment for the children.

Keep personal disagreements with your spouse separate from the children and never interfere when one parent is doing the correcting. Time enough to discuss it with your partner behind closed doors if you do not agree with something.

When you consider what qualities should a good parent possess, the list is seemingly endless. Hopefully this article will help you get started.

Tilera’s TILE-Gx72 Processor Sets World Record for Suricata IPS/IDS: Industry’s Highest Performance

Tilera® Corporation, the leader in 64-bit manycore general purpose processors, today announced it has achieved the highest ever single-chip Suricata performance, delivering 4x the performance, and 7x the performance-per-watt of a high-end x86 multicore processor. Suricata is the industry-leading open source Intrusion Detection and Prevention System (IDS/IPS) developed by the Open Information Security Foundation (OISF) and supported by the US Department of Homeland Security (DHS) to secure networks against next generation security attacks.

Sophisticated intrusion detection and prevention, such as Suricata implements, requires deep packet inspection and pattern-matching that taxes the capabilities of even the highest performance processors. The Suricata performance achieved on the TILE-Gx72 processor is double that of the previous record-holder, the TILE-Gx36, providing organizations with network security that scales with their networks.

“Tilera’s TILE-Gx processors are continuing to lead the market in Suricata performance and the impressive results with the TILE-Gx72 demonstrates the synergy between a massively manycore processor, coupled with Suricata’s multi-threaded implementation,” stated Matt Jonkman, president, OISF. “With the continuing rise of security threats and incidents, corporate enterprises, carriers and government organizations are adopting Suricata for their IDS/IPS and leveraging the TILE-Gx processor family coupled with the MDE development environment to achieve the best performance.”

The TILE-Gx72 is the world’s highest performance and highest efficiency processor with integrated System-on-Chip (SoC) features including eight 10Gb Ethernet ports, 24-lanes of PCI Express, four DDR3 memory controllers, and 23 Mbytes of on-chip cache. The wire-speed, programmable mPIPE front end processes 240 Mpps of bi-directional Ethernet traffic and improves the efficiency of network-heavy applications. With its exceptionally low power profile, several TILE-Gx72 processors can be populated in a single compact datacenter appliance, providing 576 cores of compute and 640Gbps of packet processing with 8 sockets.

The multi-threaded Suricata IDS/IPS application, version 1.4.0, was ported using Tilera’s Multicore Development Environment (MDE) version 4.1, a full-featured and standards based run-time Linux environment for TILE-Gx processors. The recent “live rule swap” update supports dynamic insertion of new threat signatures into Suricata and enables rapid response to threats such as Zero-Day Attacks.

“We track Moore’s Law with the tile-based architecture and significantly raise the bar with our TILE-Gx72 processor, incorporating twice the number of cores of our previous high-end processor. Tilera’s high-performance iMesh interconnect enables Suricata performance to scale linearly with the additional cores,” said Devesh Garg, president, and CEO of Tilera. “Once again, we are demonstrating that the TILE-Gx architecture provides a real-world advantage in scalable application performance, power efficiency, and overall compute density.”

The Suricata solution is available on all of Tilera’s TILE-Gx platforms, ranging from the TILEncore-Gx series of PCIe cards with multiple 10Gbps Ethernet interfaces, to the TILEmpower-Gx 1RU standalone appliance and the TILExtreme-Gx 1RU multi-socket platform with up to 288 cores of compute.

Awesome Kick Boxing Classes In Marine Park Brooklyn, Ny!

Kickboxing in Marine Park, NY, an entire body workout that will drive you to your ideal body image, is currently the countrys most popular fitness program. Whether you want to lose weight, tone up your body, relieve stress, or simply just have fun, A Brooklyn, NY Kickboxing Class is a perfect solution in allowing you to achieve all four of those qualities.

Kick boxing in Marine Park, NY allows for women to strengthen, tone and reduce fat all at the same time. Since Marine Park Kickboxing is a total-body workout, women will find themselves increasing their flexibility all while improving their balance and coordination.

Cardio kickboxing in Brooklyn, NY provides a workout sufficient enough to improve and maintain cardiovascular fitness. If you are seeking better health and a stronger body, then a Marine Park kick boxing class is just the thing that you are looking for. Learning the art of Kickboxing provides a great amount of benefits to a woman. It covers the safety, physical, psychological and social aspect of every person. One must understand its concepts and master its skills to gain the full experience of a Marine Park fitness Kickboxing workout.

Kickboxing in Marine Park, NY is an exciting way to get a great workout, and to learn useful martial arts techniques without having to engage in actual combat with others. Kick Boxing in Marine Park improves the efficiency and strength of your heart, blood vessels and lungs, which of course provides your body with greater endurance and overall health.

Marine Park Kick Boxing classes are a high-intensity, fun exercise that will have you wanting to come back for another class. You will soon realize that when you are fully enjoying a workout it will not so much be considered a workout in your mind, it will be more like a hobby. Once it becomes a hobby, keeping up with it will be quite easy, allowing you to achieve those goals of yours in transforming your body.

While participating in a Brooklyn Kickboxing class, your mind is completely occupied with a variation of different skills and techniques that you will be learning. Your self-defense will increase enormously and you will find that you are gaining a great amount of self-confidence as well.

Success in anything, whether its to lose a few pounds, become real athletic, or just being able to walk up and down stairs without feeling like you are going to pass out, will take determination and patience. If you stay with something long enough, such as a Marine Park Kickboxing class, it will absolutely feel like its becoming a hobby which will have you feeling like you dont really need motivation to get yourself to work out to achieve your goals, you will want to do this with no hesitation.

Dont waste another minute. Get started with a Brooklyn Kick Boxing class and experience this awesome, high-energy, cardio workout program!

Jewelry Photography In Its Entire Splendor

Jewelry has always been an object of fascination for most women of all communities. Its origin is dated thousands of years ago in prehistoric times when caveman used to wear animal skeletons on their neck. From the ancient Roman civilization and the Egyptian culture till now, people have been wearing jewelries as a means of affirming ones status. Today, jewelries hold all its splendor with several varieties of precious metals, gems and stones.

Several types of jewelries exist for several purposes; for example there are special jewelries for weddings and engagement, other kinds of jewelries as gifts-giving, specific Celtic jewelries, religion-oriented jewelries among others. The photography of jewelry demands a lot of tact and experience. If you are a Jeweler looking for advices for your business, this article is for you and will concentrate on jewelry photography.

What should you know as a Jeweler?

First of all, the basic thing you need to bear in mind that jewelries are generally attractive in nature, it is important to retain the same attractiveness in its photos or Flash animations. You can even enhance its look through a cozy background dcor. For example shooting the high definition photo of a wedding diamond ring in a beautiful box gives a better visual appeal than just photo shooting a standalone ring.

About Photography of Jewelry

Excellent jewelry photos need to be clear, sharp, dozed with the proper soft lighting in order to create the required sparkle. Also, something very important to note is that for close-up photos of jewelries, the digital camera should have excellent focusing abilities and for this to work well, the digital photo camera should be fixed on a tripod.

With regards to jewelry lighting, it is advisable and for better quality not to use flash lights. Instead, the use of continuous lighting is highly recommended.

Using plexiglass support is also advisable as a mirror effect can be created for a more professional end-product.

Problems in jewelry photography

Jewelry photos are quite problematic. Even without models wearing them, there are a number of issues to address. Whether they are pearls, diamonds, colored gemstones, semi-precious stones, crystals of materials such as silver, gold and platinum, the creation of sublime jewelry photos requires a technical know-how.
First of all, there is the problem of cast shadow. Even when laid on a flat surface, jewelries such as rings and earrings will produce unnecessary cast shadows.

Also and most importantly, there are reflections. The purity of a diamond reflects its value and you must therefore emphasize on that purity through exquisite photos which do not tire the eye of the beholder. Indeed, there are basic home solutions making use of clothes, paper and glass plates. But if these solutions are suitable for amateur photos, they are more risky for professional photographic usage.

How to take excellent jewelry HD photos and interactive animations?

Using a professional photo studio, such as the PackshotMacro gives jewelry photos such as precious stones their entire splendor. Equipped with a professional Macro camera, its constant lighting reduces glare and help enhance the purity of the gemstones. No need for any external lighting setup as the digital photo studio is already equipped with daylight conditioned lighting.

Being an intuitive automated photo solution, the PackshotCreator photo studio captures your jewelries in high definition to portray each and every facet of the precious metals. Moreover, high quality interactive animations can be created with such a creative photo lightbox.s

Integrating C++ with QML

Introduction

Qt Quick’s QML language makes it easy to do many things, especially fancy animated user interfaces. However, some things either can’t be done or are not suitable for implementing in QML, such as:

  1. Getting access to functionality outside of the QML/JavaScript environment.
  2. Implementing performance critical functions where native code is desired for efficiency.
  3. Large and/or complex non-declarative code that would be tedious to implement in JavaScript.

As we’ll see, Qt makes it quite easy to expose C++ code to QML. In this blog post I will show an example of doing this with a small but functional application.

The example is written for Qt 5 and uses the Qt Quick Components so you will need at least Qt version 5.1.0 to run it.

Overview

To expose a C++ type having properties, methods, signals, and/or slots to the QML environment, the basic steps are:

  1. Define a new class derived from QObject.
  2. Put the Q_OBJECT macro in the class declaration to support signals and slots and other services of the Qt meta-object system.
  3. Declare any properties using the Q_PROPERTY macro.
  4. Call qmlRegisterType() in your C++ main program to register the type with the Qt Quick engine.

For all the details I refer you to the Qt documentation section Exposing Attributes of C++ Types to QML and the Writing QML Extensions with C++ tutorial.

Ssh Key Generator

For our code example, we want a small application that will generate ssh public/private key pairs using a GUI. It will present the user with controls for the appropriate options and then run the program ssh-keygen to generate the key pair.

I implemented the user interface using the new Qt Quick Controls since it was intended as a desktop application with a desktop look and feel. I initially developed the UX entirely by running the qmlscene program directly on the QML source.

The UI prompts the user for the key type, the file name of the private key to generate and an optional pass phrase, which needs to be confirmed.

The C++ Class

Now that have the UI, we will want to implement the back end functionality. You can’t invoke an external program directly from QML so we have to write it in C++ (which is the whole point of this example application).

First, we define a class that encapsulates the key generation functionality. It will be exposed as a new class KeyGenerator in QML. This is done in the header file KeyGenerator.h below.

#ifndef KEYGENERATOR_H
#define KEYGENERATOR_H

#include <QObject>
#include <QString>
#include <QStringList>

// Simple QML object to generate SSH key pairs by calling ssh-keygen.

class KeyGenerator : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
    Q_PROPERTY(QStringList types READ types NOTIFY typesChanged)
    Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged)
    Q_PROPERTY(QString passphrase READ filename WRITE setPassphrase NOTIFY passphraseChanged)

public:
    KeyGenerator();
    ~KeyGenerator();

    QString type();
    void setType(const QString &t);

    QStringList types();

    QString filename();
    void setFilename(const QString &f);

    QString passphrase();
    void setPassphrase(const QString &p);

public slots:
    void generateKey();

signals:
    void typeChanged();
    void typesChanged();
    void filenameChanged();
    void passphraseChanged();
    void keyGenerated(bool success);

private:
    QString _type;
    QString _filename;
    QString _passphrase;
    QStringList _types;
};
#endif

Next, we need to derive our class from QObject. We declare any properties that we want and the associated methods. Notify methods become signals. In our case, we want to have properties for the selected key type, the list of all valid ssh key types, file name and pass phrase. I arbitrarily made the key type a string. It could have been an enumerated type but it would have made the example more complicated.

Incidentally, a new feature of the Q_PROPERTY macro in Qt 5.1.0 is the MEMBER argument. It allows specifying a class member variable that will be bound to a property without the need to implement the setter or getter functions. That feature was not used here.

We declare methods for the setters and getters and for signals. We also declare one slot called generateKey(). These will all be available to QML. If we wanted to export a regular method to QML, we could mark it with Q_INVOCABLE. In this case I decided to make generateKey() a slot since it might be useful in the future but it could have just as easily been an invocable method.

Finally, we declare any private member variables we will need.

C++ Implementation

Now let’s look at the implementation in KeyGenerator.cpp. Here is the source code:

#include <QFile>
#include <QProcess>
#include "KeyGenerator.h"

KeyGenerator::KeyGenerator()
    : _type("rsa"), _types{"dsa", "ecdsa", "rsa", "rsa1"}
{
}

KeyGenerator::~KeyGenerator()
{
}

QString KeyGenerator::type()
{
    return _type;
}

void KeyGenerator::setType(const QString &t)
{
    // Check for valid type.
    if (!_types.contains(t))
        return;

    if (t != _type) {
        _type = t;
        emit typeChanged();
    }
}

QStringList KeyGenerator::types()
{
    return _types;
}

QString KeyGenerator::filename()
{
    return _filename;
}

void KeyGenerator::setFilename(const QString &f)
{
    if (f != _filename) {
        _filename = f;
        emit filenameChanged();
    }
}

QString KeyGenerator::passphrase()
{
    return _passphrase;
}

void KeyGenerator::setPassphrase(const QString &p)
{
    if (p != _passphrase) {
        _passphrase = p;
        emit passphraseChanged();
    }
}

void KeyGenerator::generateKey()
{
    // Sanity check on arguments
    if (_type.isEmpty() or _filename.isEmpty() or
        (_passphrase.length() > 0 and _passphrase.length() < 5)) {
        emit keyGenerated(false);
        return;
    }

    // Remove key file if it already exists
    if (QFile::exists(_filename)) {
        QFile::remove(_filename);
    }

    // Execute ssh-keygen -t type -N passphrase -f keyfileq
    QProcess *proc = new QProcess;
    QString prog = "ssh-keygen";
    QStringList args{"-t", _type, "-N", _passphrase, "-f", _filename};
    proc->start(prog, args);
    proc->waitForFinished();
    emit keyGenerated(proc->exitCode() == 0);
    delete proc;
}

The constructor initializes some of the member variables. For fun, I used the new initializer list feature of C++11 to initialize the _types member variable which is of type QStringList. The destructor does nothing, at least for now, but is there for completeness and future expansion.

Getter functions like type() simply return the appropriate private member variable. Setters set the appropriate variables, taking care to check that the new value is different from the old one and if so, emitting the appropriate signal. As always, please note that signals are created by the Meta Object Compiler and do not need to be implemented, only emitted at the appropriate times.

The only non-trivial method is the slot generateKey(). It does some checking of arguments and then creates a QProcess to run the external ssh-keygen program. For simplicity and because it typically executes quickly, I do this synchronously and block on it to complete. When done, we emit a signal that has a boolean argument that indicates the key was generated and whether it succeeded or not.

QML Code

Now let’s look at the QML code in main.qml:

// SSH key generator UI

import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import QtQuick.Dialogs 1.0
import com.ics.demo 1.0

ApplicationWindow {
    title: qsTr("SSH Key Generator")

    statusBar: StatusBar {
    RowLayout {
        Label {
            id: status
            }
        }
    }

    width: 369
    height: 166

    ColumnLayout {
        x: 10
        y: 10

        // Key type
        RowLayout {
            Label {
                text: qsTr("Key type:")
            }
            ComboBox {
                id: combobox
                Layout.fillWidth: true
                model: keygen.types
                currentIndex: 2
            }
        }

        // Filename
        RowLayout {
            Label {
                text: qsTr("Filename:")
            }
            TextField {
                id: filename
                implicitWidth: 200
                onTextChanged: updateStatusBar()
            }
            Button {
                text: qsTr("&Browse...")
                onClicked: filedialog.visible = true
            }
        }

        // Passphrase
        RowLayout {
            Label {
                text: qsTr("Pass phrase:")
            }
            TextField {
                id: passphrase
                Layout.fillWidth: true
                echoMode: TextInput.Password
                onTextChanged: updateStatusBar()
            }

        }

        // Confirm Passphrase
        RowLayout {
            Label {
                text: qsTr("Confirm pass phrase:")
            }
            TextField {
                id: confirm
                Layout.fillWidth: true
                echoMode: TextInput.Password
                onTextChanged: updateStatusBar()
            }
        }

        // Buttons: Generate, Quit
        RowLayout {
            Button {
                id: generate
                text: qsTr("&Generate")
                onClicked: keygen.generateKey()
            }
            Button {
                text: qsTr("&Quit")
                onClicked: Qt.quit()
            }
        }

    }

    FileDialog {
        id: filedialog
        title: qsTr("Select a file")
        selectMultiple: false
        selectFolder: false
        nameFilters: 
        selectedNameFilter: "All files (*)"
        onAccepted: {
            filename.text = fileUrl.toString().replace("file://", "")
        }
    }

    KeyGenerator {
        id: keygen
        filename: filename.text
        passphrase: passphrase.text
        type: combobox.currentText
        onKeyGenerated: {
            if (success) {
                status.text = qsTr('<font color="green">Key generation succeeded.</font>')
            } else {
                status.text = qsTr('<font color="red">Key generation failed</font>')
            }
        }
    }

    function updateStatusBar() {
        if (passphrase.text != confirm.text) {
            status.text = qsTr('<font color="red">Pass phrase does not match.</font>')
            generate.enabled = false
        } else if (passphrase.text.length > 0 && passphrase.text.length < 5) {
            status.text = qsTr('<font color="red">Pass phrase too short.</font>')
            generate.enabled = false
        } else if (filename.text == "") {
            status.text = qsTr('<font color="red">Enter a filename.</font>')
            generate.enabled = false
        } else {
            status.text = ""
            generate.enabled = true
        }
    }

    Component.onCompleted: updateStatusBar()
}

The preceding code is a little long, however, much of the work is laying out the GUI components. The code should be straightforward to follow.

Note that we import com.ics.demo version 1.0. We’ll see where this module name comes from shortly. This makes a new QML type KeyGeneratoravailable and so we declare one. We have access to it’s C++ properties as QML properties, can call it’s methods and act on signals like we do withonKeyGenerated.

A more complete program should probably do a little more error checking and report meaningful error messages if key generation fails (we could easily add a new method or property for this). The UI layout could also be improved to make it properly resizable.

Our main program is essentially a wrapper like qmlscene. All we need to do to register our type with the QML engine is to call:

    qmlRegisterType<KeyGenerator>("com.ics.demo", 1, 0, "KeyGenerator");

This makes the C++ type KeyGenerator available as the QML type KeyGenerator in the module com.ics.demo version 1.0 when it is imported.

Typically, to run QML code from an executable, in the main program you would create a QGuiApplication and a QQuickView. Currently, to use the Qt Quick Components there is some additional work needed if the top level element is an ApplicationWindow or Window. You can look at the source code to see how I implemented this. I basically stripped down the code from qmlscene to the minimum of what was needed for this example.

Here is the full listing for the main program, main.cpp:

#include <QApplication>
#include <QObject>
#include <QQmlComponent>
#include <QQmlEngine>
#include <QQuickWindow>
#include <QSurfaceFormat>
#include "KeyGenerator.h"

// Main wrapper program.
// Special handling is needed when using Qt Quick Controls for the top window.
// The code here is based on what qmlscene does.

int main(int argc, char ** argv)
{
    QApplication app(argc, argv);

    // Register our component type with QML.
    qmlRegisterType<KeyGenerator>("com.ics.demo", 1, 0, "KeyGenerator");

    int rc = 0;

    QQmlEngine engine;
    QQmlComponent *component = new QQmlComponent(&engine);

    QObject::connect(&engine, SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));

    component->loadUrl(QUrl("main.qml"));

    if (!component->isReady() ) {
        qWarning("%s", qPrintable(component->errorString()));
        return -1;
    }

    QObject *topLevel = component->create();
    QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);

    QSurfaceFormat surfaceFormat = window->requestedFormat();
    window->setFormat(surfaceFormat);
    window->show();

    rc = app.exec();

    delete component;
    return rc;
}

In case it is not obvious, when using a module written in C++ with QML you cannot use the qmlscene program to execute your QML code because the C++ code for the module will not be linked in. If you try to do this you will get an error message that the module is not installed.