text:
#region copyright

#endregion

namespace YAF.Classes
{
  #region Using

  using System;

  using YAF.Classes.Pattern;
  using YAF.Types;
  using YAF.Types.Interfaces;

  #endregion

  /// <summary>
  /// The yaf provider.
  /// </summary>
  public static class YafFactoryProvider
  {
    #region Constants and Fields

    /// <summary>
    /// The _builder factory.
    /// </summary>
    private static ITypeFactoryInstance<IUrlBuilder> _builderFactory;

    /// <summary>
    /// The _user display name factory.
    /// </summary>
    private static ITypeFactoryInstance<IUserDisplayName> _userDisplayNameFactory;

    #endregion

    #region Properties

    /// <summary>
    /// Gets UrlBuilder.
    /// </summary>
    public static IUrlBuilder UrlBuilder
    {
      get
      {
        if (_builderFactory == null)
        {
          _builderFactory = new TypeFactoryInstanceApplicationBoardScope<IUrlBuilder>(UrlBuilderType);
        }

        return _builderFactory.Get();
      }
    }

    /// <summary>
    /// Gets current <see cref="IUserDisplayName"/>.
    /// </summary>
    public static IUserDisplayName UserDisplayName
    {
      get
      {
        if (_userDisplayNameFactory == null)
        {
          _userDisplayNameFactory = new TypeFactoryInstanceApplicationBoardScope<IUserDisplayName>(UserDisplayNameType);
        }

        return _userDisplayNameFactory.Get();
      }
    }

    /// <summary>
    /// Gets UrlBuilderType.
    /// </summary>
    private static string UrlBuilderType
    {
      get
      {
        var urlAssembly = Config.GetProvider("UrlBuilder");

        if (!String.IsNullOrEmpty(urlAssembly))
        {
          return urlAssembly;
        }
        else if (Config.IsDotNetNuke)
        {
            urlAssembly = "YAF.DotNetNuke.DotNetNukeUrlBuilder,YAF.DotNetNuke.Module";
        }
        else if (Config.IsMojoPortal)
        {
            urlAssembly = "YAF.Mojo.MojoPortalUrlBuilder,YAF.Mojo";
        }
        else if (Config.IsRainbow)
        {
            urlAssembly = "yaf_rainbow.RainbowUrlBuilder,yaf_rainbow";
        }
        else if (Config.IsPortal)
        {
          urlAssembly = "Portal.UrlBuilder,Portal";
        }
        else if (Config.IsPortalomatic)
        {
          urlAssembly = "Portalomatic.NET.Utils.URLBuilder,Portalomatic.NET.Utils";
        }
        else if (Config.EnableUrlRewriting)
        {
          urlAssembly = "YAF.Core.RewriteUrlBuilder,VZF.Core";
        }
        else
        {
          urlAssembly = "YAF.Classes.DefaultUrlBuilder";
        }

        return urlAssembly;
      }
    }

    /// <summary>
    /// Gets UserDisplayNameType.
    /// </summary>
    private static string UserDisplayNameType
    {
      get
      {
        string urlAssembly;

        if (!String.IsNullOrEmpty(Config.GetProvider("UserDisplayName")))
        {
          urlAssembly = Config.GetProvider("UserDisplayName");
        }
        else
        {
          urlAssembly = "YAF.Classes.Core.DefaultUserDisplayName,YAF.Classes.Core";
        }

        return urlAssembly;
      }
    }

    #endregion
  }
}

redpajama_set_name: RedPajamaGithub


Our Cushion with names and a date, surrounded by a beautiful ampersand, is perfect for a unique and personal Wedding or Anniversary gift.
These also make the perfect Valentine gift.
An ampersand is printed on the front of this natural cotton cushion, with names and a date printed within the ampersand.
These cushions make the perfect gift for any occasion, Birthdays, Valentines, Christmas, Weddings, Anniversaries,, or if you just want to treat a special family member or friend!


Kanyarkali is a folk dance ritual performed in Bhagavati temples and Vettakorumakan Temple of Palakkad district. The kali (play) is presented by members of the Nair community to propitiate Bhagavati.
The dance is performed at night for four consecutive nights. The dance ends at dawn. The dances begin with the men of the community gathering in the temples and performing a rhythmic circular dance called Vattakali. Vattakali is a ritual, it is followed by Purattukali, an entertainment. Purattu literally means farce. Just before the kali, kelikottu is done heralding the beginning of the main play. In most places, the play begins at eight at night. The first item is 'nadavattom'. It is a ritual of the players entering the square stage called pandal. The Kaliyachan or the main singer recites the vaythari and the performers play accordingly. The players sing and dance around a lighted traditional lamp. There is no particular costume. The players wield sticks with bells attached to it. According to the song the players dance in different rhythmic movements. The rhythmic movements gain momentum and the kali reaches its finale. And naduvattom comes to an end. When one round is over, the komaram (oracle) enters the pandal, dances in frenzy and finally removes the sword. Vattakali is performed thrice. Naduvattom is followed by a kali with songs sung by singers who occupy the central position of the stage. Towards the end of the song the dance is performed in a slow tempo. In the third Vattakali, songs are sung in praise of Bhagavati.
The second part of Kanyarkali is the performance of Purattu. On the first day Iravakali is performed and on the second day, it is aandikoothu. The following days Vallon and Malamakali are performed. Prominent instruments that serve as accompaniments include Chenda, Maddalam, Edakka, Udukku, Ilathalam, Chengila and Kurumkuzhal.


text:
Q: FPS drops on Windows 8.1 Pro when idle Hello I got this issue since I upgraded my Windows 8 to Windows 8.1. While I'm playing a game or watching a movie, if I do not move the mouse for like 30 seconds or so game fps drops to 20-30 from 120-300 also movies are starting to mini-freeze.
My graphic card is HD7850 2GB edition with 13.9 driver version.

redpajama_set_name: RedPajamaStackExchange


Small Cabin Home Plan With Open Living Floor Planos Cabina Y is part of great design ideas. Small Cabin Home Plan With Open Living Floor Planos Cabina Y was created by combining fantastic ideas, interesting arrangements, and follow the current trends in the field of that make you more inspired and give artistic touches. We'd be honored if you can apply some or all of these design in your wedding. believe me, brilliant ideas would be perfect if it can be applied in real and make the people around you amazed!
Small Cabin Home Plan With Open Living Floor Planos Cabina Y was posted in November 25, 2018 at 3:18 pm. Small Cabin Home Plan With Open Living Floor Planos Cabina Y has viewed by 18 users. Click it and download the Small Cabin Home Plan With Open Living Floor Planos Cabina Y.


Like My Photos On Instagram: The amount of times were you associated with a discussion with your family and friends about suching as each other's pics on Facebook or Instagram? Some people take this worthless social interaction rather seriously, though I think it's rather clear where I stand on on the matter. If you want evaluating the sort your Instagram photos obtain-- or you have friends that may value a solutionlike this-- you need to take a look at a new app that can do all of the heavy lifting for you.
Called Best Buddies, the brand-new web app tells you specifically that likes your photos one of the most. The leading likers checklist is automatically created after you connect Best Buddies to your Instagram account, and it will certainly present a checklist of your top 10 friends based on the percentage of pictures every one has actually liked.
The process is quite simple, as well as the app is entirely complimentary to utilize. All you have to do is go to the Best Buddies site, enter your Instagram credentials and then await your listing to be automatically created.
The outcomes will be shown in a neat checklist, as seen above. With such cool tough data in hand, you'll then have the ability to truly reprimand your friends and family for not consistently liking your Instagram developments.
After you're done evaluating your top likers, you should additionally inspect the very best nine photos you published in 2014 by utilizing this cool app.


Jailhouse Ditch Digger is an American Brown Ale. Brown Ales are far from a go-to beer for me, as my interest in bigger beers grows so does my lack of interest is most browns. I still grab a new one when I see it though, always looking for a new beer to try! I've been generally impressed with Jailhouse thus far and as brown ales go this is right up my ally. Lots of toasted brown bread, hits of caramel and coffee. Good bitterness from some aggressive hops balance out the beer on the finish. Snag a bottle of this if you enjoy a bolder, slightly hoppier brown ale.


The UK's first naturally filtered outdoor swimming pool is opening in London this May. The bathing pond will use plants instead of chemicals or machinery to keep the water clean, which will in addition provide habitat for wetland fauna. The pool will operate within a small scale, self-sustaining ecosystem.
At 40-metres long, 10-metres wide, the pool will be able to accommodate 100 bathers at a time. It will be built two meters above ground level, using salvaged bricks and stones to create the basin.
The pool is designed for year-round use, but the number of swimmers allowed per day will be restricted in order to allow the pool time to regenerate. The landscape surrounding the water will include wild flowers, grasses and bushes, meaning that the environment will change as the seasons do.
According to Dezeen, the project, called 'Of Soil and Water', is the UK's first man-made bathing pond filtered using natural processes. Designed by Ooze Architects and artist Marjetica Potrč the project was commissioned as part of the 27-hectare King's Cross station redevelopment.
Users of the pool will be educated about the pond's landscape and how the pool operates. Landscaping and pool work—as well as the rest of the redevelopment project—will be ongoing, but visitors will be able to try it out during the first week of May.
According to Dezeen, the project is the latest example of a growing trend for natural bathing. Freshwater pools have also been proposed for other areas of London; Switzerland is already home to one.


In a nutshell, here's the deal. Patagonia and various GOP officials have been duking it out via twitter and very public homepage statements about the way in which America values, treats, supports, and best uses its sacred public lands.
It's a war that has been raging since the beginning of 2017, when Patagonia announced its boycott of the Outdoor Retailer show in Salt Lake City, following Utah's refusal to step to step up to defend Bears Ears.
Last week, the GOP extended an invitation to Chouinard to come speak his truth about public lands in front of the House National Resources Committee.
Chouinard fired back two paragraphs that essentially says "thanks, but no thanks."
Is Chouinard living in a bubble?


text:
Electrical and Computer Engineering Faculty Position (Tenure-Track)
Department Website http://ece@vmi.edu
Lexington, VA
Position Start Date	 August 2022
Apply Online Here https://virginiajobs.peopleadmin.com...
Academic Fields	 Electrical and/or Electronics
The Department of Electrical and Computer Engineering at the Virginia Military Institute (VMI) seeks applications for a full-time tenure-track faculty member. Preference is at the assistant professor level but qualified applicants at the associate professor level will be considered. In order to be considered for this position, a candidate must have a doctoral degree in electrical or computer engineering, or related discipline, and must have a strong dedication to undergraduate education. The department is seeking a candidate to teach existing courses in one of the fundamental areas of electrical and computer engineering. Additionally, we are looking for a candidate who can contribute to the highly-customizable, practical, student-centered education offered by the department through the creation of upper-division electives of relevance to the students and the profession, and in complement to the department's current offerings.
The appointment will begin August 1, 2022.
VMI is a public, four-year undergraduate military college (1,700 students) located in the historic Shenandoah Valley of Virginia. Lexington, (population 7,000) also the home to Washington and Lee University, offers a stimulating cultural atmosphere, a relaxed rural pace, and a diverse economic base to make life pleasant and rewarding. Share in Lexington's rich heritage, while enjoying the natural beauty of the Blue Ridge Mountains. Visit http://lexingtonvirginia.com.
Applications must include a current CV and a statement that clearly addresses the candidate's potential contributions to the department within the defined Institute domains of teaching, scholarly engagement, professional citizenship, and cadet development. In support of the Institute's dedication to cultural competency, applicants are also encouraged to include a statement regarding their potential contributions in this regard. Finalists for the position will be asked to provide three letters of reference.
Review of applications will begin immediately and will continue until the position is filled.
Candidates please apply online at: https://virginiajobs.peopleadmin.com/postings/249461
The position is open until filled.
Criminal background check required for final candidate.
All VMI employees are required to complete a COVID-19 Vaccination Status Form upon hire, per Governor
Northam's Executive Directive #18. The Human Resources Office will supply the form.
VMI is an Equal Opportunity Employer. In a continuing effort to enrich its academic environment and provide equal education and employment opportunities, VMI encourages women, minorities, disabled individuals, and veterans to apply. AmeriCorps, Peace Corps, and other national service alumni are also encouraged to apply. VMI will provide reasonable accommodation to qualified individuals with documented disabilities to ensure equal access and equal opportunities with regard to employment, educational opportunities, programs and services.
Contact: Search Committee, Department of Electrical and Computer Engineering, Virginia Military Institute,
Lexington, VA 24450. Phone: (540) 464-7236. Email: ece@vmi.edu
In a continuing effort to enrich its academic environment and provide equal educational and employment opportunities, VMI encourages women, minorities, disabled individuals and veterans to apply. AmeriCorps, Peace Corps and other national service alumni are also encouraged to apply.
Contact Search Committee
Email: ece@vmi.edu

redpajama_set_name: RedPajamaCommonCrawl


⇨ Privacy Statement: This privacy statement was created by SkyMovies to demonstrate our commitment to privacy. Please read this statement regarding our websites.
⇨ Cookies: Currently we assign cookies to our readers in order to save their preferences. This data is not shared with any third party. Accessing our websites is not dependent on accepting cookies and all major browsers allow you to disable cookies if you wish.
⇨ SkyMovies has no access to or control over these cookies, once we have given permission for them to set cookies for advertising.
⇨ If you wish to disable cookies, you may do so through your individual browser options. more detailed information about cookie management with specific web browsers can be found at the browsers respective websites.
⇨ Traffic Reports Our industry-standard traffic reporting records ip addresses, internet service provider information, referrer strings, browser types and the date and time pages are loaded whenever you request a page through your browser. this information cannot be used to identify specific individuals, we use this information in the aggregate only to provide traffic statistics to advertisers and to figure out which features and editorials are most popular.
⇨ Security With respect to security, we use industry standard encryption technologies, when transferring and receiving data from visitors on our website.


The Frequently Asked Questions (FAQ) page gives you quick access to some of the most common questions about your plan. This lets you save time you might spend on a call with our call center or your HR department.
Click here to view FAQs covering Defined Benefit Plans.
Click here to view FAQs covering Defined Contribution Plans.
When am I eligible to participate in the retirement plan?
If you are an eligible Employee, you will participate in the plan once you have satisfied the eligibility requirements of the plan. See the plan document or Summary Plan Description.
Can I opt out of participation in the plan?
All eligible Employees are automatically enrolled in the plan. You may not opt out of participation in the retirement plan.
A defined benefit (DB) pension plan is a retirement plan in which your retirement benefits are known, but the contributions necessary to cover your benefits are not known. Benefits from DB plans are usually calculated based on a set formula using compensation and length of service, and benefits do not change due to market and economic fluctuations. DB plans are valued by actuaries each year to determine what level of contribution is needed by the participating Employer to fund future retirement benefits. A defined contribution (DC) plan, however, is a retirement plan in which contributions to the plan are known, but a participant's retirement benefits are not known. You make known contributions to your own DC plan account but your ultimate benefit from the plan will be impacted by market and economic fluctuations.
Can I contribute to the retirement plan?
No. Benefits from the plan are completely paid for by your Employer. You are not required or permitted to make any contributions to the plan.
What's the difference between Vesting Service and Credited Service?
Vesting Service determines whether you are eligible to receive a benefit. Credited Service is a component in the benefit formula to determine the amount of benefit you earn.
Vesting refers to the amount of Vesting Service you must earn before having a non-forfeitable right to your Accrued Benefit. When you are fully vested, your Accrued Benefit belongs to you, even if you leave the organization before reaching retirement age.
Your retirement benefit is generally a monthly benefit payable to you for your lifetime. It is calculated following the Accrued Benefit formula specified in the plan and is based on your Final Average Earnings and your Credited Service. In general, the higher your pay and the longer your service, the greater your retirement benefit will be.
When can I receive my benefit?
You may receive your benefit unreduced at your Normal Retirement Date. If you are eligible, you may receive a reduced benefit at your Early Retirement Date. Your benefit is reduced to account for the longer period of time it will be paid.
Please refer to your Summary Plan Description or the plan document for more information regarding your retirement benefit.
A 401(k) is a fairly simple plan. It is set up by your employer as a set contribution retirement agreement. That means you are the one who pays into the plan, although your employer and the plan provider who offers your 401(k) do just about all the work.
Your 401(k) contribution is automatically deducted from your paycheck each pay period. This money is taken out and invested before your paycheck is taxed. After you have decided what percentage you want deducted from your check, and how you want to invest it, your work is pretty much done.
Once the money is deducted from your paycheck, you can't spend it, but it is yours. It grows in your personal 401(k) account. Although you can withdraw the money for certain emergencies or in some cases borrow against your investment, the money is intended to stay in your account until you are at least 59 1/2.
While the investment is growing in your 401(k) account, you do not pay any taxes on it. When you withdraw the money at retirement, you pay taxes on the amount you withdraw from your account (so you pay taxes little by little instead of being hit with one big bill).
And in some cases, your employer makes their own contributions to your 401(k) plan. This is an option for your employer and they are not required to make a contribution. If they do chose to make a contribution, it takes the form of an employer match on your contribution. Usually the employer matches a certain percentage of your contribution. For example, an employer may elect to put in 50 cents for every dollar you contribute. That's an immediate return on your contribution, regardless of how you invest your 401(k) money. This contribution can be anywhere from a small percentage to an exact match of your contributions.
What are the advantages to a 401(k) plan?
There are many advantages to 401(k) plans.
The employee is able to contribute to his/her 401(k) with pre-tax money, it reduces the amount of tax they pay out of each pay check.
All employer contributions and any growth in the investment is able to be tax-free until withdrawal.
The employee can decide where to invest future contributions and/or current savings, giving much control over the investments to the employee.
If your company matches your contributions, it's like getting extra money on top of your salary.
Unlike a pension, all contributions can be moved from one company's plan to the next company's plan, or a special IRA, should a participant change jobs.
Because the program is a personal investment program for your retirement, it is protected by pension (ERISA) laws, which means that the benefits may not be used as security for loans outside the program. This includes the additional protection of the funds from garnishment or attachment by creditors or assigned to anyone else, except in the case of domestic relations court cases dealing with divorce decree or child support orders (QDROs; i.e., qualified domestic relations orders).
While the 401(k) is similar in nature to an IRA, an IRA won't enjoy any matching company contributions, and personal IRA contributions are subject to much lower limits.
What are the disadvantages to a 401(k)?
It is difficult (or at least expensive) to access your 401(k) savings before age 59 1/2.
Employer contributions are usually not vested (i.e., do not become the property of the employee) until a number of years have passed.
Each year, the Internal Revenue Service sets a maximum contribution limit for 401(k) accounts. For the 2011 tax year, the employee contribution limit is $16,500.
The maximum pre-tax contribution dollar amount is set by law and adjusted for inflation annually. The 2011 pre-tax contribution limit is $16,500. If you are age 50 or older you may also make an additional catch-up contribution of $5,500 per year. Some plans may offer you the option to contribute on an after-tax basis which is not included in the $16,500 limit. Note that plans may restrict employee contributions to an amount less than $16,500, and may also choose not to permit catch-up contributions.
In addition, there are special non-discrimination rules to prevent highly compensated employees (HCE) from being able to save substantially more than lower paid employees. If you earn more than $110,000 a year, or own 5 percent or more of the company, additional contribution caps may apply for you.
Can I stop contributing if I feel I can't afford to continue?
Most plans allow you to stop contributing at any time though employers are not required by law to do so. Some plans may require specific percentage contribution for a full plan year so be sure to check your plan rules.
The rules governing 401(k) plans allow plans to provide loans, but do not mandate that an employer make it a plan feature. Your summary plan description (SPD) will state whether or not your employer allows loans in your plan.
Most of the time loans are only allowed for the following reasons: (1) to pay education expenses for yourself, spouse, or child; (2) to prevent eviction from your home; (3) to pay un-reimbursed medical expenses; or (4) to buy a first-time residence. You must pay the loan back within five years, although this can be extended for the first-time home purchase.
Usually you are allowed to borrow up to 50% of your vested account balance to a maximum of $50,000 (set by law). Because of the cost, many plans will also set a minimum amount and restrict the number of loans you can have outstanding at any one time. Loan payments will generally be deducted from your payroll checks and, if married, you may need your spouse to consent to the loan. Funds obtained from a loan are not subject to income tax or the 10% early withdrawal penalty. If you should terminate your employment, often any unpaid loan will be distributed to you. This distribution will be subject to income tax and, if you are not at least 59½ years of age, the 10% withdrawal penalty.
Hardship withdrawals are allowed by law but your employer is not required to provide this option in your plan. The cost of administering such a program can be prohibitive for many small companies. Your summary plan description (SPD) will state whether or not your employer allows withdrawals in your plan.
The IRS code that governs 401(k) plans provides for hardship withdrawals only if: (1) the withdrawal is due to an immediate and heavy financial need; (2) the withdrawal must be necessary to satisfy that need (i.e. you have no other funds or way to meet the need); (3) the withdrawal must not exceed the amount needed by you; (4) you must have first obtained all distribution or nontaxable loans available under the 401k plan; and (5) you can't contribute to the 401(k) plan for 12 months (only six months after January 1, 2002) following the withdrawal.
What happens to my 401(k) account balances if I choose to leave or am fired from the company?
Your distribution options are the same whether you voluntarily leave or are terminated. If your account balance is more than $5,000.00 ($1,000 in some plans), you can leave your money in the plan. If you want to take your money with you, your vested account balance can be rolled into another 401(k) plan with your employer or put into an IRA to avoid early withdrawal penalties.
If you are vested in your retirement plan, you can take it with you when you leave the company. If you are 50% vested, you can take 50% of it with you when you go. In the case of a 401(k) plan, you are always 100% vested in the salary you defer into the plan.
I still have a 401(k) account with my former employer. I would like to transfer this account into my IRA. Can this be done? If so, are there any penalties?
Yes, this can be done and is referred to as a trustee to trustee transfer. You need to request the distribution forms from your former employer. Make sure you open your new IRA before the transfer so that you can provide the account information on the required forms. There are no penalties with a trustee to trustee transfer, but if you allow your former employer to send the funds directly to you and not to your new IRA, they will be required to deduct and remit 20% of the total to the IRS.
What information and reports is my employer required to provide me with on my 401(k) plan?
Your employer must provide you with a Summary Plan Description and an annual statement of your account information. You have a legal right to ask the plan administrator for a copy of the plan's latest Form 5500 or Form 5500-C/R, the summary plan description, the plan document, the trust agreement setting up the plan, if separate from the plan, and any collective bargaining contract, if appropriate, and any other instrument under which the plan was established or is operated.
In addition, you will often be provided a prospectus for every fund offered in the plan, but this is not legally required. If your company's stock is offered in the plan you are required to receive a prospectus on the company stock fund.
Unfortunately, Keogh plans that cover only you -- or you and your partners, but not employees -- are not governed or protected by ERISA. Neither are IRAs, whether traditional, Roth, SEP or SIMPLE.


While denim pieces are obviously a staple in any wardrobe, it can be a challenge to pair them together without creating a bit of a farmer-esque vibe. Unless that's specifically the look you're going for (which we assume it's not), here are a few tips to keep in mind the next time you decide to rock the denim-on-denim look.
Keep scrolling for five jean-ius ideas!
1. Pick a bright accessory.
Pairing a bright accessory like a colourful purse or scarf with your denim ensemble is an easy way to elevate your look from bland to chic.
While denim cutoffs may not seem particularly high fashion at first, you can pair them with a long jacket to create an unexpectedly cool look.
3. Reach for a statement piece.3. Reach for a statement piece.
Wear an embellished or patterned denim jacket that stands out for an easy outfit that will be both comfortable and stylish.
Something about denim and black just seems to have "rock star" written all over it. Wearing all-black denim pieces is a sure bet to create an effortlessly cool aesthetic.
When you're already wearing this much denim, it doesn't need to be front and center for people to get your point. Throw a nicer jacket over the denim, and pair it with a statement cuff for a look that's polished but casual.


text:
package org.dasein.cloud.qingcloud.compute;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.HttpUriRequest;
import org.dasein.cloud.CloudException;
import org.dasein.cloud.InternalException;
import org.dasein.cloud.ProviderContext;
import org.dasein.cloud.Tag;
import org.dasein.cloud.VisibleScope;
import org.dasein.cloud.compute.AbstractVMSupport;
import org.dasein.cloud.compute.Architecture;
import org.dasein.cloud.compute.Platform;
import org.dasein.cloud.compute.VMLaunchOptions;
import org.dasein.cloud.compute.VirtualMachine;
import org.dasein.cloud.compute.VirtualMachineCapabilities;
import org.dasein.cloud.compute.VirtualMachineLifecycle;
import org.dasein.cloud.compute.VirtualMachineProduct;
import org.dasein.cloud.compute.VirtualMachineProductFilterOptions;
import org.dasein.cloud.compute.VirtualMachineStatus;
import org.dasein.cloud.compute.VirtualMachineSupport;
import org.dasein.cloud.compute.VmState;
import org.dasein.cloud.compute.VmStatus;
import org.dasein.cloud.compute.VmStatusFilterOptions;
import org.dasein.cloud.compute.Volume;
import org.dasein.cloud.compute.VolumeAttachment;
import org.dasein.cloud.network.IPVersion;
import org.dasein.cloud.network.NICCreateOptions;
import org.dasein.cloud.network.RawAddress;
import org.dasein.cloud.qingcloud.QingCloud;
import org.dasein.cloud.qingcloud.compute.model.DescribeInstancesResponseModel;
import org.dasein.cloud.qingcloud.compute.model.RunInstancesResponseModel;
import org.dasein.cloud.qingcloud.model.SimpleJobResponseModel;
import org.dasein.cloud.qingcloud.util.requester.QingCloudDriverToCoreMapper;
import org.dasein.cloud.qingcloud.util.requester.QingCloudRequestBuilder;
import org.dasein.cloud.qingcloud.util.requester.QingCloudRequester;
import org.dasein.cloud.util.APITrace;
import org.dasein.cloud.util.Cache;
import org.dasein.cloud.util.CacheLevel;
import org.dasein.cloud.util.requester.fluent.Requester;
import org.dasein.util.uom.storage.Megabyte;
import org.dasein.util.uom.storage.Storage;
import org.dasein.util.uom.time.TimePeriod;
import org.dasein.util.uom.time.Week;
import org.json.JSONArray;
import org.json.JSONObject;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * Created by Jeffrey Yan on 11/24/2015.
 *
 * @author Jeffrey Yan
 * @since 2016.02.1
 */
public class QingCloudVirtualMachine extends AbstractVMSupport<QingCloud> implements VirtualMachineSupport {

    protected QingCloudVirtualMachine(QingCloud provider) {
        super(provider);
    }

    @Nonnull
    @Override
    public VirtualMachineCapabilities getCapabilities() throws InternalException, CloudException {
        return new QingCloudVirtualMachineCapabilities(getProvider());
    }

    @Override
    public boolean isSubscribed() throws CloudException, InternalException {
        return true;
    }

    @Nonnull
    @Override
    public VirtualMachine launch(@Nonnull VMLaunchOptions withLaunchOptions) throws CloudException, InternalException {
        APITrace.begin(getProvider(), "VirtualMachine.launch");
        try {
            QingCloudRequestBuilder requestBuilder = QingCloudRequestBuilder.put(getProvider()).action("RunInstances");

            requestBuilder.parameter("zone", withLaunchOptions.getDataCenterId());
            requestBuilder.parameter("image_id", withLaunchOptions.getMachineImageId());
            requestBuilder.parameter("instance_type", withLaunchOptions.getStandardProductId());
            requestBuilder.parameter("count", "1");
            requestBuilder.parameterIfNotNull("instance_name", withLaunchOptions.getHostName());

            if (withLaunchOptions.getBootstrapKey() != null) {
                requestBuilder.parameter("login_mode", "login_keypair");
                requestBuilder.parameter("login_keypair", withLaunchOptions.getBootstrapKey());
            } else if (withLaunchOptions.getBootstrapPassword() != null) {
                requestBuilder.parameter("login_mode", "login_passwd");
                requestBuilder.parameter("login_passwd", withLaunchOptions.getBootstrapPassword());
            }

            if (withLaunchOptions.getSubnetId() != null) {
                if (withLaunchOptions.getPrivateIp() != null) {
                    requestBuilder.parameter("vxnets.1", withLaunchOptions.getSubnetId() + "|" + withLaunchOptions.getPrivateIp());
                } else {
                    requestBuilder.parameter("vxnets.1", withLaunchOptions.getSubnetId());
                }
            } else if(withLaunchOptions.getNetworkInterfaces() != null && withLaunchOptions.getNetworkInterfaces().length > 0 ) {
                int index = 1;
                for (VMLaunchOptions.NICConfig nicConfig : withLaunchOptions.getNetworkInterfaces()) {
                    NICCreateOptions nicCreateOptions = nicConfig.nicToCreate;
                    if(nicCreateOptions.getIpAddress() != null) {
                        requestBuilder.parameter("vxnets." + index, nicCreateOptions.getSubnetId() + "|" + nicCreateOptions.getIpAddress());
                    } else {
                        requestBuilder.parameter("vxnets." + index, nicCreateOptions.getSubnetId());
                    }

                    index++;
                }
            }

            //actually, security is needed only when subnet is vxnet-0
            requestBuilder.parameterIfNotNull("security_group", withLaunchOptions.getFirewallIds()[0]);

            int volumeIndex = 1;
            for (VolumeAttachment volumeAttachment : withLaunchOptions.getVolumes()) {
                requestBuilder.parameter("volumes." + volumeIndex, volumeAttachment.getExistingVolumeId());
                volumeIndex++;
            }

            if (withLaunchOptions.getUserData() != null) {
                requestBuilder.parameter("need_userdata", 1);
                requestBuilder.parameter("userdata_type", "plain");
                requestBuilder.parameter("userdata_value", Base64.encodeBase64String(withLaunchOptions.getUserData().getBytes()));
            } else {
                requestBuilder.parameter("need_userdata", 0);
            }

            requestBuilder.parameter("instance_class", 1);//use high performance type, although no doc found

            HttpUriRequest request = requestBuilder.build();

            Requester<RunInstancesResponseModel> requester = new QingCloudRequester<RunInstancesResponseModel, RunInstancesResponseModel>(
                    getProvider(), request, RunInstancesResponseModel.class);

            RunInstancesResponseModel runInstancesResponseModel = requester.execute();
            //TODO, handle tags
            return getVirtualMachine(runInstancesResponseModel.getInstances().get(0));
        } finally {
            APITrace.end();
        }
    }

    @Override
    public void reboot( @Nonnull String vmId ) throws CloudException, InternalException {
        APITrace.begin(getProvider(), "VirtualMachine.reboot");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("RestartInstances")
                    .parameter("instances.1", vmId)
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();
        } finally {
            APITrace.end();
        }
    }

    @Override
    public void start( @Nonnull String vmId ) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.start");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("StartInstances")
                    .parameter("instances.1", vmId)
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();
        } finally {
            APITrace.end();
        }
    }

    @Override
    public void stop( @Nonnull String vmId, boolean force ) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.stop");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("StopInstances")
                    .parameter("instances.1", vmId)
                    .parameter("force", force ? "1" : "0")
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();
        } finally {
            APITrace.end();
        }
    }

    @Override
    public void terminate(@Nonnull String vmId, @Nullable String explanation) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.terminate");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("TerminateInstances")
                    .parameter("instances.1", vmId)
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();
        } finally {
            APITrace.end();
        }
    }

    @Override
    public @Nullable VirtualMachineProduct getProduct( @Nonnull String productId ) throws InternalException, CloudException {
        Iterator<VirtualMachineProduct> virtualMachineProductIterator = listAllProducts().iterator();
        while (virtualMachineProductIterator.hasNext()) {
            VirtualMachineProduct virtualMachineProduct = virtualMachineProductIterator.next();
            if (virtualMachineProduct.getProviderProductId().equals(productId)) {
                return virtualMachineProduct;
            }
        }
        return null;
    }

    @Override
    public @Nonnull Iterable<VirtualMachineProduct> listProducts(@Nonnull String machineImageId, @Nonnull VirtualMachineProductFilterOptions options) throws InternalException, CloudException {
        List<VirtualMachineProduct> result = new ArrayList<VirtualMachineProduct>();

        Iterator<VirtualMachineProduct> virtualMachineProductIterator = listAllProducts().iterator();
        while (virtualMachineProductIterator.hasNext()) {
            VirtualMachineProduct virtualMachineProduct = virtualMachineProductIterator.next();
            if (options.matches(virtualMachineProduct)) {
                result.add(virtualMachineProduct);
            }
        }
        return result;
    }

    @Override
    public @Nonnull Iterable<VirtualMachineProduct> listAllProducts() throws InternalException, CloudException {
        ProviderContext context = getProvider().getContext();
        if (context == null) {
            throw new CloudException("No context was set for this request");
        }

        Cache<VirtualMachineProduct> cache = Cache
                .getInstance(getProvider(), "vmProducts", VirtualMachineProduct.class, CacheLevel.REGION,
                        new TimePeriod<Week>(1, TimePeriod.WEEK));
        Iterable<VirtualMachineProduct> products = cache.get(context);
        if (products == null) {
            products = loadProductsDefinition(getProvider().getZoneId());
            cache.put(context, products);
        }
        return products;
    }

    private List<VirtualMachineProduct> loadProductsDefinition(String zoneId) throws InternalException {
        try {
            InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("/org/dasein/cloud/aws/vmproducts.json");
            JSONArray array = new JSONArray(IOUtils.toString(inputStream));

            Map<String, List<VirtualMachineProduct>> result = new HashMap<String, List<VirtualMachineProduct>>();

            for (int i = 0; i < array.length(); i++) {
                JSONObject definitionOfZone = array.getJSONObject(i);

                JSONArray instanceTypesOfZone = definitionOfZone.getJSONArray("instance_types");
                List<VirtualMachineProduct> productsOfZone = new ArrayList<VirtualMachineProduct>();
                for (int j = 0; j < instanceTypesOfZone.length(); j++) {
                    JSONObject instanceType = instanceTypesOfZone.getJSONObject(j);
                    VirtualMachineProduct product = new VirtualMachineProduct();
                    product.setProviderProductId(instanceType.getString("id"));
                    product.setName(instanceType.getString("id"));
                    product.setCpuCount(instanceType.getInt("cpu_count"));
                    product.setRamSize(
                            (new Storage<Megabyte>(instanceType.getInt("memory_size_in_mb"), Storage.MEGABYTE)));
                    productsOfZone.add(product);
                }
                result.put(definitionOfZone.getString("zone"), productsOfZone);
            }

            if (result.containsKey(zoneId)) {
                return result.get(zoneId);
            } else {
                return result.get("default");
            }
        } catch (Exception exception) {
            throw new InternalException("Not able to load vm product definition", exception);
        }
    }

    @Override
    public @Nonnull VirtualMachine alterVirtualMachineProduct(@Nonnull String virtualMachineId, @Nonnull String productId) throws InternalException, CloudException{
        APITrace.begin(getProvider(), "VirtualMachine.alterVirtualMachineProduct");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("ResizeInstances")
                    .parameter("instances.1", virtualMachineId)
                    .parameter("zone", getProvider().getZoneId())
                    .parameter("instance_type", productId)
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();

            return getVirtualMachine(virtualMachineId);
        } finally {
            APITrace.end();
        }
    }

    @Override
    public @Nonnull VirtualMachine alterVirtualMachineSize(@Nonnull String virtualMachineId, @Nullable String cpuCount, @Nullable String ramInMB) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.alterVirtualMachineSize");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("ResizeInstances")
                    .parameter("instances.1", virtualMachineId)
                    .parameter("zone", getProvider().getZoneId())
                    .parameter("cpu", cpuCount)
                    .parameter("memory", ramInMB)
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();

            return getVirtualMachine(virtualMachineId);
        } finally {
            APITrace.end();
        }
    }

    @Override
    public @Nonnull Iterable<String> listFirewalls( @Nonnull String vmId ) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.listFirewalls");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.get(getProvider())
                    .action("DescribeInstances")
                    .parameter("instances.1", vmId)
                    .parameter("zone", getProvider().getZoneId())
                    .parameter("verbose", "1").build();

            Requester<String> requester = new QingCloudRequester<DescribeInstancesResponseModel, String>(
                    getProvider(), request,
                    new QingCloudDriverToCoreMapper<DescribeInstancesResponseModel, String>() {
                        @Override
                        protected String doMapFrom(DescribeInstancesResponseModel responseModel) {
                            return responseModel.getInstances().get(0).getSecurityGroup().getSecurityGroupId();
                        }
                    }, DescribeInstancesResponseModel.class);

            String securityGroupId = requester.execute();
            return Arrays.asList(securityGroupId);
        } finally {
            APITrace.end();
        }
    }

    @Override
    public @Nonnull VirtualMachine alterVirtualMachineFirewalls(@Nonnull String virtualMachineId, @Nonnull String[] firewalls) throws InternalException, CloudException{
        APITrace.begin(getProvider(), "VirtualMachine.alterVirtualMachineFirewalls");
        try {
            if (firewalls == null || firewalls.length != 1) {
                throw new InternalException("QingCloud instance can have only one firewall");
            }

            HttpUriRequest request = QingCloudRequestBuilder.post(getProvider())
                    .action("ApplySecurityGroup")
                    .parameter("security_group", firewalls[0])
                    .parameter("instances.1", virtualMachineId)
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<SimpleJobResponseModel> requester = new QingCloudRequester<SimpleJobResponseModel, SimpleJobResponseModel>(
                    getProvider(), request, SimpleJobResponseModel.class);

            requester.execute();

            return getVirtualMachine(virtualMachineId);
        } finally {
            APITrace.end();
        }
    }

    @Override
    public @Nullable VirtualMachine getVirtualMachine( @Nonnull String vmId ) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.getVirtualMachine");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.get(getProvider())
                    .action("DescribeInstances")
                    .parameter("instances.1", vmId)
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<List<VirtualMachine>> requester = new QingCloudRequester<DescribeInstancesResponseModel, List<VirtualMachine>>(
                    getProvider(), request, new VirtualMachinesMapper(), DescribeInstancesResponseModel.class);

            List<VirtualMachine> result = requester.execute();
            if (result.size() > 0) {
                return result.get(0);
            } else {
                return null;
            }
        } finally {
            APITrace.end();
        }
    }

    @Override
    public @Nonnull Iterable<VirtualMachine> listVirtualMachines() throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.listVirtualMachines");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.get(getProvider())
                    .action("DescribeInstances")
                    .parameter("limit", "999")
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<List<VirtualMachine>> requester = new QingCloudRequester<DescribeInstancesResponseModel, List<VirtualMachine>>(
                    getProvider(), request, new VirtualMachinesMapper(), DescribeInstancesResponseModel.class);

            return requester.execute();
        } finally {
            APITrace.end();
        }
    }

    //TODO VM statistics

    @Override
    public @Nullable Iterable<VirtualMachineStatus> getVMStatus( @Nullable String... vmIds ) throws InternalException, CloudException {
        return getVMStatus(VmStatusFilterOptions.getInstance().withVmIds(vmIds));
    }

    @Override
    public @Nullable Iterable<VirtualMachineStatus> getVMStatus( @Nullable final VmStatusFilterOptions filterOptions ) throws InternalException, CloudException {
        APITrace.begin(getProvider(), "VirtualMachine.getVMStatus");
        try {
            HttpUriRequest request = QingCloudRequestBuilder.get(getProvider())
                    .action("DescribeInstances")
                    .parameter("limit", "999")
                    .parameter("zone", getProvider().getZoneId())
                    .build();

            Requester<List<VirtualMachineStatus>> requester = new QingCloudRequester<DescribeInstancesResponseModel, List<VirtualMachineStatus>>(
                    getProvider(), request,
                    new QingCloudDriverToCoreMapper<DescribeInstancesResponseModel, List<VirtualMachineStatus>>() {
                        @Override
                        protected List<VirtualMachineStatus> doMapFrom(DescribeInstancesResponseModel responseModel) {
                            List<VirtualMachineStatus> result = new ArrayList<VirtualMachineStatus>();
                            for (DescribeInstancesResponseModel.Instance instance : responseModel.getInstances()) {
                                VirtualMachineStatus virtualMachineStatus = new VirtualMachineStatus();
                                virtualMachineStatus.setProviderHostStatus(getHostStatus());
                                virtualMachineStatus.setProviderVmStatus(getVmStatus());
                                virtualMachineStatus.setProviderVirtualMachineId(instance.getInstanceId());

                                if (filterOptions.matches(virtualMachineStatus)) {
                                    result.add(virtualMachineStatus);
                                }
                            }
                            return result;
                        }
                    }, DescribeInstancesResponseModel.class);

            return requester.execute();
        } finally {
            APITrace.end();
        }
    }

    @Override
    public void updateTags( @Nonnull String vmId, @Nonnull Tag... tags ) throws CloudException, InternalException {
        // TODO, tags
    }

    @Override
    public void removeTags( @Nonnull String vmId, @Nonnull Tag... tags ) throws CloudException, InternalException {
        // TODO, tags
    }

    private VmStatus getVmStatus() {
        return VmStatus.OK;
    }

    private VmStatus getHostStatus() {
        return VmStatus.OK;
    }

    private class VirtualMachinesMapper extends QingCloudDriverToCoreMapper<DescribeInstancesResponseModel, List<VirtualMachine>>{
        @Override
        protected List<VirtualMachine> doMapFrom(DescribeInstancesResponseModel responseModel) {
            try {
                List<VirtualMachine> virtualMachines = new ArrayList<VirtualMachine>();

                for(DescribeInstancesResponseModel.Instance instance : responseModel.getInstances()) {
                    VirtualMachine virtualMachine = new VirtualMachine();
                    virtualMachine.setProviderVirtualMachineId(instance.getInstanceId());
                    virtualMachine.setProductId(instance.getInstanceType());
                    virtualMachine.setProviderVolumeIds(instance.getVolumeIds().toArray(new String[0]));
                    virtualMachine.setVolumes(listVolumes(instance.getVolumeIds()));
                    virtualMachine.setProviderNetworkInterfaceIds(collectNetworkInterfaceIds(instance.getVxnets()));
                    virtualMachine.setPrivateAddresses(collectPrivateIpAddresses(instance.getVxnets()));
                    //TODO, private subnet ids not set, because only one allowed for dasein model
                    virtualMachine.setPublicAddresses(new RawAddress(instance.getEip().getEipAddr(), IPVersion.IPV4));
                    virtualMachine.setCurrentState(mapVmState(instance.getStatus(), instance.getTransitionStatus()));
                    virtualMachine.setStateReasonMessage(instance.getTransitionStatus());
                    virtualMachine.setName(instance.getInstanceName());
                    virtualMachine.setCreationTimestamp(
                            getProvider().parseIso8601Date(instance.getCreateTime()).getTime());
                    virtualMachine.setDescription(instance.getDescription());
                    virtualMachine.setProviderFirewallIds(
                            new String[] { instance.getSecurityGroup().getSecurityGroupId() });
                    virtualMachine.setProviderMachineImageId(instance.getImage().getImageId());
                    virtualMachine.setArchitecture(mapArchitecture(instance.getImage().getProcessorType()));
                    virtualMachine.setPlatform(Platform.guess(instance.getImage().getOsFamily()));
                    virtualMachine.setProviderShellKeyIds(instance.getKeypairIds().toArray(new String[0]));

                    virtualMachine.setProviderRegionId(getContext().getRegionId());
                    virtualMachine.setProviderDataCenterId(getProvider().getZoneId());
                    virtualMachine.setProviderOwnerId(getContext().getAccountNumber());
                    //TODO, set tags
                    virtualMachine.setImagable(getCapabilities().canStop(virtualMachine.getCurrentState()));
                    virtualMachine.setRebootable(getCapabilities().canReboot(virtualMachine.getCurrentState()));

                    virtualMachine.setClonable(false);
                    virtualMachine.setPausable(false);
                    virtualMachine.setPersistent(true);
                    virtualMachine.setProviderVmStatus(getVmStatus());
                    virtualMachine.setProviderHostStatus(getHostStatus());
                    virtualMachine.setLifecycle(VirtualMachineLifecycle.NORMAL);
                    virtualMachine.setVisibleScope(VisibleScope.ACCOUNT_DATACENTER);
                }

                return virtualMachines;
            } catch (Exception exception) {
                throw new RuntimeException(exception);
            }
        }

        private Architecture mapArchitecture(String architecture) {
            if("64bit".equals(architecture)) {
                return Architecture.I64;
            } else {
                return Architecture.I32;
            }
        }

        private VmState mapVmState(String state, String transitionState) {
            if (transitionState != null && !transitionState.equals("")) {
                return VmState.PENDING;
            }

            if ("pending".equals(state)) {
                return VmState.PENDING;
            } else if ("running".equals(state)) {
                return VmState.RUNNING;
            } else if ("stopped".equals(state)) {
                return VmState.STOPPED;
            } else if ("suspended".equals(state)) {
                return VmState.SUSPENDED;
            } else if ("terminated".equals(state) || "ceased".equals(state)) {
                return VmState.TERMINATED;
            } else {
                return null;
            }
        }

        private RawAddress[] collectPrivateIpAddresses(List<DescribeInstancesResponseModel.Instance.Vxnet> vxnets) {
            RawAddress[] result = new RawAddress[vxnets.size()];
            for (int i = 0; i < vxnets.size(); i++) {
                DescribeInstancesResponseModel.Instance.Vxnet vxnet = vxnets.get(i);
                result[i] = new RawAddress(vxnet.getPrivateIp(), IPVersion.IPV4);
            }
            return result;
        }

        private String[] collectNetworkInterfaceIds(List<DescribeInstancesResponseModel.Instance.Vxnet> vxnets) {
            String[] result = new String[vxnets.size()];
            for (int i = 0; i < vxnets.size(); i++) {
                DescribeInstancesResponseModel.Instance.Vxnet vxnet = vxnets.get(i);
                result[i] = vxnet.getNicId();
            }
            return result;
        }

        private Volume[] listVolumes(List<String> volumeIds) {
            try {
                Volume[] result = new Volume[volumeIds.size()];
                for (int i = 0; i < volumeIds.size(); i++) {
                    String volumeId = volumeIds.get(i);
                    result[i] = getProvider().getComputeServices().getVolumeSupport().getVolume(volumeId);
                }
                return result;
            } catch (Exception exception) {
                throw new RuntimeException(exception);
            }
        }
    }
}


One of the tenets of ABA is to provide evidence-based practice. The best way to help us do this is to keep up with the literature! Each month, Sam Blanco, Ph.D., LBA, BCBA will select one journal article and provide discussion questions for professionals working within the ABA community. The following week another ABA professional will respond to Sam's questions and provide further insight and a different perspective on the piece.
In my daily work, I supervise Registered Behavior Technicians (RBTs) who are providing the direct care to my clients with autism. The RBT designation is only a few years old, and there are concerns about the training and maintenance of skills for these employees. However, another concern is the low number of people available to provide frontline services for high number of individuals who require it.
The work that RBTs do is important and necessary. It's important for our field, as well as individual organizations and BCBAs to identify potential problems with the current model of providing treatment, and work to continuously improve upon the model. One way to start the conversation within your own organization is to read the following article and identify ways in which you can address the concerns it brings to light.
Leaf, J. B., Leaf, R., McEachin, J., Taubman, M., Smith, T., Harris, S. L., … & Volkmar, F. R. (2017). Concerns about the Registered Behavior Technician™ in relation to effective autism intervention. Behavior Analysis in Practice, 10(2), 154-163.
The authors discuss the evolution of the BACB and concerns with certifying behavior analysts prior to the advent of RBTs. What did you think of the concerns identified here? Are these still concerns we have about BCBAs? How are they similar or different than concerns about RBTs?
How does the current training of RBTs compare to the training of behavior technicians in early behavior analytic studies?
Look at the RBT task list. The authors argue that the current amount of training does not meet standards set forth by research on staff training. How can BCBAs and organizations hiring RBTs support their mastery of the skills on this list?
Have you identified concerns with the current model (BCBAs supervising RBTs who provide direct care) that were not mentioned in the article? If so, how have you worked to address those concerns?
Discuss the unintended consequences described in the article. Have you seen these consequences in your current setting?
Many of the recommendations by the authors include changes the BACB should enact as well as research that should be conducted. How are you able to take a role in these types of recommendations?
The founder of ABA Journal Club, Sam is an ABA provider for students ages 3-15 in NYC. Working in education for twelve years with students with Autism Spectrum Disorders and other developmental delays, Sam utilizes strategies for achieving a multitude of academic, behavior, and social goals. She is also an assistant professor in the ABA program at The Sage Colleges.
Ask A BCBA: I'm a Brand-New BCBA! What Should I Expect??
Ask A BCBA is a new series where we take your questions to our favorite ABA professionals. Do you have a question for a BCBA? Email us at info@difflearn.com and you could be featured in a future post!
Congratulations on passing your BACB exam! Not only did you pass this notoriously difficult test, but you completed hundreds of hours of graduate coursework and supervised experience to get to this point. You had to have been dedicated and hard-working. You have demonstrated your knowledge to your supervisor(s) and on a written exam. You should feel proud!
You are now entrusted with the tools to change behavior, shape new skills, and make lives better. Make no mistake, this is a big responsibility. As a BCBA, you are expected to be proficient in all of the skills of a behavior analyst (as per the BACB task list) and to abide by the BACB Code of Ethics. Part of the ethical code is that there is no excuse for not knowing the ethical code.
Some new BCBAs feel overwhelmed by their new responsibilities. This is completely normal, and not a bad thing if it leads you to approach your new position with respect and caution. Here are some suggestions for easing this transition and building your confidence.
Maintain contact with your supervisor or another mentor. Most supervisors are happy to continue to have some continued less-structured contact to provide guidance. Other seasoned BCBAs in your community might also be open to providing some informal mentoring.
Join a community of other BCBAs. There are so many options for how to do this. Joining your state ABA association is an excellent idea if you haven't done so already. If you are a social media person, there are many Facebook groups for BCBAs. Other BCBAs at your job may want to connect, too.
Keep your resources handy. Yes, I realize that you probably never want to see "The White Book" again – at least for a while – but don't be afraid to look something up if you're not sure. Although you passed the exam, you may still need a refresher on less-familiar concepts when they come up in your work.
Start collecting CEUs! Yes, now! You need to document at least 32 CEUs every 2 years, so don't fall behind.
Subscribe to journals. JABA is not expensive, even when you are no longer a student, and you may not have access to your university library anymore.
Remember that learning is a lifelong journey. Even though you have made an amazing accomplishment, you aren't expected to know everything. Take the energy and enthusiasm that got you to this point, and use them to continue to develop your skills and your network. As B.F. Skinner wrote in Walden Two, "It is not a question of starting. The start has been made. It's a question of what's to be done from now on." The hard part is over, so go ahead and make the most of your accomplishment!
Dana Reinecke, Ph.D., BCBA-D is a doctoral level Board-Certified Behavior Analyst (BCBA-D) and a New York State Licensed Behavior Analyst (LBA). Dana is a Core Faculty member in the Applied Behavior Analysis department at Capella University. She is also co-owner of SupervisorABA, an online platform for BACB supervision curriculum, forms, and hours tracking. Dana provides training and consultation to school districts, private schools, agencies, and families for individuals with disabilities. She has presented original research and workshops on the treatment of autism and applications of ABA at regional, national, and international conferences. She has published her research in peer-reviewed journals, written chapters in published books, and co-edited books on ABA and autism. Current areas of research include use of technology to support students with and without disabilities, self-management training of college students with disabilities, and online teaching strategies for effective college and graduate education. Dana is actively involved in the New York State Association for Behavior Analysis (NYSABA).
What Is Procedural Fidelity In ABA?
It is not uncommon for parents or practitioners to implement a new intervention that appears to be working well, then after a few weeks or months report that the intervention has stopped working. Often, the change in behavior in feels like a mystery and leaves people scrambling for a new intervention. But before searching for a new intervention, you should consider the possibility of problems with procedural fidelity, which "refers to the accuracy with which the intervention or treatment is implemented" (Mayer, Sulzer-Azaroff, & Wallace, 2014).
Post the steps in a visible spot. Clearly list the steps of the procedure and put them in a spot where you will see them often. This might be on the actual data collection sheet or on the wall. One parent I worked with had a Post-it® note with the steps for our intervention attached to her computer screen. Another parent kept the steps inside the ID part of his wallet, where they were protected and visible each time he opened his wallet.
Plan meetings to go over the steps. As part of your intervention, set brief monthly or quarterly meetings to go over the steps of the intervention and be sure everyone is maintaining procedural fidelity.
Assess for procedural fidelity. Schedule observations to ensure that each step of the intervention is implemented as described. If you do not have someone who can supervise you, take video of yourself implementing the intervention, watch it and compare your actions to the steps outlined in the intervention plan.
Outline steps for systematic fading of the intervention. When implementing an intervention, the goal is to have the learner eventually exhibiting the desirable behavior without prompts or planned reinforcement. Sometimes when a parent or practitioner sees the learner's behavior improving, they begin to remove the prompts or planned reinforcement before the learner is quite ready for it. By writing a plan for fading the intervention into the plan, you make it clear to everyone involved what the requirements are for each step towards mastery.
Mayer, G.R., Sulzer-Azaroff, B., & Wallace, M. (2014). Behavior analysis for lasting change (3rd ed.). Cornwall-on-Hudson, NY: Sloan Publishing.
Sam is an ABA provider for school-aged students in Brooklyn, New York. Working in education for over 15 years with students with Autism Spectrum Disorders and other developmental delays, Sam utilizes strategies for achieving a multitude of academic, behavior, and social goals. She is also an assistant professor in the ABA program at The Sage Colleges and the Senior Clinical Strategist at Encore Support Services.
This month's ASAT feature comes to us from Megan McCarron, MS, BCBA. To learn more about ASAT, please visit their website at www.asatonline.org. You can also sign up for ASAT's free newsletter, Science in Autism Treatment, and like them on Facebook!
I am a BCBA working in an ABA Teaching Home. I am adept with teaching play skills to younger children but would like some guidance on assessing interests and helping young adults develop hobbies that they can pursue in an independent and meaningful manner.
This is a very important question. There is an abundance of research on how to teach leisure activities using instructional methods such as modeling, video modeling, and activity schedules, moreover, it is vital that careful thought and planning be put into selecting and individualizing leisure activities.
Typically, one's interests are developed over time via exposure to and interaction with new and varied people, places, and activities. Exposure usually occurs over the course of life without much forethought, resulting in interests that shift and change. Unfortunately, this is often not the case for individuals with autism spectrum disorder (ASD).
There are two key deficits within the diagnostic criteria for ASD that are likely to impact individuals' exposure to and interaction within varied leisure activities. First, persistent limitations in social communication and social interaction can hinder an individual's ability to request access to items and activities, and/or to express one's level of interest. Second, the presence of restricted, repetitive patterns of behavior, interests, or activities may prevent an individual from exploring novel items or activities.
Individuals' difficulty making or expressing choice limit exposure to new and varied items and activities. Limited interests or those that are markedly different from those of same-aged peers make it that much more difficult to determine ways to expand and develop interests. As a result, careful thought and planning are required to help individuals with autism engage in meaningful leisure activities.
Identify shared interests. In addition to identifying activities by exploring and expanding upon current interests of the individual, it can be worthwhile to identify interests of the people the individual spends a lot of time with and activities available in the individual's school, home, and local community. These activities will offer up the opportunity for social interaction with others.
Once potential activities are selected, assessments can be conducted to determine how preferred the activities are. While preference assessments are commonly used and talked about in terms of finding reinforcers, they are equally useful for assessing preference levels for potential leisure activities. Initially, free operant assessments are very helpful in terms of assessing potential leisure activities. These can be conducted in the natural environment or a contrived and enriched setting.
Free operant preference assessments can be conducted through direct observation by providing free access to activities without demands, time limits or requirements to use items in a predetermined manner (unless it is a safety issue). Assessments can be conducted in either a natural or contrived setting, as described below (Toner, 2014; Chazin & Ledford, 2016).
If the individual interacts with an item in an unexpected or unusual manner, make note of what he or she did.
Once the free operant assessment data have been collected and ranked in order of which activities were engaged with the most (e.g., by calculating a percentage of time of the observation in which the student engaged in each activity), subsequent paired choice preference assessments or MSWO assessments could be conducted to better assess the individual's relative preference for activities. With this information, you can make an informed choice about what activities are likely to provide "enjoyment" and thus fit the definition of leisure.
It is important to help an individual build a repertoire of activities that can be used to fill the various functions of leisure. Therefore, the activities chosen as a focus of teaching should cover a variety of leisure situations.
Social Activities (any activity done with another person).
Individual Activity (any activity that can be done alone).
Some activities may be adaptable enough to be used across several leisure functions. For example, listening to music can be a social or individual activity; it can easily be paired with a variety of health and fitness activities and can be used for short or long durations.
In addition to selecting specific activities/skills for leisure, it is advisable to include an objective in a student's IEP that targets the individual's exposure to leisure activities. The goal of this objective would be to have the student continue to try out new activities over three to four opportunities to further expose them to new activities. During the sampling sessions, staff should collect data on duration of engagement, observable signs of affect, and any skill deficits that inhibit engagement.
While identifying preferred activities is a major part of building a leisure repertoire, there are a whole host of skills that can increase an individual's ability to access and engage in leisure activities as independently as possible.
Ensure the individual has an effective means of communication. An essential skill, regardless of the individual's vocal verbal ability, is teaching an appropriate way to request access to activities, especially those that are not readily available in the current environment such as requesting to go to the mall or to a specific store (Schneiter & Devine, 2001). Equally important is the ability for an individual to appropriately decline participation and/or end an activity when the activity is not preferred.
If a Sampling Leisure Activities objective has been included in the IEP, the sampling period can be used to help identify what types of prerequisite skills may need to be taught.
The individual may need to be taught skills related to any materials or equipment required for an activity. For example, gathering equipment / materials prior to starting the activity; caring for the equipment / materials putting equipment away when finished, and problem solving (e.g., what to do if materials are missing, broken, or need to be replenished).
Time management skills, such as identifying when it is time to engage in a leisure activity, selecting an activity that fits the amount of time for leisure, identifying when activities are essential components of increasing independence. Using schedules and calendars can be helpful to structure and prompt leisure activities but may require specific teaching. For example, using a calendar app on a phone can be very useful, but it may be necessary to start off with teaching the student to respond to an alert to engage in an activity and build up to having them enter information into the calendar.
Every individual has different interests, abilities, and obstacles to work through in establishing leisure skills. However, building on and expanding from high preference, high availability activities and using evidence-based assessment and teaching strategies to establish independence in leisure activities provides a strong foundation from which to start.
Blum-Dimaya, A., Reeve, S. A., Reeve, K. F., & Hoch, H. (2010). Teaching children with autism to play a video game using activity schedules and game-embedded simultaneous video modeling. Education & Treatment of Children, 33(3), 351-370.
Carlile, K. A., Reeve, S. A., Reeve, K. F., & DeBar, R. M. (2013). Using activity schedules on the iPod touch to teach leisure skills to children with autism. Education & Treatment of Children, 36(2), 33-57.
Carr, J. E., Nicolson, A. C., & Higbee, T. S. (2000). Evaluation of a brief multiple-stimulus preference assessment in a naturalistic context. Journal of Applied Behavior Analysis, 33(3), 353-357.
Chan, J. M., Lambdin, L., Van Laarhoven, T., & Johnson J. W. (2013). Teaching leisure skills to an adult with developmental disabilities using a video prompting intervention package. Education and Training in Autism and Developmental Disabilities, 48(3), 412-420.
Fisher, W. W., Piazza, C. C., Bowman, L. G., & Amari, A. (1996). Integrating caregiver report with a systematic choice assessment. American Journal on Mental Retardation, 101(1), 15-25.
Google Search. https://www.google.com/search?q=define+leisure&ie=utf-8&oe=utf-8&client=firefox-b-1 (accessed February 5, 2017).
Graff, R. B., & Karsten, A. M. (2012). Assessing preferences of individuals with developmental disabilities: A survey of current practices. Behavior Analysis in Practice, 5(2), 37-48.
MacDuff, G. S., Krantz, P. J., & McClannahan, L. E. (1993). Teaching children with autism to use photographic activity schedules: Maintenance and generalization of complex response chains. Journal of Applied Behavior Analysis, 26(1), 89-97.
Schneiter, R., & Devine, M. A. (2001). Reduction of self-injurious behaviors of an individual with autism: Use of a leisure communication book. Therapeutic Recreation Journal, 35(3), 207-219.
Toner, N. (2014). How do you figure out what motivates your students? Science in Autism Treatment, 11(1), 12-14.
McCarron, M. (2018). Leisure skills for adults with autism. Science in Autism Treatment, 15(2), 19-26.
Megan McCarron M.S., BCBA, LBA (CT) holds a Master of Science Degree in Child Development, is a Board Certified Behavior Analyst, and Licensed Behavior Analyst in the state of Connecticut. She has been in the field of autism treatment since 1992. Megan has experience providing services for children with autism in school, home and community settings. She has worked at Milestones Behavioral Services (formerly, The Connecticut Center for Child Development, Inc.) since 1999. During her time at Milestones, she has served in various capacities. She started out as an instructor and is now a Clinical Director. In addition to her responsibilities in and around Milestones, Megan presents lectures and workshops on autism and Behavior Analysis at local and national conferences.
When I first came across this study, "Behavioral Training for Siblings of Autistic Children," I was immediately hesitant. There's something about the idea of sibling-as-therapist that makes me cringe a little bit. When I work with the families of children with autism, the hope is that the siblings of the child with autism still have a childhood without being pushed into the role of caregiver. And I also want the child with autism to have independence and feel like an individual who is heard, which may be more challenging if their siblings are issuing demands just as a parent or teacher would. But as I read the study, I realized that the work they completed had incredible social significance.
In the study, there were three pairs of siblings. The ages of the children with autism ranged from 5 years old to 8 years old. The ages of the siblings ranged from 8 years old to 13 years old. The researchers trained each sibling of a child with autism how to teach basic skills, such as discriminating between different coins, identifying common objects, and spelling short words. As part of this training, the researchers showed videos of one-on-one sessions in which these skills were taught, utilizing techniques such as reinforcement, shaping, and chaining. What the researchers did next was the part that really stood out to me: they discussed with the siblings how to use these techniques in other environments. Finally, the researchers observed the sibling working with their brother/sister with autism and provided coaching on the techniques.
It should be noted here that the goal of the study was not to have the siblings become the teacher of basic skills. Instead, it was to provide a foundation of skills in behavioral techniques for the sibling to use in other settings with the hope of overall improvement in the behaviors of the child with autism. The researchers demonstrated that, after training, the siblings were able to effectively use prompts, reinforcement, and discrete trials to effectively teach new skills. But, perhaps the most meaningful aspects of the study were the changes reported by both siblings and parents. The researchers provide a table showing comments about the sibling with autism before and after the training. One of the most striking comments after the training was, "He gets along better if I know how to ask him" (p. 136). Parents reported that they were pleased with the results and found the training beneficial.
This study provides excellent evidence that structured training for siblings has real potential for making life a little easier for the whole family. The idea isn't that they become the therapist, but instead that knowledge truly is power.
Schriebman, L., O'Neill, R.E. & Koegel, R.L. (1983). Behavioral training for siblings of autistic children. Journal of Applied Behavior Analysis. 16(2), 129-138.
One of the tenets of ABA is to provide evidence-based practice. The best way to help us do this is to keep up with the literature! Each month, Sam Blanco, PhD, LBA, BCBA will select one journal article and provide discussion questions for professionals working within the ABA community. The following week another ABA professional will respond to Sam's questions and provide further insight and a different perspective on the piece.
Head to our Facebook page to join the discussion and let us know your thoughts!
It is important in our field to maintain an open conversation about ethics. The Professional and Ethical Compliance Code outlines how behavior analysts are expected to conduct themselves, but sometimes situations are not so black and white. And as the world changes, so do the expectations for ethical conduct. In recent years, issues related to social media have been especially relevant. This month, I've selected the following article which addresses the special concerns that come up with the use of social media.
O'Leary, P. N., Miller, M. M., Olive, M. L., & Kelly, A. N. (2017). Blurred lines: Ethical implications of social media for behavior analysts. Behavior Analysis in Practice, 10(1), 45-51 .
The article reviews the codes of ethics for other professions. Why is this valuable for us to do as a profession? Did you learn anything surprising or interesting form this portion of the article?
Since this article was written, our field has a new Professional and Ethical Compliance Code. How does this code differ from the previously used Guidelines for Responsible Conduct? What aspects of the code directly apply to ethical situations related to social media?
"A search on an internet search engine for information related to a procedure or scientific concept may yield results as to what that procedure or concept is. The same search on a social media outlet may yield results as to whether or not that procedure or concept should be used (p. 47.) Discuss this difference.
Behavior analysts and others interested in the topic may turn to social media to get answers to their questions due to the low response effort involved and the speed of reinforcement. How can we decrease response effort and increase reinforcement for referring to the scientific literature to answer our questions?
The authors provide suggestions for how behavior analysts should behave on social media. Are there any suggestions you might add? Are there ways you can increase the likelihood of other behavior analysts following these suggestions?
Consider your own behavior on social media. Based on recommendations from the article, what is one change you can make to increase your own ethical behavior in this context?
Sam is an ABA provider for students ages 3-15 in NYC. Working in education for twelve years with students with Autism Spectrum Disorders and other developmental delays, Sam utilizes strategies for achieving a multitude of academic, behavior, and social goals. She is also an assistant professor in the ABA program at The Sage Colleges.
Unemployment rates in the autism community are alarming, but the number of individuals entering the workforce only continues to grow. This presents an overwhelming challenge for special educators tasked with preparing learners for what is often an uncertain future. Vocational training is essential as learners with autism approach the transition to adulthood. With this in mind, Nassau Suffolk Services for Autism (NSSA) introduced The Salad Shoppe in the fall of 2017.
The curriculum was developed by Kathryn Reres and Rebecca Chi, devoted special educators determined to ensure dignified and purposeful futures for the eight young adult students in their classroom. The focus was to create a program that would provide functional tasks for each learner based on their individual skills, interests and IEP goals. The result was an innovative vocational training curriculum that highlights the strengths of each participant, introduces new skills into their everyday lives and serves as a profitable social enterprise.
In partnership with Different Roads to Learning, the creative teachers who designed The Salad Shoppe for NSSA are sharing their expertise with special educators everywhere. The published curriculum will allow teachers to implement The Salad Shoppe in a way that will best function for the learners they serve. Now more than ever, there is a crucial need to provide young adults with autism with the tools they will need to take on the competitive workforce. The Salad Shoppe is a cutting-edge curriculum that has opened new doors for educators, learners and parents and will continue to change the landscape of vocational training.
Ready to bring The Salad Shoppe to your school? You can save 15% on this incredible program now through February 18th!


The abbreviation of the journal title "American journal of recreation therapy" is "Am. J. Recreat. Ther.". It is the recommended abbreviation to be used for abstracting, indexing and referencing purposes and meets all criteria of the ISO 4 standard for abbreviating names of scientific journals.
recreation Recreat. matches the word "recreation"


1. Slice strawberries and banana.
2. Spoon yogurt into four clear glasses. Top with granola and fruit.
3. Add a second layer of yogurt, granola and fruit. Dig in!
This article first appeared in the September 2016 issue of Clubhouse magazine; used by permission. Photo © FOTF/Jenny Dillon.


text:
Graeme Edgeler on STV
For those who want more on how to vote under STV, and a different view from mine posted yesterday, see Graeme Edgeler's guide to STV.
Of the many illuminating comments on Graeme's post one from Steve Todd stands out for interest to Wellingtonians
While it is perfectly valid to vote, simply by placing a unique first preference beside the name of the candidate you most wish to see elected, by doing so, you are, as Graeme has already pointed out, risking your vote being wasted, in whole or in part.
A classic example of votes being wasted (in whole) was seen at the 2010 Wellington City mayoral election, at which Celia Wade-Brown came from behind to defeat the incumbent, Kerry Prendergast. At the end of the count, 3,783 votes (7.09% of the 53,369 valid votes cast) had dropped out of the count; had become non-transferable. In other words, astonishingly (to me, at least), those 3,783 voters declined the opportunity to indicate a preference between the two *main* candidates; the only two candidates with a chance of winning.
Given that Celia won the election by just 176 votes, had 177+ of those voters carried on and indicated a final preference for Kerry over Celia, Kerry would have retained the mayoralty.
At iteration 4, when the third-placed candidate, Jack Yan, was excluded from the count, his 7,426 votes were distributed 1,806 to Kerry, 3,459 to Celia, and 2,161 went to the total of non-transferable votes. It seems to me that the great majority of the sort of people who would have supported Jack (generally speaking: young, educated, switched-on, socially/politically aware), would have had a preference for one or other of the last two remaining candidates, even if they didn't particularly like either of them. Yet, amazingly, 29.10% of them chose not to express that preference.
Given that the preferences for the previously-excluded candidates transferred about 2 to 1 to Celia, it is probable that about 700 of those 2,161 voters would have preferred Kerry to Celia, but didn't say so. As I say, if 177+ *had* said so, Kerry would have hung on, to win. By not saying so, those 700 or so voters allowed their lesser-preferred candidate (of the remaining two) to come through and snatch the prize.
That is why it is important for voters to express as many preferences for the candidates as they are able. The more preferences that are expressed, the more likely it is for voters to have a direct effect on the final outcome
Yes preferential voting is looking weird. Try to understand the Australian Senate. People seem to be rational for the Parliament and then vote 'fishing party' for the Senate. Australians who want nothing to do with green politics book these people into the Senate.
I especially do not like the idea that the Australians transfer the preferences of lowest on the voting list first.
This means the wacko votes have preferential preferences as it were.
Why not transfer the entire voting electorate second preference across.
Maybe they did this in Wellington, not sure . But as you say, a voter need to line up at least the first few preferences.
There is talk now in Australia that Abbott may have a double dissolution to resolve the obscene Senate crisis. he can do it soon, and would be welcomed by Australians. Expect change to their voting system soon. The senate is absurd and it come from preferential voting bottom up.
Making STV work tactically


Posted on April 13, 2010 April 13, 2010 by warrickPosted in assessment & reporting, videosTagged AEU, gillard, NAPLAN.
Wow! No NAPLAN testing for 2010?! Parents as supervisors? What is going on with the Australian education system?! Crazy stuff.
Our tests will go ahead, but not sure about all schools. It's partly brinkmanship and sabre-rattling on both sides I think.


text:
UN: Developing Nations Leading Renewables Investment
By Ed King Investment in renewable energy projects in developing countries increased in 2012, despite a small global decline in back for wind and solar projects, the UN Environment Programme (UNEP) has revealed. Today it released two reports on the state of the renewable sector, the REN21′s Renewables Global Status Report (GSR) and Global Trends in Renewable Energy Investment 2013. They confirmed overall investment in renewables was $244 billion, a 12% drop on 2011, which the studies attribute to policy uncertainty in industrialised countries. Total power capacity increased by 8.5%, while the deployment of wind and solar installations broke new records, despite falls in overall funding. But while the US and Germany experienced significant dips in investment, there were sharp increases in China, South Africa, Mexico, Kenya and the Middle East. Installed wind capacity hit a new record of 48.4GW, up from 42.1GW in 2011, although investment fell 10% China consolidated its position as the world's leading renewables market, with solar investment largely responsible for a 22% lead to $67 billion of investment. Small-scale solar in Japan also drove an astonishing 73% increase in investment, worth $16 billion. Despite the ongoing financial crisis, both reports highlight the strong position of the clean energy sector, which has seen $1.3 trillion injected since 2006, and now employs 5.7 million around the world. "This should be a source of inspiration for governments, cities, companies and citizens everywhere to raise their ambition towards climate action," said UN Secretary General Ban Ki Moon. "A global climate agreement by 2015 would provide dramatic spur in the direction we need to travel." UN climate chief Christiana Figueres, who has endured a difficult second week of international negitiations in Bonn, said the figures provide a welcome boost. "Driven in part by the UNFCCC process and various provisions and mechanisms of the Kyoto Protocol, the increasing deployment of wind, solar, geothermal and other clean energy power sources serve as a powerful antidote to those who claim that a transition to a low-carbon, resource-efficient future is unobtainable," she said. Critically, costs of renewables continue to fall. Solar PV systems are down 30-40% on 2011 prices, while onshore turbines have fallen "by a few percentage points". "It is encouraging that renewable energy investment has exceeded $200 billion for the third successive year, that emerging economies are playing a larger and larger part, and that the cost-competitiveness of solar and wind power is improving all the time," said Michael Liebreich, Chief Executive, Bloomberg New Energy Finance. "What remains daunting is that the world has hardly scratched the surface – CO2 emissions are still on a firm upward trend and there was still nearly $150 billion of net investment in new fossil-fuel generating assets in 2012." Taylor Scott International
This entry was posted in Investment, investments, Kenya, News, Property, Taylor Scott International, TSI, Uk and tagged calendar, countries, investment, investments, javascript, kenya, renewable, renewables, south-africa. Bookmark the permalink.


Ricki-Lee hits back at commentary about her decision not to have kids.
And the critics won't be changing her mind.
Ricki-Lee Coulter's revelation that she and fiance Richard Harrison don't want kids sparked wide debate. Well known broadcaster Bianca Dye even wrote a lengthy blog warning the singer that she will regret her decision.
And Ricki has had enough.
"My choices are my choices and my reasons for making those choices are my reasons. Nobody can question that. I don't question anybody's decisions in their lives," the 28-year-old singer told Confidential.
Ricki-lee and Rich. Image via @therickilee on Instagram.
"I've been around long enough to know that people like to state their opinion, but what I do with my ovaries is my business. The moment I was asked about having kids, I had a split second where I wondered: Should I fluff over this and not really answer the question? I get asked the question all the time, and this would've just prolonged it. I decided to be honest," she told News.com.au.
"Because I am so honest and open, it can be a double edged sword, because people feel entitled to give an opinion. I don't want people to think I'm being flippant — I understand how important it is to some women, and how hard it is for some women, but it's not for me."
And she's recently spoken about why.
Ricki opened up about own experiences with her single mother, Loretta Sheerin revealing how much she wishes her mother had been around more.
While Loretta juggled four jobs as a cleaner, a shop worker, painter and singer, there just wasn't enough time to be with her girls.
Ricki Lee as a child.
"My mother was amazing, but I wasn't babied, or canoodled, she was too busy holding down four jobs to put a roof over our heads and feed us," Ricki Lee told Daily Mail.
"Sometimes I wish she could be with me and I missed her. But I understood she was working hard for us."
Despite her somewhat lonely upbringing, Ricki says she wouldn't "change it for the world."
She is more than thankful that she got her mother's "work ethic and drive," which since finishing Australian Idol, had led to a string of success.
Since Ricki-Lee's mother met her now step-dad John, she now has the father-figure in her life she's been craving.
Ricki Lee and her fiancé Richard aren't looking to have children.
"Growing up I say my friends with their dads. I would go home with my friends a lot, play netball with my friends... [John] is an amazing man."
As for her not wanting children?
"It's just the way I feel about it. It's for a number of reasons, I love them, I just don't want my own."
Did your upbringing impact your decisions about children?
Ricki-LeeImage via @therickilee on Instagram.
Ricki-Lee and RichardRicki-Lee and Rich. Image via @therickilee on Instagram.
Ricki-LeeRicki-Lee. Image via @therickilee on Instagram.
Ricki-Lee and her fiance RichardRicki-Lee and Rich. Image via @therickilee on Instagram.
Ricki Lee doesn't want to have children.
Rick Lee dishes on her wedding plans.