text:
package net.coding.program;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.Display;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.DatePicker;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.NumberPicker;
import android.widget.TextView;

import com.loopj.android.http.RequestParams;

import net.coding.program.common.ClickSmallImage;
import net.coding.program.common.ListModify;
import net.coding.program.maopao.MaopaoListFragment;
import net.coding.program.model.AccountInfo;
import net.coding.program.model.UserObject;
import net.coding.program.user.ProvincesPickerDialog;
import net.coding.program.user.SetUserInfoActivity_;
import net.coding.program.user.SetUserTagActivity_;
import net.coding.program.user.UserProvincesDialogFragment;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.EActivity;
import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.OptionsMenu;
import org.androidannotations.annotations.ViewById;
import org.androidannotations.annotations.res.StringArrayRes;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Iterator;

@EActivity(R.layout.activity_user_info)
@OptionsMenu(R.menu.user_info)
public class UserInfoActivity extends BaseFragmentActivity {

    ImageView icon;

    void setIcon() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("更换头像")
                .setItems(R.array.camera_gallery, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        if (which == 0) {
                            camera();
                        } else {
                            photo();
                        }
                    }
                });
        //builder.create().show();
        AlertDialog dialog = builder.create();
        dialog.show();
        dialogTitleLineColor(dialog);
    }

    @StringArrayRes
    String[] sexs;

    UserObject user;

    @StringArrayRes
    String[] user_info_list_first;

    String[] user_info_list_second;

    @ViewById
    ListView listView;

    String[] user_jobs;

    @AfterViews
    void init() {
        getActionBar().setDisplayHomeAsUpEnabled(true);
        user = AccountInfo.loadAccount(this);

        View head = mInflater.inflate(R.layout.activity_user_info_head, null, false);
        icon = (ImageView) head.findViewById(R.id.icon);
        icon.setOnClickListener(new ClickSmallImage(this));
        iconfromNetwork(icon, user.avatar);
        icon.setTag(new MaopaoListFragment.ClickImageParam(user.avatar));
        head.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setIcon();
            }
        });
        listView.addHeaderView(head);

        getUserInfoRows();

        listView.setAdapter(adapter);
        listView.setOnItemClickListener(itemClickListener);
    }

    void getUserInfoRows() {
        user_info_list_second = new String[]{
                user.name,
                sexs[user.sex],
                Global.dayFromTime(user.birthday),
                user.location,
                user.slogan,
                user.company,
                user.job_str,
                user.tags_str
        };
    }

    final String HOST_USERINFO = Global.HOST + "/api/user/updateInfo";

    void action_done() {
        RequestParams params = new RequestParams();
        params.put("email", user.email);
        params.put("lavatar", user.lavatar);
        params.put("name", user.name);
        params.put("sex", user.sex);
        params.put("phone", user.phone);
        params.put("birthday", Global.dayFromTime(user.birthday));
        params.put("location", user.location.trim());
        params.put("company", user.company);
        params.put("slogan", user.slogan);
        params.put("introduction", user.introduction);
        params.put("job", user.job);
        params.put("tags", user.tags);

        postNetwork(HOST_USERINFO, params, HOST_USERINFO);
    }

    BaseAdapter adapter = new BaseAdapter() {
        @Override
        public int getCount() {
            return user_info_list_first.length;
        }

        @Override
        public Object getItem(int position) {
            return user_info_list_second[position];
        }

        @Override
        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder;
            if (convertView == null) {
                convertView = mInflater.inflate(R.layout.list_item_2_text, parent, false);
                holder = new ViewHolder();
                holder.first = (TextView) convertView.findViewById(R.id.first);
                holder.second = (TextView) convertView.findViewById(R.id.second);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            holder.first.setText(user_info_list_first[position]);

            String seondString = user_info_list_second[position];
            if (seondString.isEmpty()) {
                seondString = "未填写";
            }
            holder.second.setText(seondString);

            return convertView;
        }
    };

    static class ViewHolder {
        TextView first;
        TextView second;
    }

    @OptionsItem(android.R.id.home)
    void back() {
        onBackPressed();
    }

    public String HOST_USER_AVATAR = Global.HOST + "/api/user/avatar?update=1";

    @Override
    public void parseJson(int code, JSONObject respanse, String tag, int pos, Object data) throws JSONException {
        if (tag.equals(HOST_USERINFO)) {
            if (code == 0) {
                user = new UserObject(respanse.getJSONObject("data"));
                AccountInfo.saveAccount(this, user);
                //MyApp.sUserObject = user;
                getUserInfoRows();
                adapter.notifyDataSetChanged();
            } else {
                showErrorMsg(code, respanse);
            }

        } else if (tag.equals(HOST_USER_AVATAR)) {
            if (code == 0) {
                String iconUri = respanse.getString("data");
                iconfromNetwork(icon, iconUri);

                user.avatar = iconUri;
                AccountInfo.saveAccount(this, user);
                icon.setTag(new MaopaoListFragment.ClickImageParam(user.avatar));

            } else {
                showErrorMsg(code, respanse);
            }
        } else if (tag.equals(HOST)) {
            if (code == 0) {
                user = new UserObject(respanse.getJSONObject("data"));
                AccountInfo.saveAccount(this, user);
                MyApp.sUserObject = user;
                getUserInfoRows();
                adapter.notifyDataSetChanged();
                //setControlContent(user);
            } else {
                showErrorMsg(code, respanse);
            }
        } else if (tag.equals(HOST_JOB)) {
            if (code == 0) {
                ArrayList<String> jobs = new ArrayList<String>();
                jobs.add("");
                JSONObject jobJSONObject = respanse.getJSONObject("data");
                Iterator it = jobJSONObject.keys();
                while (it.hasNext()) {
                    String key = (String) it.next();
                    String value = jobJSONObject.getString(key);
                    jobs.add(value);
                }
                user_jobs = new String[jobs.size()];
                //jobs.toArray(user_jobs);
                user_jobs[0] = "不选择";
                for (int i = 1; i < jobs.size(); i++) {
                    user_jobs[i] = jobJSONObject.optString(i + "");
                }
                showJobDialog();

            }
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == RESULT_REQUEST_PHOTO) {
            if (resultCode == Activity.RESULT_OK) {
                if (data != null) {
                    fileUri = data.getData();
                }

                fileCropUri = getOutputMediaFileUri();
                cropImageUri(fileUri, fileCropUri, 640, 640, RESULT_REQUEST_PHOTO_CROP);
            }

        } else if (requestCode == RESULT_REQUEST_PHOTO_CROP) {
            if (resultCode == Activity.RESULT_OK) {
                try {
                    String filePath = Global.getPath(this, fileCropUri);
                    RequestParams params = new RequestParams();
                    params.put("file", new File(filePath));
                    postNetwork(HOST_USER_AVATAR, params, HOST_USER_AVATAR);

                } catch (Exception e) {
                }
            }
        } else if (requestCode == ListModify.RESULT_EDIT_LIST) {
            if (resultCode == Activity.RESULT_OK) {
                //showButtomToast("EDITED");
                //updateUserinfo();
                user = AccountInfo.loadAccount(this);
                getUserInfoRows();
                adapter.notifyDataSetChanged();
            } else {
                //showButtomToast("UNEDITED");
            }
        }
    }

    public final static int USERINFO_NAME = 0;
    public final static int USERINFO_SEX = 1;
    public final static int USERINFO_BIRTHDAY = 2;
    public final static int USERINFO_LOCATION = 3;
    public final static int USERINFO_SLOGAN = 4;
    public final static int USERINFO_COMPANY = 5;
    public final static int USERINFO_JOB = 6;
    public final static int USERINFO_TAGS = 7;

    private AdapterView.OnItemClickListener itemClickListener = new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            //showButtomToast("position" + position);
            switch ((int) id) {

                case USERINFO_NAME:
                    //昵称
                    SetUserInfoActivity_.intent(UserInfoActivity.this).title("昵称").row(USERINFO_NAME).startForResult(ListModify.RESULT_EDIT_LIST);
                    break;

                case USERINFO_SEX:
                    //性别
                    setSexs();
                    break;

                case USERINFO_BIRTHDAY:
                    //生日
                    DialogFragment newFragment = new DatePickerFragment();
                    Bundle bundle = new Bundle();
                    bundle.putLong("date", user.birthday);
                    newFragment.setArguments(bundle);
                    newFragment.setCancelable(true);
                    newFragment.show(getSupportFragmentManager(), "datePicker");
                    getSupportFragmentManager().executePendingTransactions();
                    dialogTitleLineColor(newFragment.getDialog());
                    break;

                case USERINFO_LOCATION:
                    //所在地
                    UserProvincesDialogFragment provincesDialogFragment = new UserProvincesDialogFragment();
                    Bundle provincesBundle = new Bundle();
                    provincesBundle.putString(ProvincesPickerDialog.LOCATION, user.location);
                    provincesBundle.putString(ProvincesPickerDialog.TITLE, "选择所在地");
                    provincesDialogFragment.setArguments(provincesBundle);
                    provincesDialogFragment.setCallBack(new ProvincesPickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(String provinceStr) {
                            if (!user.location.trim().equals(provinceStr)) {
                                user.location = provinceStr;
                                action_done();
                            }
                        }
                    });
                    //provincesDialogFragment.setCancelable(true);
                    provincesDialogFragment.show(getSupportFragmentManager(), "provincesPicker");
                    getSupportFragmentManager().executePendingTransactions();
                    dialogTitleLineColor(provincesDialogFragment.getDialog());
                    break;

                case USERINFO_SLOGAN:
                    //座右铭
                    SetUserInfoActivity_.intent(UserInfoActivity.this).title("座右铭").row(USERINFO_SLOGAN).startForResult(ListModify.RESULT_EDIT_LIST);
                    break;

                case USERINFO_COMPANY:
                    //公司
                    SetUserInfoActivity_.intent(UserInfoActivity.this).title("公司").row(USERINFO_COMPANY).startForResult(ListModify.RESULT_EDIT_LIST);
                    break;

                case USERINFO_JOB:
                    //职位
                    chooseJob();
                    break;

                case USERINFO_TAGS:
                    //个性标签
                    SetUserTagActivity_.intent(UserInfoActivity.this).title("个性标签").startForResult(ListModify.RESULT_EDIT_LIST);
                    break;
            }
        }
    };

    public void updateUserinfo() {
        UserObject oldUser = AccountInfo.loadAccount(this);
        getNetwork(String.format(HOST, oldUser.global_key), HOST);
    }

    String HOST = Global.HOST + "/api/user/key/%s";

    void setSexs() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("性别")
                .setItems(R.array.sexs, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        user.sex = which;
                        action_done();
                    }
                });
        //builder.create().show();
        AlertDialog dialog = builder.create();
        dialog.show();
        dialogTitleLineColor(dialog);
    }

    public static class DatePickerFragment extends DialogFragment
            implements DatePickerDialog.OnDateSetListener {

        private UserInfoActivity mActivity;

        private int year;
        private int month;
        private int day;

        private boolean isConfirm = false;

        @Override
        public void onAttach(Activity activity) {
            if (activity instanceof UserInfoActivity) {
                mActivity = (UserInfoActivity) activity;
            }
            super.onAttach(activity);
        }

        @Override
        public Dialog onCreateDialog(Bundle savedInstanceState) {
            // Use the current date as the default date in the picker
            final Calendar c = Calendar.getInstance();
            c.setTimeInMillis(getArguments().getLong("date"));
            year = c.get(Calendar.YEAR);
            month = c.get(Calendar.MONTH);
            day = c.get(Calendar.DAY_OF_MONTH);
            isConfirm = false;

            // Create a new instance of DatePickerDialog and return it
            DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), this, year, month, day);
            datePickerDialog.setButton(DatePickerDialog.BUTTON_NEGATIVE, getString(R.string.btn_dialog_cancel), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    //Log.d("datePickerDialog", "BUTTON_NEGATIVE");
                    isConfirm = false;
                }
            });
            /*datePickerDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                @Override
                public void onDismiss(DialogInterface dialog) {
                    Log.d("datePickerDialog", "setOnDismissListener");
                }
            });
            datePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    Log.d("datePickerDialog", "setOnCancelListener");
                }
            });*/
            datePickerDialog.setButton(DatePickerDialog.BUTTON_POSITIVE, getString(R.string.btn_dialog_done), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    isConfirm = true;
                }
            });
            LinearLayout layoutParent = (LinearLayout) datePickerDialog.getDatePicker().getChildAt(0);
            LinearLayout layout = (LinearLayout) layoutParent.getChildAt(0);
            for (int i = 0; i < layout.getChildCount(); i++) {
                View v = layout.getChildAt(i);
                if (v instanceof NumberPicker) {
                    setNumberPicker((NumberPicker) v);
                }
            }
            return datePickerDialog;
        }

        public void onDateSet(DatePicker view, int year, int month, int day) {
            // Do something with the date chosen by the user
            if (!isConfirm)
                return;

            final Calendar c = Calendar.getInstance();
            c.set(Calendar.YEAR, year);
            c.set(Calendar.MONTH, month);
            c.set(Calendar.DAY_OF_MONTH, day);
            if (mActivity != null) {
                mActivity.setUserinfoBirthday(c.getTimeInMillis());
            }
            //Log.d("datePickerDialog", "onDateSet");
        }

        public void setNumberPicker(NumberPicker spindle) {
            java.lang.reflect.Field[] pickerFields = NumberPicker.class
                    .getDeclaredFields();
            for (java.lang.reflect.Field pf : pickerFields) {
                if (pf.getName().equals("mSelectionDivider")) {
                    pf.setAccessible(true);
                    try {
                        pf.set(spindle, getResources().getDrawable(R.drawable.line_green));
                    } catch (IllegalArgumentException e) {
                        e.printStackTrace();
                    } catch (Resources.NotFoundException e) {
                        e.printStackTrace();
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    }
                    break;
                }
            }
        }
    }

    void setUserinfoBirthday(long time) {
        if (user.birthday != time) {
            user.birthday = time;
            action_done();
        }
    }

    public void chooseJob() {
        if (user_jobs == null) {
            getNetwork(HOST_JOB, HOST_JOB);
        } else {
            showJobDialog();
        }
    }

    private void showJobDialog() {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("职位")
                .setItems(user_jobs, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        user.job = which;
                        action_done();
                    }
                });

        //builder.create().show();
        WindowManager m = getWindowManager();
        Display d = m.getDefaultDisplay();
        AlertDialog dialog = builder.create();
        dialog.show();
        WindowManager.LayoutParams p = dialog.getWindow().getAttributes();
        Point outSize = new Point();
        d.getSize(outSize);
        p.height = (int) (outSize.y * 0.6); // 高度设置为屏幕的0.6
        //p.width = (int) (d.getWidth() * 0.8);
        dialog.getWindow().setAttributes(p);
        dialogTitleLineColor(dialog);
    }

    String HOST_JOB = Global.HOST + "/api/options/jobs";

}


text:
Titanium.UI.setBackgroundColor('#000');

// Initialize app variables.
Ti.include('includes/properties.js');
Ti.include('includes/geolocation.js');
Ti.include('includes/ui.js');
Ti.include('includes/utils.js');
Ti.include('includes/database.js');

// Load all windows.
Ti.include('windows.js');

var win = W.Weather();
win.open();

redpajama_set_name: RedPajamaGithub


text:
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/** @fileoverview Test suite for wallpaper-selected component.  */

import 'chrome://personalization/strings.m.js';
import 'chrome://webui-test/mojo_webui_test_support.js';

import {CurrentWallpaper, DailyRefreshType, Paths, WallpaperLayout, WallpaperSelected, WallpaperType} from 'chrome://personalization/js/personalization_app.js';
import {assertDeepEquals, assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js';
import {flushTasks, waitAfterNextRender} from 'chrome://webui-test/test_util.js';

import {baseSetup, initElement} from './personalization_app_test_utils.js';
import {TestPersonalizationStore} from './test_personalization_store.js';
import {TestWallpaperProvider} from './test_wallpaper_interface_provider.js';

suite('WallpaperSelectedTest', function() {
  let wallpaperSelectedElement: WallpaperSelected|null;
  let wallpaperProvider: TestWallpaperProvider;
  let personalizationStore: TestPersonalizationStore;

  setup(() => {
    const mocks = baseSetup();
    wallpaperProvider = mocks.wallpaperProvider;
    personalizationStore = mocks.personalizationStore;
  });

  teardown(async () => {
    if (wallpaperSelectedElement) {
      wallpaperSelectedElement.remove();
    }
    wallpaperSelectedElement = null;
    await flushTasks();
  });

  test(
      'shows loading placeholder when there are in-flight requests',
      async () => {
        personalizationStore.data.wallpaper.loading = {
          ...personalizationStore.data.wallpaper.loading,
          selected: 1,
          setImage: 0,
        };
        wallpaperSelectedElement = initElement(WallpaperSelected);

        assertEquals(
            null, wallpaperSelectedElement.shadowRoot!.querySelector('img'));

        assertEquals(
            null,
            wallpaperSelectedElement.shadowRoot!.getElementById(
                'textContainer'));

        const placeholder = wallpaperSelectedElement.shadowRoot!.getElementById(
            'imagePlaceholder');

        assertTrue(!!placeholder);

        // Loading placeholder should be hidden.
        personalizationStore.data.wallpaper.loading = {
          ...personalizationStore.data.wallpaper.loading,
          selected: 0,
          setImage: 0,
        };
        personalizationStore.data.wallpaper.currentSelected =
            wallpaperProvider.currentWallpaper;
        personalizationStore.notifyObservers();
        await waitAfterNextRender(wallpaperSelectedElement);

        assertEquals('none', placeholder.style.display);

        // Sent a request to update user wallpaper. Loading placeholder should
        // come back.
        personalizationStore.data.wallpaper.loading = {
          ...personalizationStore.data.wallpaper.loading,
          selected: 0,
          setImage: 1,
        };
        personalizationStore.notifyObservers();
        await waitAfterNextRender(wallpaperSelectedElement);

        assertEquals('', placeholder.style.display);
      });

  test('shows wallpaper image and attribution when loaded', async () => {
    personalizationStore.data.wallpaper.currentSelected =
        wallpaperProvider.currentWallpaper;

    wallpaperSelectedElement = initElement(WallpaperSelected);
    await waitAfterNextRender(wallpaperSelectedElement);

    const img = wallpaperSelectedElement.shadowRoot!.querySelector('img');
    assertEquals(wallpaperProvider.currentWallpaper.url.url, img!.src);

    const textContainerElements =
        wallpaperSelectedElement.shadowRoot!.querySelectorAll(
            '#textContainer span');

    // First span tag is 'Currently Set' text.
    assertEquals('currentlySet', textContainerElements[0]!.id);
    assertEquals(
        wallpaperSelectedElement.i18n('currentlySet'),
        textContainerElements[0]!.textContent);

    // Following text elements are for the photo attribution text.
    const attributionLines =
        Array.from(textContainerElements).slice(1) as HTMLElement[];

    assertEquals(
        wallpaperProvider.currentWallpaper.attribution.length,
        attributionLines.length);
    wallpaperProvider.currentWallpaper.attribution.forEach((line, i) => {
      assertEquals(line, attributionLines[i]!.innerText);
    });
  });

  test('shows unknown for empty attribution', async () => {
    personalizationStore.data.wallpaper.currentSelected = {
      url: {url: 'data:image/png;base64,abc='},
      attribution: [],
      assetId: BigInt(100),
    };
    personalizationStore.data.wallpaper.loading.selected = false;
    wallpaperSelectedElement = initElement(WallpaperSelected);
    await waitAfterNextRender(wallpaperSelectedElement);

    const title =
        wallpaperSelectedElement.shadowRoot!.getElementById('imageTitle');
    assertEquals(
        wallpaperSelectedElement.i18n('unknownImageAttribution'),
        title!.textContent!.trim());
  });

  test('updates image when store is updated', async () => {
    personalizationStore.data.wallpaper.currentSelected =
        wallpaperProvider.currentWallpaper;
    personalizationStore.data.wallpaper.loading.selected = false;

    wallpaperSelectedElement = initElement(WallpaperSelected);
    await waitAfterNextRender(wallpaperSelectedElement);

    const img = wallpaperSelectedElement.shadowRoot!.querySelector('img') as
        HTMLImageElement;
    assertEquals(wallpaperProvider.currentWallpaper.url.url, img.src);

    personalizationStore.data.wallpaper.currentSelected = {
      url: {url: 'data:image/png;base64_some_new_data'},
      attribution: ['New attribution'],
      assetId: BigInt(100),
    };
    personalizationStore.notifyObservers();
    await waitAfterNextRender(wallpaperSelectedElement);

    assertEquals('data:image/png;base64_some_new_data', img.src);
  });

  test('shows placeholders when image fails to load', async () => {
    wallpaperSelectedElement = initElement(WallpaperSelected);
    await waitAfterNextRender(wallpaperSelectedElement);

    // Still loading.
    personalizationStore.data.wallpaper.loading.selected = true;
    personalizationStore.data.wallpaper.currentSelected = null;
    personalizationStore.notifyObservers();
    await waitAfterNextRender(wallpaperSelectedElement);

    const placeholder =
        wallpaperSelectedElement.shadowRoot!.getElementById('imagePlaceholder');
    assertTrue(!!placeholder);

    // Loading finished and still no current wallpaper.
    personalizationStore.data.wallpaper.loading.selected = false;
    personalizationStore.notifyObservers();
    await waitAfterNextRender(wallpaperSelectedElement);

    // Dom-if will set display: none if the element is hidden. Make sure it is
    // not hidden.
    assertNotEquals('none', placeholder.style.display);
    assertEquals(
        null, wallpaperSelectedElement.shadowRoot!.querySelector('img'));
  });

  test('shows image url with data scheme', async () => {
    personalizationStore.data.wallpaper.currentSelected = {
      url: {url: 'data:image/png;base64,abc='},
      attribution: [],
      assetId: BigInt(100),
    };
    personalizationStore.data.wallpaper.loading.selected = false;
    wallpaperSelectedElement = initElement(WallpaperSelected);
    await waitAfterNextRender(wallpaperSelectedElement);

    const img = wallpaperSelectedElement.shadowRoot!.querySelector('img');
    assertEquals('data:image/png;base64,abc=', img!.src);
  });

  test('shows daily refresh option on the collection view', async () => {
    personalizationStore.data.wallpaper.currentSelected = {
      url: {url: 'data:image/png;base64,abc='},
      attribution: [],
      assetId: BigInt(100),
    };
    personalizationStore.data.wallpaper.loading.selected = false;

    wallpaperSelectedElement =
        initElement(WallpaperSelected, {'path': Paths.COLLECTION_IMAGES});
    await waitAfterNextRender(wallpaperSelectedElement);

    const dailyRefresh =
        wallpaperSelectedElement.shadowRoot!.getElementById('dailyRefresh');
    assertTrue(!!dailyRefresh);

    const refreshWallpaper =
        wallpaperSelectedElement.shadowRoot!.getElementById('refreshWallpaper');
    assertTrue(refreshWallpaper!.hidden);
  });

  test(
      'shows daily refresh option on the google photos album view',
      async () => {
        personalizationStore.data.wallpaper.currentSelected = {
          url: {url: 'data:image/png;base64,abc='},
          attribution: [],
          assetId: BigInt(100),
        };
        personalizationStore.data.wallpaper.loading.selected = false;

        wallpaperSelectedElement = initElement(WallpaperSelected, {
          'path': Paths.GOOGLE_PHOTOS_COLLECTION,
          'googlePhotosAlbumId': '',
        });
        await waitAfterNextRender(wallpaperSelectedElement);

        const dailyRefresh =
            wallpaperSelectedElement.shadowRoot!.getElementById('dailyRefresh');
        assertTrue(!!dailyRefresh);

        const refreshWallpaper =
            wallpaperSelectedElement.shadowRoot!.getElementById(
                'refreshWallpaper');
        assertTrue(refreshWallpaper!.hidden);
      });

  test(
      'shows refresh button only on collection with daily refresh enabled',
      async () => {
        personalizationStore.data.wallpaper.currentSelected = {
          url: {url: 'data:image/png;base64,abc='},
          attribution: [],
          assetId: BigInt(100),
        };
        personalizationStore.data.wallpaper.loading.selected = false;
        const collection_id = wallpaperProvider.collections![0]!.id;
        personalizationStore.data.wallpaper.dailyRefresh = {
          id: collection_id,
          type: DailyRefreshType.BACKDROP,
        };

        wallpaperSelectedElement = initElement(
            WallpaperSelected,
            {'path': Paths.COLLECTION_IMAGES, 'collectionId': collection_id});
        personalizationStore.notifyObservers();

        await waitAfterNextRender(wallpaperSelectedElement);

        const newRefreshWallpaper =
            wallpaperSelectedElement.shadowRoot!.getElementById(
                'refreshWallpaper');
        assertFalse(newRefreshWallpaper!.hidden);
      });

  test(
      'shows refresh button only on google photos album with daily refresh enabled',
      async () => {
        personalizationStore.data.wallpaper.currentSelected = {
          url: {url: 'data:image/png;base64,abc='},
          attribution: [],
          assetId: BigInt(100),
        };
        personalizationStore.data.wallpaper.loading.selected = false;

        const album_id = 'test_album_id';
        personalizationStore.data.wallpaper.dailyRefresh = {
          id: album_id,
          type: DailyRefreshType.GOOGLE_PHOTOS,
        };

        wallpaperSelectedElement = initElement(WallpaperSelected, {
          'path': Paths.GOOGLE_PHOTOS_COLLECTION,
          'googlePhotosAlbumId': album_id,
        });
        personalizationStore.notifyObservers();

        await waitAfterNextRender(wallpaperSelectedElement);

        const newRefreshWallpaper =
            wallpaperSelectedElement.shadowRoot!.getElementById(
                'refreshWallpaper');
        assertFalse(newRefreshWallpaper!.hidden);
      });

  test('shows layout options for Google Photos', async () => {
    // Set a Google Photos photo as current wallpaper.
    personalizationStore.data.wallpaper.currentSelected = {
      url: {url: 'url'},
      attribution: [],
      layout: WallpaperLayout.kStretch,
      type: WallpaperType.kOnceGooglePhotos,
      key: 'key',
    };

    // Initialize |wallpaperSelectedElement|.
    wallpaperSelectedElement =
        initElement(WallpaperSelected, {'path': Paths.COLLECTION_IMAGES});
    await waitAfterNextRender(wallpaperSelectedElement);

    // Verify layout options are *not* shown when not on Google Photos path.
    const selector = '#wallpaperOptions';
    const shadowRoot = wallpaperSelectedElement.shadowRoot;
    assertEquals(shadowRoot?.querySelector(selector), null);

    // Set Google Photos path and verify layout options *are* shown.
    wallpaperSelectedElement.path = Paths.GOOGLE_PHOTOS_COLLECTION;
    await waitAfterNextRender(wallpaperSelectedElement);
    assertNotEquals(shadowRoot?.querySelector(selector), null);

    // Verify that clicking layout |button| results in mojo API call.
    const button = shadowRoot?.querySelector('#center') as HTMLElement | null;
    button?.click();
    assertDeepEquals(
        await wallpaperProvider.whenCalled('setCurrentWallpaperLayout'),
        WallpaperLayout.kCenter);
  });

  test('shows attribution for device default wallpaper', async () => {
    const currentSelected: CurrentWallpaper = {
      url: {url: 'url'},
      attribution: ['testing attribution'],
      layout: WallpaperLayout.kStretch,
      type: WallpaperType.kDefault,
      key: 'key',
    };
    personalizationStore.data.wallpaper.currentSelected = currentSelected;

    wallpaperSelectedElement =
        initElement(WallpaperSelected, {path: Paths.COLLECTION_IMAGES});
    await waitAfterNextRender(wallpaperSelectedElement);

    assertEquals(
        wallpaperSelectedElement.i18n('defaultWallpaper'),
        wallpaperSelectedElement.shadowRoot!.getElementById(
                                                'imageTitle')!.innerText,
        'default wallpaper attribution is shown');
  });
});


text:
API Docs: Ratelimiting
======================

.. automodule:: snooble.ratelimit
    :members:
    :undoc-members:


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="@dimen/text_normal"
            android:textColor="@color/text_primary"
            android:text="@string/no_dagger"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"/>

</android.support.constraint.ConstraintLayout>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Septoria holubyi Bäumler

### Remarks
null


text:
@class NSString;

@interface WCPayOfflinePayUnfreezeLogic : WCPayControlLogic <WCPayPayPwdViewControllerDelegate>
{
}

- (void)OnUnfreezeOfflinePay:(id)arg1;
- (void)PayPwdRightActionBack;
- (void)PayPwdBack;
- (void)VerifyPayPwdNext:(id)arg1;
- (void)startLogic;

// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;

@end


text:
require 'test_helper'

class MigrationTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
<?php

namespace Opifer\ReviewBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
 * Review Type
 */
class ReviewType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('author', TextType::class)
            ->add('title', TextType::class)
            ->add('content', TextareaType::class)
        ;
    }
}


text:
package com.henry.hh.utils;

import com.facebook.rebound.BaseSpringSystem;
import com.facebook.rebound.SpringLooper;

/**
 * This is a wrapper for BaseSpringSystem that provides the convenience of automatically providing
 * the AndroidSpringLooper dependency in {@link SpringSystem#create}.
 */
public class SpringSystem extends BaseSpringSystem {

    /**
     * Create a new SpringSystem providing the appropriate constructor parameters to work properly
     * in an Android environment.
     *
     * @return the SpringSystem
     */
    public static SpringSystem create() {
        return new SpringSystem(AndroidSpringLooperFactory.createSpringLooper());
    }

    private SpringSystem(SpringLooper springLooper) {
        super(springLooper);
    }

}


text:
package de.otto.jsonhome.resource;

import com.sun.jersey.api.view.Viewable;
import de.otto.jsonhome.generator.JerseyJsonHomeGenerator;
import de.otto.jsonhome.generator.JsonHomeSource;
import de.otto.jsonhome.model.JsonHome;
import de.otto.jsonhome.model.ResourceLink;
import de.otto.jsonhome.resource.scanner.AnnotationScanner;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.util.HashMap;
import java.util.Map;

import static de.otto.jsonhome.resource.Responses.addCacheControlHeaders;

/**
 * @author Sebastian Schroeder
 * @since 28.12.2012
 */
@Path("/rel/{all:.*}")
public final class RelationResource {

    private final JsonHomeSource jsonHomeSource;
    private int maxAge = 3600;

    public RelationResource(JsonHomeSource jsonHomeSource) {
        this.jsonHomeSource = jsonHomeSource;
    }

    public RelationResource() {
        this.jsonHomeSource = new JerseyJsonHomeSource(new JerseyJsonHomeGenerator(), new AnnotationScanner());
    }

    public void setMaxAge(int maxAge) {
        this.maxAge = maxAge;
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    public Response getRelationType(@Context UriInfo uriInfo) {
        final Map<String,Object> model = new HashMap<String, Object>();
        final JsonHome jsonHome = jsonHomeSource.getJsonHome();
        if (jsonHome.hasResourceFor(uriInfo.getRequestUri())) {
            final ResourceLink resourceLink = jsonHome.getResourceFor(uriInfo.getRequestUri());
            model.put("resource", resourceLink);
            final Viewable viewable;
            if (resourceLink.isDirectLink()) {
                viewable = new Viewable("/jsonhome/directresource", model);
            } else {
                viewable = new Viewable("/jsonhome/templatedresource", model);
            }
            return addCacheControlHeaders(Response.ok(viewable), maxAge);
        } else {
            return Response.status(Response.Status.NOT_FOUND).entity("Unknown relation type " + uriInfo.getRequestUri()).build();
        }
    }

}


text:
module.exports = (function() {

  'use strict';

  const Nodal = require('nodal');
  const AccessToken = Nodal.require('app/models/access_token.js');

  class AccessTokensController extends Nodal.Controller {

    get() {
      AccessToken.logout(this.params, (err, accessToken) => {
        this.respond(err || accessToken);
      });
    }

    create() {
      AccessToken.login(this.params, (err, accessToken) => {
        console.log(accessToken);
        console.log(this.params);
        if(!err) {
          accessToken._data.email = this.params.body.email;
        }
        this.respond(err || accessToken, ['id', 'access_token', 'expires_at', 'email']);
      })
    }

    destroy() {
      AccessToken.logout(this.params, (err, accessToken) => {
        this.respond(err || accessToken);
      });
    }
  }
  return AccessTokensController;

})();


text:
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of OznOdrStlZauzController
 *
 * @author Marija i Jovana
 */
class OznacavanjeStolaZauzetimCtrl extends CI_Controller {

    public function index() {
        $this->load->model('UserValidationModel');
        $this->UserValidationModel->checkSessionKonobar();
        $this->load->view('OznacavanjeStolaZauzetimView');

}

    public function reserve(){

        $this->load->model('UserValidationModel');
        $this->UserValidationModel->checkSessionKonobar();
        $this->load->model('BusinessLogic');
        $brLjudi = $this->input->post('brLjudi');
        $vremeOd = $this->input->post('vremeOd');
        $vremeDo = $this->input->post('vremeDo');
        $id=$this->session->userdata('userid');
        $korisnik['imeKorisnika']="gost";
        if($this->BusinessLogic->freeTables($id, $brLjudi, $vremeOd, $vremeDo, $korisnik)){
            $data['poruka']="Uspesno je rezervisan sto";
        }
        else {
            $data['poruka']="Nije moguce napraviti rezervaciju";
        }
        $data['zauzeto'] = true;
        $this->load->view('OznacavanjeStolaZauzetimView', $data);
    }
}


text:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using WebsitePanel.EnterpriseServer;

namespace WebsitePanel.Portal
{
    public partial class SpaceSettingsSharedSSLSites : WebsitePanelControlBase, IPackageSettingsEditorControl
    {
        public void BindSettings(PackageSettings settings)
        {
            domainsList.Value = settings["SharedSslSites"];
        }

        public void SaveSettings(PackageSettings settings)
        {
            settings["SharedSslSites"] = domainsList.Value;
        }
    }
}


text:
require "spec_helper"

describe Depth, "#price" do
  subject { described_class.new(options).price }
  let(:options) { {} }

  it { should be_nil }

  context "when with price" do
    before { options[:price] = Price.new }
    it { should be_a(Price) }
  end
end


text:
@class TSStream;
@class ACAccount;

@protocol TSStreamDelegate <NSObject>

@optional

- (void)streamDidReceiveMessage:(TSStream*)stream json:(id)json;
- (void)streamDidReceiveInvalidJson:(TSStream*)stream message:(NSString*)message;
- (void)streamDidTimeout:(TSStream*)stream;
- (void)streamDidFailConnection:(TSStream*)stream;

@end

@interface TSStream : NSObject

- (id)initWithEndpoint:(NSString*)endpoint
         andParameters:(NSDictionary*)parameters
            andAccount:(ACAccount*)account
           andDelegate:(id<TSStreamDelegate>)delegate;

- (void)start;
- (void)stop;

@end


text:
print 'importing main module...'

import main

try:
    _main = main.main
except AttributeError:
    pass
else:
    _main()


text:
title: "VoiceOver Crashes my App"
date: 2013-01-26 00:00
---

I'm working on a small app and I loaded it into my iPhone to perform my due diligence with VoiceOver testing. It was there I discovered that my app actually crashes!

Only when using VoiceOver.

Hmm. Shit.

Turns out it's only when using `UITableView`'s sexy new `dequeueReusableCellWithIdentifier:forIndexPath:` with pre-registered classes. Somehow, VoiceOver is interfering with this process and calling this method will crash your app when VoiceOver is turned on.

For the mean time, avoid the new table view methods. Fall back to the old "try to dequeue, create if nil" approach.

Golf clap, Apple. Golf. Clap.

<!-- more -->


text:
importScripts("worker-pre.js");

function log(message)
{
    postMessage("log " + message);
}

function done()
{
    postMessage("DONE");
}

function init()
{
    try {
        req = new XMLHttpRequest;
        req.open("GET", "missing-file", false);
        req.send();
    } catch (e) {
        log("Exception received.");
    }
    done();
};


text:
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { HttpModule } from '@angular/http';
import { By } from '@angular/platform-browser';
import { Observable } from 'rxjs';

import { ShowListComponent } from './show-list.component';
import { ShowCoverComponent } from './show-cover.component';
import { ShowService } from '../shared';

describe('ShowListComponent', () => {
  let fixture: ComponentFixture<ShowListComponent>;
  let instance: ShowListComponent;
  let fakeShows;
  let showService: ShowService;

  beforeEach(() => {
    TestBed.configureTestingModule({
      imports: [ HttpModule ],
      declarations: [ ShowListComponent, ShowCoverComponent ],
      providers: [
        ShowService
      ],
      schemas: [ NO_ERRORS_SCHEMA ]
    }).compileComponents();

    fixture = TestBed.createComponent(ShowListComponent);
    instance = fixture.componentInstance;

    showService = fixture.debugElement.injector.get(ShowService);

    fakeShows = [
      { id: 0, name: 'Heidi', cover: 'casiperono', rating: 1 },
      { id: 1, name: 'Pokemon', cover: 'pikachu.com', rating: 3 },
      { id: 2, name: 'Power Rangers', cover: 'amarillopowa', rating: 2 },
      { id: 3, name: 'Campeones', cover: 'campoinfinito', rating: 1 }
    ];
  });

  it('fetches all shows', () => {
    spyOn(showService, 'getShows').and.returnValue(Observable.of(fakeShows));
    instance.ngOnInit();
    expect(instance.shows.length).toBe(4);
    expect(showService.getShows).toHaveBeenCalled();
  });

  it('renders as many covers as show are', () => {
    spyOn(showService, 'getShows').and.returnValue(Observable.of(fakeShows));
    fixture.detectChanges();
    const covers = fixture.debugElement.queryAll(By.css('show-cover'));
    expect(covers.length).toBe(4);
  });

  it('has a header', () => {
    const header = fixture.debugElement.query(By.css('h2')).nativeElement;
    expect(header.textContent).toBe('List of all shows');
  });
});


text:
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
import random
import datetime

def random_number():
    return random.randint(1, 100)

class UserExtension(models.Model):
    user = models.OneToOneField(User)
    birthday = models.DateField()
    number = models.IntegerField(default=random_number(), unique=True)

    def get_age(self):
        return int(datetime.date.year)-int(self.birthday.year)


text:
package com.hazelcast.spi.exception;

/**
 * Marker interface for exceptions to indicate that an operation can be retried. E.g. a map.get send to a machine
 * where the partition has just moved to another machine.
 */
public interface RetryableException {
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>DropKick tests</title>
  <link rel="stylesheet" href="../../node_modules/qunitjs/qunit/qunit.css">

    <button id="btn">Open</button>
    <select id="normal_select">
      <option disabled selected class="hidden-option">Choose One</option>
      <option value="AL">Alabama</option>
      <option value="AK">Alaska</option>
      <option value="AZ">Arizona</option>
      <option value="AR">Arkansas</option>
      <option value="CA">California</option>
      <option value="CO">Colorado</option>
      <option value="CT">Connecticut</option>
      <option value="DE">Delaware</option>
      <option value="DC">District Of Columbia</option>
      <option value="FL">Florida</option>
      <option value="GA">Georgia</option>
      <option value="HI">Hawaii</option>
      <option value="ID">Idaho</option>
      <option value="IL">Illinois</option>
      <option value="IN">Indiana</option>
      <option value="IA">Iowa</option>
      <option value="KS">Kansas</option>
      <option value="KY">Kentucky</option>
      <option value="LA">Louisiana</option>
      <option value="ME">Maine</option>
      <option value="MD">Maryland</option>
      <option value="MA">Massachusetts</option>
      <option value="MI">Michigan</option>
      <option value="MN">Minnesota</option>
      <option value="MS">Mississippi</option>
      <option value="MO">Missouri</option>
      <option value="MT">Montana</option>
      <option value="NE">Nebraska</option>
      <option value="NV">Nevada</option>
      <option value="NH">New Hampshire</option>
      <option value="NJ">New Jersey</option>
      <option value="NM">New Mexico</option>
      <option value="NY">New York</option>
      <option value="NC">North Carolina</option>
      <option value="ND">North Dakota</option>
      <option value="OH">Ohio</option>
      <option value="OK">Oklahoma</option>
      <option value="OR">Oregon</option>
      <option value="PA">Pennsylvania</option>
      <option value="RI">Rhode Island</option>
      <option value="SC">South Carolina</option>
      <option value="SD">South Dakota</option>
      <option value="TN">Tennessee</option>
      <option value="TX">Texas</option>
      <option value="UT">Utah</option>
      <option value="VT">Vermont</option>
      <option value="VA">Virginia</option>
      <option value="WA">Washington</option>
      <option value="WV">West Virginia</option>
      <option value="WI">Wisconsin</option>
      <option value="WY">Wyoming</option>
    </select>
    <select multiple id="multiple">
      <option value="AL">Alabama</option>
      <option value="AK">Alaska</option>
      <option value="AZ">Arizona</option>
      <option value="AR">Arkansas</option>
      <option value="CA">California</option>
      <option value="CO">Colorado</option>
      <option value="CT">Connecticut</option>
      <option value="DE">Delaware</option>
      <option value="DC">District Of Columbia</option>
      <option value="FL">Florida</option>
      <option value="GA">Georgia</option>
      <option value="HI">Hawaii</option>
      <option value="ID">Idaho</option>
      <option value="IL">Illinois</option>
      <option value="IN">Indiana</option>
      <option value="IA">Iowa</option>
      <option value="KS">Kansas</option>
      <option value="KY">Kentucky</option>
      <option value="LA">Louisiana</option>
      <option value="ME">Maine</option>
      <option value="MD">Maryland</option>
      <option value="MA">Massachusetts</option>
      <option value="MI">Michigan</option>
      <option value="MN">Minnesota</option>
      <option value="MS">Mississippi</option>
      <option value="MO">Missouri</option>
      <option value="MT">Montana</option>
      <option value="NE">Nebraska</option>
      <option value="NV">Nevada</option>
      <option value="NH">New Hampshire</option>
      <option value="NJ">New Jersey</option>
      <option value="NM">New Mexico</option>
      <option value="NY">New York</option>
      <option value="NC">North Carolina</option>
      <option value="ND">North Dakota</option>
      <option value="OH">Ohio</option>
      <option value="OK">Oklahoma</option>
      <option value="OR">Oregon</option>
      <option value="PA">Pennsylvania</option>
      <option value="RI">Rhode Island</option>
      <option value="SC">South Carolina</option>
      <option value="SD">South Dakota</option>
      <option value="TN">Tennessee</option>
      <option value="TX">Texas</option>
      <option value="UT">Utah</option>
      <option value="VT">Vermont</option>
      <option value="VA">Virginia</option>
      <option value="WA">Washington</option>
      <option value="WV">West Virginia</option>
      <option value="WI">Wisconsin</option>
      <option value="WY">Wyoming</option>
    </select>


text:
module.exports = {
  ParseError: require('./ParseError'),
  UnsupportedPropertyError: require('./UnsupportedPropertyError'),
  UnknownPropertyError: require('./UnknownPropertyError'),
};


text:
There might be situations in which it is up-front not clear which problem-sizes will be needed when running an application. To leverage LIBXSMM's high-performance kernels, the library implements a JIT (Just-In-Time) code generation backend which generates the requested kernels on the fly (in-memory). This is accomplished by emitting the corresponding byte-code directly into an executable buffer. The actual JIT code is generated per the CPUID flags, and therefore does not rely on the code path selected when building the library. In the current implementation, some limitations apply to the JIT backend specifically:

1. To stay agnostic to any threading model used, Pthread mutexes are guarding the updates of the JIT'ted code cache (link line with `-lpthread` is required); building with OMP=1 employs an OpenMP critical section as an alternative locking mechanism.
2. There is no support for the Intel SSE (Intel Xeon 5500/5600 series) and IMCI (Intel Xeon Phi coprocessor code-named Knights Corner) instruction set extensions. However, statically generated SSE-kernels can be leveraged without disabling support for JIT'ting AVX kernels.
3. There is limited support for the Windows calling convention (only kernels without prefetch signature).

The JIT backend can also be disabled at build time (`make JIT=0`) as well as at runtime (`LIBXSMM_TARGET=0`, or anything prior to Intel AVX). The latter is an environment variable which allows to set a code path independent of the CPUID (LIBXSMM_TARGET=0|1|sse|snb|hsw|knl|knm|skx). Please note that LIBXSMM_TARGET cannot enable the JIT backend if it was disabled at build time (JIT=0).

One can use the afore mentioned THRESHOLD parameter to control the matrix sizes for which the JIT compilation will be automatically performed. However, explicitly requested kernels (by calling `libxsmm_?mmdispatch`) fall not under a threshold for the problem-size. In any case, JIT code generation can be used for accompanying statically generated code.

### Generator Driver

In rare situations, it might be useful to directly incorporate generated C code (with inline assembly regions). This is accomplished by invoking a driver program (with certain command line arguments). The driver program is built as part of LIBXSMM's build process (when requesting static code generation), but also available via a separate build target:

```bash
make generator
bin/libxsmm_gemm_generator
```

The code generator driver program accepts the following arguments:

1. dense/dense_asm/sparse (dense creates C code, dense_asm creates ASM)
2. Filename of a file to append to
3. Routine name to be created
4. M parameter
5. N parameter
6. K parameter
7. LDA (0 when 1. is "sparse" indicates A is sparse)
8. LDB (0 when 1. is "sparse" indicates B is sparse)
9. LDC parameter
10. alpha (1)
11. beta (0 or 1)
12. Alignment override for A (1 auto, 0 no alignment)
13. Alignment override for C (1 auto, 0 no alignment)
14. Architecture (noarch, wsm, snb, hsw, knc, knl, knm, skx)
15. Prefetch strategy, see below enumeration (dense/dense_asm only)
16. single precision (SP), or double precision (DP)
17. CSC file (just required when 1. is "sparse"). Matrix market format.

The prefetch strategy can be:

1. "nopf": no prefetching at all, just 3 inputs (A, B, C)
2. "pfsigonly": just prefetching signature, 6 inputs (A, B, C, A', B', C')
3. "BL2viaC": uses accesses to C to prefetch B'
4. "curAL2": prefetches current A ahead in the kernel
5. "curAL2_BL2viaC": combines curAL2 and BL2viaC
6. "AL2": uses accesses to A to prefetch A'
7. "AL2_BL2viaC": combines AL2 and BL2viaC
8. "AL2jpst": aggressive A' prefetch of first rows without any structure
9. "AL2jpst_BL2viaC": combines AL2jpst and BL2viaC
10. "AL1": prefetch A' into L1 via accesses to A
11. "BL1": prefetch B' into L1 via accesses to B
12. "CL1": prefetch C' into L1 via accesses to C
13. "AL1_BL1": prefetch A' and B' into L1
14. "BL1_CL1": prefetch B' and C' into L1
15. "AL1_CL1": prefetch A' and C' into L1
16. "AL1_BL1_CL1": prefetch A', B', and C' into L1

Here are some examples of invoking the driver program:

```bash
bin/libxsmm_gemm_generator dense foo.c foo 16 16 16 32 32 32 1 1 1 1 hsw nopf DP
bin/libxsmm_gemm_generator dense_asm foo.c foo 16 16 16 32 32 32 1 1 1 1 knl AL2_BL2viaC DP
bin/libxsmm_gemm_generator sparse foo.c foo 16 16 16 32 0 32 1 1 1 1 hsw nopf DP bar.csc
```

Please note, there are additional examples given in samples/generator and samples/seissol.


text:
<ivysettings>

 <!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

 <!--
  see http://www.jayasoft.org/ivy/doc/configuration
  -->
  <!-- you can override this property to use mirrors
          https://repo1.maven.org/maven2/
          http://mirrors.dotsrc.org/maven2
          http://ftp.ggi-project.org/pub/packages/maven2
          http://mirrors.sunsite.dk/maven2
          http://public.planetmirror.com/pub/maven2
          http://ibiblio.lsu.edu/main/pub/packages/maven2
          http://www.ibiblio.net/pub/packages/maven2
  -->
  <property name="repo.maven.org" value="${mvnrepo}" override="true"/>
  <property name="repo.jboss.org" value="http://repository.jboss.com/nexus/content/groups/public/" override="false"/>
  <property name="repo.apache.snapshots" value="http://repository.apache.org/content/groups/snapshots-group/" override="false"/>
  <property name="repo.dir" value="${user.home}/.m2/repository" override="false"/>
  <property name="maven2.pattern" value="[organisation]/[module]/[revision]/[module]-[revision](-[classifier])"/>
  <property name="maven2.pattern.ext" value="${maven2.pattern}.[ext]"/>
  <property name="snapshot.pattern" value="[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"/>
  <property name="resolvers" value="default" override="false"/>
  <property name="force-resolve" value="false" override="false"/>
  <!-- pull in the local repository -->
  <include url="${ivy.default.conf.dir}/ivyconf-local.xml"/>
  <settings defaultResolver="${resolvers}"/>
  <resolvers>
    <ibiblio name="maven2" root="${repo.maven.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/>
    <ibiblio name="jboss-maven2" root="${repo.jboss.org}" pattern="${maven2.pattern.ext}" m2compatible="true"/>
    <ibiblio name="apache-snapshots" root="${repo.apache.snapshots}" pattern="${snapshot.pattern}"
         checkmodified="true" changingPattern=".*SNAPSHOT" m2compatible="true"/>
    <filesystem name="fs" m2compatible="true" checkconsistency="false" force="${force-resolve}"
         checkmodified="true" changingPattern=".*SNAPSHOT">
      <artifact pattern="${repo.dir}/${maven2.pattern.ext}"/>
      <ivy pattern="${repo.dir}/[organisation]/[module]/[revision]/[module]-[revision].pom"/>
    </filesystem>
    <chain name="internal" checkmodified="true">
      <resolver ref="fs"/>
    </chain>
    <chain name="external" dual="true">
      <resolver ref="maven2"/>
      <resolver ref="jboss-maven2"/>
      <resolver ref="apache-snapshots"/>
    </chain>
    <chain name="default" dual="true" checkmodified="true">
      <resolver ref="internal"/>
      <resolver ref="external"/>
    </chain>
  </resolvers>
  <modules>
    <module organisation="org.apache.pig" name=".*" resolver="internal"/>
  </modules>
</ivysettings>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit trunk//EN" "http://google-web-toolkit.googlecode.com/svn/trunk/distro-source/core/src/gwt-module.dtd">
<module rename-to="html">
	<inherits name='com.badlogic.gdx.backends.gdx_backends_gwt' />
	<inherits name='com.badlogic.gdx.physics.box2d.box2d-gwt' />
	<inherits name='com.badlogic.gdx.controllers.controllers-gwt' />
	<inherits name='com.badlogic.gdx.ai' />
	<inherits name='com.badlogic.ashley_gwt' />
	<inherits name='Box2DLights' />
	<inherits name='com.kotcrab.vis.vis-runtime' />
	<inherits name='com.kotcrab.vis.vis-ui' />
	<inherits name='libgdx-utils-box2d' />
	<inherits name='libgdx-utils' />

	<inherits name='MyDialogStarter' />
	<entry-point class='com.equippedcoding.libgdx.mydialog.client.HtmlLauncher' />

	<set-configuration-property name="gdx.assetpath" value="../android/assets" />
</module>


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.activiti.rest.dmn.service.api.repository;

import org.activiti.dmn.api.DmnDecisionTable;
import org.activiti.dmn.engine.test.DmnDeploymentAnnotation;
import org.activiti.rest.dmn.service.api.BaseSpringDmnRestTestCase;
import org.activiti.rest.dmn.service.api.DmnRestUrls;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;

/**
 * @author Yvo Swillens
 */
public class DecisionTableResourceDataResourceTest extends BaseSpringDmnRestTestCase {

  @DmnDeploymentAnnotation(resources = { "org/activiti/rest/dmn/service/api/repository/simple.dmn" })
  public void testGetDecisionTableResource() throws Exception {

    DmnDecisionTable decisionTable = dmnRepositoryService.createDecisionTableQuery().singleResult();

    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + DmnRestUrls.createRelativeResourceUrl(DmnRestUrls.URL_DECISION_TABLE_RESOURCE_CONTENT, decisionTable.getId()));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_OK);

    // Check "OK" status
    String content = IOUtils.toString(response.getEntity().getContent());
    closeResponse(response);
    assertNotNull(content);
    assertTrue(content.contains("Full Decision"));
  }

  public void testGetDecisionTableResourceForUnexistingDecisionTable() throws Exception {
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX + DmnRestUrls.createRelativeResourceUrl(DmnRestUrls.URL_DECISION_TABLE_RESOURCE_CONTENT, "unexisting"));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_NOT_FOUND);
    closeResponse(response);
  }
}


text:
require 'net/http'
require 'uri'
require 'timeout'

require 'rubygems'
require 'nokogiri'

class MetaService
  attr_reader :timeout, :method_param, :service_name

  SERVICE_VERSION = 1

  def initialize(options = {})
    @service_name = 'Web Service'
    @timeout ||= 20
    @method_param ||= 'function'
    @default_params = {}
    @debug = options[:debug]
  end

  #
  # Sends a request to a service function, and returns an Hpricot object of
  # the xml response.
  #
  # TODO: handle bad responses!
  #
  def request(method, args = {})
    params      = args.merge({@method_param => method})
    params      = params.merge(@default_params)
    url         = @endpoint + params.map {|k,v| "#{k}=#{v}"}.join('&')
    uri         = URI.encode(url)
    request_uri = URI.parse(uri)
    response = nil
    begin
      # timed_out = Timeout::timeout(@timeout) do
      #   response = Net::HTTP.start(request_uri.host) do |http|
      #     http.get("#{request_uri.path}?#{request_uri.query}", 'User-Agent' => "#{self.class}/#{SERVICE_VERSION}")
      #   end
      # end
      options = {}
      options[:request_uri] = request_uri
      options[:user_agent] = "#{self.class}/#{SERVICE_VERSION}"
      response = fetch_with_redirects(options,3)
    rescue Timeout::Error
      raise Timeout::Error, "#{@service_name} didn't respond within #{@timeout} seconds."
    end
    Nokogiri::XML(response.body)
  end

  def fetch_with_redirects(options, attempts = 3)
    # using SSL if we have an https URL
    http = Net::HTTP.new(options[:request_uri].host, options[:request_uri].port)
    http.use_ssl = (options[:request_uri].scheme == "https")
    response = http.get("#{options[:request_uri].path}?#{options[:request_uri].query}", "User-Agent" => options[:user_agent])
    if response.is_a?(Net::HTTPRedirection) && attempts > 0
      options[:request_uri] = URI.parse(response["location"])
      return fetch_with_redirects(options, attempts - 1)
    end
    response
  end

  def method_missing(method, *args)
    # puts "DEBUG: You tried to call '#{method}'" # test
    params = *args
    params = params.first if params.is_a?(Array) && params.size == 1
    unless params.nil? || (params.is_a?(Hash) and not params.empty?)
      raise "#{@service_name}##{method} arguments must be a Hash"
    end
    request(method, *args)
  end
end


text:
function checkOS(...)
	local os=MOAIEnvironment.osBrand
	for i=1, select('#',...) do
		local n=select(i,...)
		if os==n then return true end
	end
	return false
end

function checkLanguage(...)
	local lang=MOAIEnvironment.languageCode or 'en'

	lang=string.lower(lang)
	for i=1, select('#',...) do
		local n=select(i,...)
		if lang==n then return true end
	end
	return false
end

------------RESOLUTION related
function getDeviceScreenSpec()
	local os=string.lower(MOAIEnvironment.osBrand)
	if os=='osx' or os=='windows' or os=='linux' then return os end

	local sw,sh=
						MOAIEnvironment.horizontalResolution
						,MOAIEnvironment.verticalResolution

	local deviceName=""

	if os=='ios' then
		if     checkDimension( sw, sh, 320,    480   ) then deviceName = 'iphone'
		elseif checkDimension( sw, sh, 640,    960   ) then deviceName = 'iphone4'
		elseif checkDimension( sw, sh, 640,    1136  ) then deviceName = 'iphone5'
		elseif checkDimension( sw, sh, 1024,   768   ) then deviceName = 'ipad'
		elseif checkDimension( sw, sh, 1024*2, 768*2 ) then deviceName = 'ipad3'
		end

	elseif os=='android' then
		deviceName=""
	else --???
		error("what ?")
	end
	return os, deviceName, sw,sh
end

local deviceResolutions={
	iphone  = {320,480},
	iphone4 = {640,960},
	iphone5 = {640,1136},
	ipad    = {768,1024},
	ipad2   = {768,1024},
	ipad3   = {768*2,1024*2},
	ipad4   = {768*2,1024*2},
	android = {480,800},
}

function getResolutionByDevice(simDeviceName,simDeviceOrientation)
	if simDeviceName then
		local w,h=unpack(deviceResolutions[simDeviceName])
		if simDeviceOrientation=='portrait' then
			return w,h
		else
			return h,w
		end
	end
	return 0,0
end

function getDeviceResolution(simDeviceName,simDeviceOrientation)
	local sw,sh=
						MOAIEnvironment.horizontalResolution
						,MOAIEnvironment.verticalResolution

	if sw and sw and sw*sh~=0 then
		return sw,sh
	elseif simDeviceName then
		return getResolutionByDevice(simDeviceName,simDeviceOrientation)
	end

	return 0,0
end

--------MOAI class tweak
function extractMoaiInstanceMethods(clas,...)
	local methods={...}
	local funcs={}
	local obj=clas.new()
	for i, m in ipairs(methods) do
		local f=obj[m]
		assert(f,'method not found:'..m)
		funcs[i]=f
	end
	return unpack(funcs)
end

function injectMoaiClass( clas, methods )
	local interfaceTable = clas.getInterfaceTable()
	for k, v in pairs(methods) do
		interfaceTable[ k ] = v
	end
end

----------URL
function openURLInBrowser(url)
	if checkOS('iOS') then
		-- print('open url in safari',url)
		MOAIWebViewIOS.openUrlInSafari(url)

	elseif checkOS('Android') then
		-- print('open url in browser',url)
		MOAIAppAndroid.openURL(url)
	else
		os.execute(string.format('open %q',url))
	end
end

function openRateURL(appID)
	if checkOS('iOS') then
		local url=
			'itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id='
			..appID
		openURLInBrowser(url)
	elseif checkOS('Android') then
		--todo
	end
end

if checkOS('Android') then
	print = MOAILogMgr.log
end

function grabNextFrame( filepath, frameBuffer, format )
	format = format or MOAIImage.COLOR_FMT_RGB_888
	local image = MOAIImage.new()
	frameBuffer = frameBuffer or MOAIGfxDevice.getFrameBuffer()
	frameBuffer:grabNextFrame(
		image,
		function()
			image:convert( format ):writePNG(filepath)
			io.write('saved:   ',filepath,'\n')
		end)
end

function grabCurrentFrameToFile( filepath, frameBuffer, format )
	format = format or MOAIImage.COLOR_FMT_RGB_888
	local image = MOAIImage.new()
	frameBuffer = frameBuffer or MOAIGfxDevice.getFrameBuffer()
	frameBuffer:grabCurrentFrame( image )
	image:convert( format ):writePNG(filepath)
	io.write('saved:   ',filepath,'\n')
	return image
end

-------replace system os.clock
os._clock=os.clock
os.clock=MOAISim.getDeviceTime
local JSON_FLAG_INDENT         = function( n ) return n > 0x1f and 0x1f or n < 0 and 0 or n end
local JSON_FLAG_COMPACT        = 0x20
local JSON_FLAG_SORT_KEY       = 0x80
local JSON_FLAG_PRESERVE_ORDER = 0x100
local JSON_FLAG_ENCODE_ANY     = 0x200

----
MOAIJsonParser.defaultEncodeFlags =
	JSON_FLAG_INDENT( 2 ) + JSON_FLAG_SORT_KEY

function encodeJSON( data, compact ) --included default flags
	if compact then
		return MOAIJsonParser.encode( data, JSON_FLAG_SORT_KEY + JSON_FLAG_COMPACT )
	else
		return MOAIJsonParser.encode( data, MOAIJsonParser.defaultEncodeFlags )
	end
end

function decodeJSON( data ) --included default flags
	return MOAIJsonParser.decode( data )
end

--------------------------------------------------------------------
----extract all easetype constant to global env?
--------------------------------------------------------------------

EASE_IN        = MOAIEaseType.EASE_IN
EASE_OUT       = MOAIEaseType.EASE_OUT
FLAT           = MOAIEaseType.FLAT
LINEAR         = MOAIEaseType.LINEAR
SHARP_EASE_IN  = MOAIEaseType.SHARP_EASE_IN
SHARP_EASE_OUT = MOAIEaseType.SHARP_EASE_OUT
SHARP_SMOOTH   = MOAIEaseType.SHARP_SMOOTH
SMOOTH         = MOAIEaseType.SMOOTH
SOFT_EASE_IN   = MOAIEaseType.SOFT_EASE_IN
SOFT_EASE_OUT  = MOAIEaseType.SOFT_EASE_OUT
SOFT_SMOOTH    = MOAIEaseType.SOFT_SMOOTH
BACK_IN        = MOAIEaseType.BACK_IN
BACK_OUT       = MOAIEaseType.BACK_OUT
BACK_SMOOTH    = MOAIEaseType.BACK_SMOOTH
ELASTIC_IN     = MOAIEaseType.ELASTIC_IN
ELASTIC_OUT    = MOAIEaseType.ELASTIC_OUT
ELASTIC_SMOOTH = MOAIEaseType.ELASTIC_SMOOTH
BOUNCE_IN      = MOAIEaseType.BOUNCE_IN
BOUNCE_OUT     = MOAIEaseType.BOUNCE_OUT
BOUNCE_SMOOTH  = MOAIEaseType.BOUNCE_SMOOTH

--------------------------------------------------------------------

function saveMOAIGridTiles( grid )
	local stream = MOAIMemStream.new()
	stream:open()

	local writer64 = MOAIStreamAdapter.new()
	local writerDeflate = MOAIStreamAdapter.new ()
	writer64:openBase64Writer ( stream )
	writerDeflate:openDeflateWriter ( writer64 )
	grid:streamTilesOut( writerDeflate )
	writerDeflate:close()
	writer64:close()

	stream:seek( 0 )
	local encoded = stream:read()
	stream:close()

	return encoded
end

function loadMOAIGridTiles( grid, dataString )

	local stream = MOAIMemStream.new()
	stream:write( dataString )
	stream:seek(0)

	local reader64 = MOAIStreamAdapter.new()
	local readerDeflate = MOAIStreamAdapter.new ()
	reader64:openBase64Reader( stream )
	readerDeflate:openDeflateReader( reader64 )

	grid:streamTilesIn( readerDeflate )

	readerDeflate:close()
	reader64:close()
	stream:close()

end

function saveImageBase64( img )
	local stream = MOAIMemStream.new()
	stream:open()
	local writer64 = MOAIStreamAdapter.new()
	local writerDeflate = MOAIStreamAdapter.new ()
	writer64:openBase64Writer ( stream )
	img:write( writer64 )
	stream:seek( 0 )
	local encoded = stream:read()
	stream:close()
	return encoded
end

function loadImageBase64( img, dataString, transform )
	local buffer = MOAIDataBuffer.new()
	buffer:base64Decode( dataString )
	local img = img or MOAIImage.new ()
	img:loadFromBuffer( buffer, transform )
	return img
end

local function _isValidCoord( x, y, w, h )
	if x < 1 then return false end
	if y < 1 then return false end
	if x > w then return false end
	if y > h then return false end
	return true
end

function resizeMOAIGrid( grid, w, h, tw, th ,ox, oy, cw, ch, gx, gy )
	gx = gx or 0
	gy = gy or 0
	local ow, oh = grid:getSize()
	local tmpGrid = MOAIGrid.new()
	tmpGrid:setSize( w, h )
	local w0, h0 = grid:getSize()
	for y = 1, h do
		for x = 1, w do
			local x1, y1 = x + gx, y + gy
			if _isValidCoord( x1, y1, w0, h0 ) then
				tmpGrid:setTile( x, y, grid:getTile( x1, y1 ) )
			end
		end
	end
	grid:setSize( w,h,tw,th,ox,oy,cw,ch )
	for y = 1, h do
		for x = 1, w do
			grid:setTile( x, y, tmpGrid:getTile( x, y ) )
		end
	end
end

function subdivideMOAIGrid( grid, tw, th ,ox, oy, cw, ch )
	local ow, oh = grid:getSize()

	local tmpGrid = MOAIGrid.new()
	tmpGrid:setSize( ow, oh )
	for y = 1, oh do
		for x = 1, ow do
			tmpGrid:setTile( x, y, grid:getTile( x, y ) )
		end
	end

	local nw = ow * 2
	local nh = oh * 2
	grid:setSize( nw,nh,tw,th,ox,oy,cw,ch )
	for y = 1, nh do
		for x = 1, nw do
			grid:setTile( x, y, tmpGrid:getTile( x/2, y/2 ) )
		end
	end

end


text:
#include "config.h"
#include "HTMLSourceElement.h"

#include "Event.h"
#include "EventNames.h"
#include "HTMLDocument.h"
#if ENABLE(VIDEO)
#include "HTMLMediaElement.h"
#endif
#include "HTMLNames.h"
#include "HTMLPictureElement.h"
#include "Logging.h"

namespace WebCore {

using namespace HTMLNames;

inline HTMLSourceElement::HTMLSourceElement(const QualifiedName& tagName, Document& document)
    : HTMLElement(tagName, document)
    , ActiveDOMObject(&document)
    , m_errorEventTimer(*this, &HTMLSourceElement::errorEventTimerFired)
{
    LOG(Media, "HTMLSourceElement::HTMLSourceElement - %p", this);
    ASSERT(hasTagName(sourceTag));
}

Ref<HTMLSourceElement> HTMLSourceElement::create(const QualifiedName& tagName, Document& document)
{
    Ref<HTMLSourceElement> sourceElement = adoptRef(*new HTMLSourceElement(tagName, document));
    sourceElement->suspendIfNeeded();
    return sourceElement;
}

Node::InsertionNotificationRequest HTMLSourceElement::insertedInto(ContainerNode& insertionPoint)
{
    HTMLElement::insertedInto(insertionPoint);
    Element* parent = parentElement();
    if (parent) {
#if ENABLE(VIDEO)
        if (is<HTMLMediaElement>(*parent))
            downcast<HTMLMediaElement>(*parent).sourceWasAdded(this);
        else
#endif
        if (is<HTMLPictureElement>(*parent))
            downcast<HTMLPictureElement>(*parent).sourcesChanged();
    }
    return InsertionDone;
}

void HTMLSourceElement::removedFrom(ContainerNode& removalRoot)
{
    Element* parent = parentElement();
    if (!parent && is<Element>(removalRoot))
        parent = &downcast<Element>(removalRoot);
    if (parent) {
#if ENABLE(VIDEO)
        if (is<HTMLMediaElement>(*parent))
            downcast<HTMLMediaElement>(*parent).sourceWasRemoved(this);
        else
#endif
        if (is<HTMLPictureElement>(*parent))
            downcast<HTMLPictureElement>(*parent).sourcesChanged();
    }
    HTMLElement::removedFrom(removalRoot);
}

void HTMLSourceElement::setSrc(const String& url)
{
    setAttributeWithoutSynchronization(srcAttr, url);
}

String HTMLSourceElement::media() const
{
    return attributeWithoutSynchronization(mediaAttr);
}

void HTMLSourceElement::setMedia(const String& media)
{
    setAttributeWithoutSynchronization(mediaAttr, media);
}

String HTMLSourceElement::type() const
{
    return attributeWithoutSynchronization(typeAttr);
}

void HTMLSourceElement::setType(const String& type)
{
    setAttributeWithoutSynchronization(typeAttr, type);
}

void HTMLSourceElement::scheduleErrorEvent()
{
    LOG(Media, "HTMLSourceElement::scheduleErrorEvent - %p", this);
    if (m_errorEventTimer.isActive())
        return;

    m_errorEventTimer.startOneShot(0);
}

void HTMLSourceElement::cancelPendingErrorEvent()
{
    LOG(Media, "HTMLSourceElement::cancelPendingErrorEvent - %p", this);
    m_errorEventTimer.stop();
}

void HTMLSourceElement::errorEventTimerFired()
{
    LOG(Media, "HTMLSourceElement::errorEventTimerFired - %p", this);
    dispatchEvent(Event::create(eventNames().errorEvent, false, true));
}

bool HTMLSourceElement::isURLAttribute(const Attribute& attribute) const
{
    return attribute.name() == srcAttr || HTMLElement::isURLAttribute(attribute);
}

const char* HTMLSourceElement::activeDOMObjectName() const
{
    return "HTMLSourceElement";
}

bool HTMLSourceElement::canSuspendForDocumentSuspension() const
{
    return true;
}

void HTMLSourceElement::suspend(ReasonForSuspension why)
{
    if (why == PageCache) {
        m_shouldRescheduleErrorEventOnResume = m_errorEventTimer.isActive();
        m_errorEventTimer.stop();
    }
}

void HTMLSourceElement::resume()
{
    if (m_shouldRescheduleErrorEventOnResume) {
        m_errorEventTimer.startOneShot(0);
        m_shouldRescheduleErrorEventOnResume = false;
    }
}

void HTMLSourceElement::stop()
{
    cancelPendingErrorEvent();
}

void HTMLSourceElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
    HTMLElement::parseAttribute(name, value);
    if (name == srcsetAttr || name == sizesAttr || name == mediaAttr || name == typeAttr) {
        if (name == mediaAttr)
            m_mediaQuerySet = MediaQuerySet::createAllowingDescriptionSyntax(value);
        auto* parent = parentNode();
        if (is<HTMLPictureElement>(parent))
            downcast<HTMLPictureElement>(*parent).sourcesChanged();
    }
}

}


text:
package com.google.api.ads.dfp.jaxws.v201306;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
 *             Contains statistics such as impressions, clicks delivered and cost
 *             for {@link LineItemCreativeAssociation} objects.
 *
 *
 *
Java class for LineItemCreativeAssociationStats complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="LineItemCreativeAssociationStats">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="stats" type="{https://www.google.com/apis/ads/publisher/v201306}Stats" minOccurs="0"/>
 *         <element name="creativeSetStats" type="{https://www.google.com/apis/ads/publisher/v201306}Long_StatsMapEntry" maxOccurs="unbounded" minOccurs="0"/>
 *         <element name="costInOrderCurrency" type="{https://www.google.com/apis/ads/publisher/v201306}Money" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LineItemCreativeAssociationStats", propOrder = {
    "stats",
    "creativeSetStats",
    "costInOrderCurrency"
})
public class LineItemCreativeAssociationStats {

    protected Stats stats;
    protected List<LongStatsMapEntry> creativeSetStats;
    protected Money costInOrderCurrency;

    /**
     * Gets the value of the stats property.
     *
     * @return
     *     possible object is
     *     {@link Stats }
     *
     */
    public Stats getStats() {
        return stats;
    }

    /**
     * Sets the value of the stats property.
     *
     * @param value
     *     allowed object is
     *     {@link Stats }
     *
     */
    public void setStats(Stats value) {
        this.stats = value;
    }

    /**
     * Gets the value of the creativeSetStats property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the creativeSetStats property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getCreativeSetStats().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link LongStatsMapEntry }
     *
     *
     */
    public List<LongStatsMapEntry> getCreativeSetStats() {
        if (creativeSetStats == null) {
            creativeSetStats = new ArrayList<LongStatsMapEntry>();
        }
        return this.creativeSetStats;
    }

    /**
     * Gets the value of the costInOrderCurrency property.
     *
     * @return
     *     possible object is
     *     {@link Money }
     *
     */
    public Money getCostInOrderCurrency() {
        return costInOrderCurrency;
    }

    /**
     * Sets the value of the costInOrderCurrency property.
     *
     * @param value
     *     allowed object is
     *     {@link Money }
     *
     */
    public void setCostInOrderCurrency(Money value) {
        this.costInOrderCurrency = value;
    }

}


text:
require 'reek/source/ast_node'
require 'reek/source/sexp_node'
require 'reek/source/sexp_extensions'

module Reek
  module Source
    # Maps AST node types to sublasses of AstNode extended with the relevant
    # utility modules.
    class AstNodeClassMap
      def initialize
        @klass_map = {}
      end

      def klass_for(type)
        @klass_map[type] ||=
          begin
            klass = Class.new(AstNode)
            klass.send :include, extension_map[type] if extension_map[type]
            klass.send :include, SexpNode
          end
      end

      def extension_map
        @extension_map ||=
          begin
            assoc = SexpExtensions.constants.map do |const|
              [
                const.to_s.sub(/Node$/, '').downcase.to_sym,
                SexpExtensions.const_get(const)
              ]
            end
            Hash[assoc]
          end
      end
    end
  end
end