text:
using GenericHalHelper;
using GenericHalHelper.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF_HalBrowser
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            BaseAddress.Text = "http://fbombcode.com";
            RelativeAddress.Text = "api/articles";
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var baseAddress = BaseAddress.Text;
                var relativeAddress = RelativeAddress.Text;
                using (HttpClient client = new HttpClient())
                {
                    var HalMediaType = new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/vnd.hal+json");
                    client.DefaultRequestHeaders.Accept.Add(HalMediaType);
                    client.BaseAddress = new Uri(baseAddress);
                    HalClient hal = new HalClient(client);
                    var obj = hal.Get(relativeAddress);

                    ClearControls();
                    CreateProperties(obj, Properties);
                    CreateLinks(obj, Links);
                    CreateEmbedded(obj, Embedded);
                }
            }
            catch(Exception exc)
            {
                MessageBox.Show(exc.Message, "You should feel bad about this error", MessageBoxButton.OK);
            }
        }

        private void ClearControls()
        {
            Links.Children.Clear();
            Properties.Children.Clear();
            Embedded.Children.Clear();
        }

        private void CreateLinks(HalObject obj, StackPanel panel)
        {
            if (obj.Links != null && obj.Links.Count > 0)
            {
                var title = new TextBlock()
                {
                    Text = "Links",
                    FontSize = panel.Name == "Embedded" ? 14 : 16,
                    TextDecorations = System.Windows.TextDecorations.Underline
                };
                panel.Children.Add(title);
                foreach (var p in obj.Links.Keys)
                {
                    var label = new TextBlock()
                    {
                        Text = p
                    };
                    panel.Children.Add(label);
                    foreach(var l in obj.Links[p])
                    {
                        var label2 = new Button()
                        {
                            Content = l.Href,
                            Style = this.FindResource("LinkButton") as Style
                        };
                        label2.Click += ClickLinkEvent;
                        panel.Children.Add(label2);
                    }
                }
            }
        }

        private void ClickLinkEvent(object sender, RoutedEventArgs e)
        {
            var btn = (Button)sender;
            RelativeAddress.Text = btn.Content.ToString();
        }

        private void CreateProperties(HalObject obj, StackPanel panel)
        {
            if (obj.DataProperties != null && obj.DataProperties.Count > 0)
            {
                var title = new TextBlock()
                {
                    Text = "Properties",
                    FontSize = panel.Name == "Embedded" ? 14 : 16,
                    TextDecorations = System.Windows.TextDecorations.Underline
                };
                panel.Children.Add(title);
                foreach (var p in obj.DataProperties.Keys)
                {
                    var label = new TextBlock()
                    {
                        Text = p + " : " + obj.DataProperties[p]
                    };
                    panel.Children.Add(label);
                }
            }
        }

        private void CreateEmbedded(HalObject obj, StackPanel panel)
        {

           if (obj.EmbeddedResources != null && obj.EmbeddedResources.Count > 0)
           {
               var title = new TextBlock()
                {
                    Text = "Embedded",
                    FontSize = 16,
                    TextDecorations = System.Windows.TextDecorations.Underline
                };
                panel.Children.Add(title);
                foreach (var p in obj.EmbeddedResources.Keys)
                {
                    int i = 0;
                    foreach(var e in obj.EmbeddedResources[p])
                    {
                        var countTitle = new TextBlock()
                        {
                            Text = i++.ToString()+") " + p
                        };
                        panel.Children.Add(countTitle);
                        CreateProperties(e, panel);
                        CreateLinks(e, panel);

                        var blank = new TextBlock()
                        {
                            Text = "--------------------------------------"
                        };
                        panel.Children.Add(blank);
                    }
                }
           }
        }
    }
}


text:
using Starcounter;
using Simplified.Ring2;

namespace Simplified.Ring6
{
    [Database]
    public class SkypeIdRelation : ContactInfoRelation
    {
        /// <summary>
        /// Synonymous to <see cref="ContactInfoRelation.ContactInfo"/>
        /// </summary>
        public SkypeId SkypeId
        {
            get
            {
                return this.ContactInfo as SkypeId;
            }
            set
            {
                this.ContactInfo = value;
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
var request = require('request');
var assert = require('assert');
var _u = require('rutil');
var moment = require('moment');

exports.getData = function(test) {

    var startDate = moment().subtract('days', 30).format();
    var endDate = moment().format();
    var symbol = 'GOOG';

    console.log(startDate, endDate);

    var params = {
        Normalized: true,
        StartDate: startDate,
        EndDate: endDate,
        EndOffsetDays: 0,
        NumberOfDays: 20,
        DataPeriod: 'Day',
        Elements: [
            {
                Symbol: symbol,
                Type: 'price',
                Params: ['ohlc']
            }
        ]
    };

    var url = ['http://dev.markitondemand.com/Api/v2/InteractiveChart/json','?', 'parameters=', encodeURIComponent(JSON.stringify(params))].join('');

    console.log(url);

    request(url, function(err, res, body) {
        console.log(err, body);
        test.equal(err, null);
        test.ok(body);
        test.done();
    });
};


text:
import mockAxios from "jest-mock-axios";
export default mockAxios;


text:
class OverlayUser : public OverlayGroup {
	private:
		Q_DISABLE_COPY(OverlayUser)
	public:
		enum { Type = UserType + 1 };
	protected:
		QGraphicsPixmapItem *qgpiMuted, *qgpiDeafened;
		QGraphicsPixmapItem *qgpiAvatar;
		QGraphicsPixmapItem *qgpiName[4];
		QGraphicsPixmapItem *qgpiChannel;
		QGraphicsPathItem *qgpiBox;

		OverlaySettings *os;

		unsigned int uiSize;
		ClientUser *cuUser;
		Settings::TalkState tsColor;

		QString qsName;
		QString qsChannelName;
		QByteArray qbaAvatar;

		void setup();

	public:
		OverlayUser(ClientUser *cu, unsigned int uiSize, OverlaySettings *osptr);
		OverlayUser(Settings::TalkState ts, unsigned int uiSize, OverlaySettings *osptr);
		void updateUser();
		void updateLayout();

		int type() const Q_DECL_OVERRIDE;
		static QRectF scaledRect(const QRectF &qr, qreal scale);
		static QPointF alignedPosition(const QRectF &box, const QRectF &item, Qt::Alignment a);
};

#endif


text:
( function( factory ) {
    "use strict";
    if ( typeof define === "function" && define.amd ) {

        // AMD
        define( [ "jquery" ], factory );
    } else if ( typeof exports === "object" ) {

        // CommonJs
        factory( require( "jquery" ) );
    } else {

        // Browser globals
        factory( jQuery );
    }
}( function( $ ) {
    "use strict";
    $.fn.broiler = function( callBack ) {
        var image = this[ 0 ],
            canvas = $( "<canvas/>" )[ 0 ],
            imageData;
        canvas.width = image.width;
        canvas.height = image.height;
        canvas.getContext( "2d" ) .drawImage( image, 0, 0, image.width, image.height );
        imageData = canvas.getContext( "2d" ).getImageData( 0, 0, image.width, image.height ).data;
        this.click( function( event ) {
            var offset = $( this ).offset(), x, y, scrollLeft, scrollTop, start;
            scrollLeft = $( window ).scrollLeft();
            scrollTop = $( window ).scrollTop();
            x = Math.round( event.clientX - offset.left + scrollLeft );
            y = Math.round( event.clientY - offset.top + scrollTop );
            start = ( x + y * image.width ) * 4;
            callBack( {
                r: imageData[ start ],
                g: imageData[ start + 1 ],
                b: imageData[ start + 2 ],
                a: imageData[ start + 3 ]
            } );
        } );
    };
} ) );


text:
var searchData=
[
  ['clickeventargs',['ClickEventArgs',['../class_u_forms_1_1_events_1_1_click_event_args.html',1,'UForms::Events']]],
  ['clipcontent',['ClipContent',['../class_u_forms_1_1_decorators_1_1_clip_content.html',1,'UForms::Decorators']]],
  ['colorfield',['ColorField',['../class_u_forms_1_1_controls_1_1_fields_1_1_color_field.html',1,'UForms::Controls::Fields']]],
  ['contextmenucontrol',['ContextMenuControl',['../class_u_forms_1_1_controls_1_1_context_menu_control.html',1,'UForms::Controls']]],
  ['control',['Control',['../class_u_forms_1_1_controls_1_1_control.html',1,'UForms::Controls']]],
  ['curvefield',['CurveField',['../class_u_forms_1_1_controls_1_1_fields_1_1_curve_field.html',1,'UForms::Controls::Fields']]]
];


text:
/**
 * @desc Directiva personalizada.
 * @example <nuevo-donante></nuevo-donante>
 * @author Roberto Sottini <robysottini@gmail.com>
 */
// Nombre de directiva (JavaScript): se usa camelcase.
// Nombre de la etiqueta (HTML): se usa guión medio.
(function() {
    'use strict';

    angular
        .module('donacionesApp.nuevoDonante')
        .directive('nuevoDonante', nuevoDonante);

    function nuevoDonante() {
        return {
            restrict: 'E', // Creo el nuevo elemento (E: Element) con nombre 'nuevo-donante'.
            templateUrl: 'app/nuevo-donante/nuevo-donante.html'
        };
    }
})();


text:
[![Build Status](https://travis-ci.org/jakutis/directory-hash.svg)](https://travis-ci.org/jakutis/directory-hash)

What is described below is not yet implemented.

See [directory-hash-rust](https://github.com/jakutis/directory-hash-rust) for a more complete implementation.

## Operations

### list_errors directory

List all errors encountered while reading the filesystem directory tree.

### hash directory > all.file

Lists all paths and their hashes.

### fix_nonutf8_paths directory replacement

Renames all paths whose string is not a valid utf8 string by replacing invalid utf8 parts with the `replacement` string.

### list_nonutf8_paths directory

Lists all paths whose string is not a valid utf8 string.

### update directory all.file < changed.file > all.file

Checks if files are really existing and changed and adds lines to `all.file`.

### add directory all.file < new.file > all.file

Checks if files are really new and adds lines to `all.file`.

### remove directory all.file < missing.file > all.file

Checks if files are really missing and removes lines in `all.file`.

### changed directory all.file[ path] > changed.file

Path is by default "/".
Checks all hashes in `all.file` and lists paths with changed hashes.

### new directory all.file[ path] > new.file

Path is by default "/".
Lists all paths that are not in `all.file`.

### missing directory all.file[ path] > missing.file

Path is by default "/".
Lists all paths that are not in directory.

### duplicate all.file[ path] > duplicate.file

Path is by default "/".
Lists all paths that have identical contents in directory.

### import directory all.file path backup-directory absolute-path > all.file

0. Finds all new, changed and missing paths.
0. Backs up files (actually happens in the next step, to avoid copying).
0. Moves new and changed, deletes missing.
0. Lists all paths and their hashes.

## Files

* `all.file`: hash + path
* `changed.file`, `new.file`, `missing.file`, `duplicate.file`: path

## Tips

* have your `all.file` in a git repository
* have this workflow:
  * `mkdir /some/directory /some/directory.writable /some/directory.outgoing /some/directory.incoming`
  * `mount --bind /some/directory.writable /some/directory`
  * `mount -o remount,ro,bind /some/directory`
  * `/some/directory` is a directory for user reads
  * `/some/directory.writable` is **directory**
  * `/some/directory.outgoing` is **backup-directory**
  * `/some/directory.incoming` is a directory for user writes


text:
"""
  FOR WORD PREDICTION : O(1)
  FOR WORD PREDICTION WITH 'R'TH RANK: O(R)
  ADDED POROBAILITY USING INTERPOLATION
"""
#import the modules necessary
from nltk.util import ngrams
from collections import defaultdict
from collections import OrderedDict
import string
import time
import gc

start_time = time.time()

#returns : void
#arg: string,dict,dict,dict,dict
#loads the corpus for the dataset and makes the frequency count of quadgram and trigram strings
def loadCorpus(file_path,tri_dict,quad_dict,vocab_dict,bi_dict):

    w1 = ''    #for storing the 3rd last word to be used for next token set
    w2 = ''    #for storing the 2nd last word to be used for next token set
    w3 = ''    #for storing the last word to be used for next token set
    token = []
    word_len = 0

    #open the corpus file and read it line by line
    with open(file_path,'r') as file:
        for line in file:

            #split the line into tokens
            token = line.split()
            i = 0

            #for each word in the token list ,remove pucntuations and change to lowercase
            for word in token :
                for l in word :
                    if l in string.punctuation:
                        word = word.replace(l," ")
                token[i] = word.lower()
                i=i+1

            #make the token list into a string
            content = " ".join(token)
            token = content.split()
            word_len = word_len + len(token)

            if not token:
                continue

            #add the last word from previous line
            if w3!= '':
                token.insert(0,w3)

            temp0 = list(ngrams(token,2))

            #since we are reading line by line some combinations of word might get missed for pairing
            #for trigram
            #first add the previous words
            if w2!= '':
                token.insert(0,w2)

            #tokens for trigrams
            temp1 = list(ngrams(token,3))

            #insert the 3rd last word from previous line for quadgram pairing
            if w1!= '':
                token.insert(0,w1)

            #add new unique words to the vocaulary set if available
            for word in token:
                if word not in vocab_dict:
                    vocab_dict[word] = 1
                else:
                    vocab_dict[word]+= 1

            #tokens for quadgrams
            temp2 = list(ngrams(token,4))

            #count the frequency of the bigram sentences
            for t in temp0:
                sen = ' '.join(t)
                bi_dict[sen] += 1

            #count the frequency of the trigram sentences
            for t in temp1:
                sen = ' '.join(t)
                tri_dict[sen] += 1

            #count the frequency of the quadgram sentences
            for t in temp2:
                sen = ' '.join(t)
                quad_dict[sen] += 1

            #then take out the last 3 words
            n = len(token)

            #store the last few words for the next sentence pairing
            w1 = token[n -3]
            w2 = token[n -2]
            w3 = token[n -1]
    return word_len
####################################################################################

#returns: string
#arg: string
#remove punctuations and make the string lowercase
def removePunctuations(sen):

    #split the string into word tokens
    temp_l = sen.split()
    i = 0

    #changes the word to lowercase and removes punctuations from it
    for word in temp_l :
        for l in word :
            if l in string.punctuation:
                word = word.replace(l," ")
        temp_l[i] = word.lower()
        i=i+1

    #spliting is being don here beacause in sentences line here---so after punctuation removal it should
    #become "here so"
    content = " ".join(temp_l)

    return content

####################################################################################

#returns: string
#arg: string,dict,int
#does prediction for the the sentence
def doPrediction(sen,prob_dict,rank = 1):
    if sen in prob_dict:
        if rank <= len(prob_dict[sen]):
            return prob_dict[sen][rank-1][1]
        else:
            return prob_dict[sen][0][1]
    else:
        return "Can't predict"

####################################################################################

#returns: void
#arg: dict,dict,dict,dict,dict,int
#creates dict for storing probable words with their probabilities for a trigram sentence
def createProbableWordDict(bi_dict,tri_dict,quad_dict,prob_dict,vocab_dict,token_len):
    for quad_sen in quad_dict:
        prob = 0.0
        quad_token = quad_sen.split()
        tri_sen = ' '.join(quad_token[:3])
        tri_count = tri_dict[tri_sen]

        if tri_count != 0:
            prob = interpolatedProbability(quad_token,token_len, vocab_dict, bi_dict, tri_dict, quad_dict,
                            l1 = 0.25, l2 = 0.25, l3 = 0.25 , l4 = 0.25)

        if tri_sen not in prob_dict:
            prob_dict[tri_sen] = []
            prob_dict[tri_sen].append([prob,quad_token[-1]])
        else:
            prob_dict[tri_sen].append([prob,quad_token[-1]])

    prob = None
    tri_count = None
    quad_token = None
    tri_sen = None

####################################################################################

#returns: void
#arg: dict
#for writing the probable word dict in text file
def writeProbWords(prob_dict):
    with open('probab_dict.txt','w') as file:
        for key in prob_dict:
            file.write(key+'  '+str(prob_dict[key])+'\n')

####################################################################################

#returns: void
#arg: dict
#for sorting the probable word acc. to their probabilities
def sortProbWordDict(prob_dict):
    for key in prob_dict:
        if len(prob_dict[key])>1:
            sorted(prob_dict[key],reverse = True)

####################################################################################

#returns: float
#arg: float,float,float,float,list,list,dict,dict,dict,dict
#for calculating the interpolated probablity
def interpolatedProbability(quad_token,token_len, vocab_dict, bi_dict, tri_dict, quad_dict,
                            l1 = 0.25, l2 = 0.25, l3 = 0.25 , l4 = 0.25):

    sen = ' '.join(quad_token)
    prob =(
              l1*(quad_dict[sen] / tri_dict[' '.join(quad_token[0:3])])
            + l2*(tri_dict[' '.join(quad_token[1:4])] / bi_dict[' '.join(quad_token[1:3])])
            + l3*(bi_dict[' '.join(quad_token[2:4])] / vocab_dict[quad_token[2]])
            + l4*(vocab_dict[quad_token[3]] / token_len)
          )
    return prob

####################################################################################

#returns: string
#arg: void
#for taking input from user
def takeInput():
    cond = False
    #take input
    while(cond == False):
        sen = input('Enter the string\n')
        sen = removePunctuations(sen)
        temp = sen.split()
        if len(temp) < 3:
            print("Please enter atleast 3 words !")
        else:
            cond = True
            temp = temp[-3:]
    sen = " ".join(temp)
    return sen
####################################################################################

def main():

  #variable declaration
  tri_dict = defaultdict(int)            #for keeping count of sentences of three words
  quad_dict = defaultdict(int)           #for keeping count of sentences of three words
  vocab_dict = defaultdict(int) #for storing the different words with their frequencies
  prob_dict = OrderedDict()   #for storing the probabilities of probable words for a sentence
  bi_dict = defaultdict(int)

  #load the corpus for the dataset
  token_len = loadCorpus('corpusfile.txt',tri_dict,quad_dict,vocab_dict,bi_dict)
  print("---Preprocessing Time for Corpus loading: %s seconds ---" % (time.time() - start_time))

  start_time1 = time.time()

  #creates a dictionary of probable words
  createProbableWordDict(bi_dict,tri_dict,quad_dict,prob_dict,vocab_dict,token_len)
  #sort the dictionary of probable words
  sortProbWordDict(prob_dict)
  # writeProbWords(prob_dict)
  gc.collect()
  print("---Preprocessing Time for Creating Probable Word Dict: %s seconds ---" % (time.time() - start_time1))

  sen = takeInput()

  start_time2 = time.time()
  prediction = doPrediction(sen,prob_dict)
  print("Word Prediction:",prediction)
  print("---Time for Prediction Operation: %s seconds ---" % (time.time() - start_time2))

if __name__ == '__main__':
  main()


text:
from p2ner.util.utilities import get_user_data_dir
from p2ner.abstract.interface import Interface
import os
from twisted.enterprise import adbapi
from twisted.internet import reactor
from collections import deque
import time

class DatabaseLog(Interface):
    def initInterface(self,server=False):
        self.que = deque()
        if server:
            self.defaultIp='server'
        else:
            self.defaultIp='peer'

        self.id=0
        self.lastId=0

        if server:
            self.start()
        else:
            self.getPort()

    def getPort(self):
        try:
            port=self.root.netChecker.controlPort
            self.start(port)
        except:
            reactor.callLater(1,self.getPort)

    def start(self,port='Server'):
        userdatadir = get_user_data_dir()
        if not os.path.isdir(userdatadir):
            os.mkdir(userdatadir)
        if not os.path.isdir(os.path.join(userdatadir, "log")):
            os.mkdir(os.path.join(userdatadir, "log"))
        n='p2ner'+str(port)+'.db'
        dbname= os.path.join(get_user_data_dir(), "log",n)
        print dbname

        self.dbpool=adbapi.ConnectionPool('sqlite3',dbname, check_same_thread=False)

        d=self.deleteDB()
        d.addCallback(self.createDB)
        d.addCallback(self.setReady)

    def deleteDB(self):
        return self.dbpool.runOperation('DROP TABLE IF EXISTS log')

    def createDB(self,d):
        return self.dbpool.runOperation('CREATE TABLE log(id INTEGER PRIMARY KEY AUTOINCREMENT, ip Text, port INTEGER, level TEXT, log TEXT, time TEXT, epoch REAL, msecs REAL,module TEXT, func TEXT, lineno INTEGER, msg TEXT) ')

    def setReady(self,d):
        reactor.callLater(1,self.commitRecords)

    def addRecord(self,record):
        self.lastId+=1
        try:
            ip=self.root.netChecker.externalIp
            port=self.root.netChecker.controlPort
        except:
            ip=self.defaultIp
            port=0
        args=(ip,port,record.levelname,record.name,time.time(),record.created,record.msecs,record.module,record.funcName,record.lineno,record.getMessage())
        self.que.append(args)

    def commitRecords(self):
        if len(self.que):
            args=[]
            while len(self.que):
                args.append(self.que.popleft())
            d=self.dbpool.runInteraction(self._commitRecord,args)
            d.addCallback(self.checkQue)
        else:
            reactor.callLater(1,self.commitRecords)

    def checkQue(self,d):
        reactor.callLater(1,self.commitRecords)

    def _commitRecord(self,txn,args):
        for arg in args:
            txn.execute('INSERT INTO log(ip,port,level,log,time,epoch,msecs,module,func,lineno,msg) VALUES(?,?,?,?,?,?,?,?,?,?,?)',arg)

    def getRecords(self):
        d=self._getRecords()
        d.addCallback(self.updateId)
        return d

    def _getRecords(self):
        return self.dbpool.runQuery(('SELECT * FROM log WHERE id BETWEEN %d AND %d'%(self.id,self.lastId)))

    def updateId(self,records):
        dictR=[]
        self.id +=(len(records)+0)
        for r in records:
            dr={}
            dr['ip']=r[1]
            dr['port']=r[2]
            dr['level']=r[3]
            dr['log']=r[4]
            dr['time']=r[5]
            dr['epoch']=r[6]
            dr['msecs']=r[7]
            dr['module']=r[8]
            dr['func']=r[9]
            dr['lineno']=r[10]
            dr['msg']=r[11]
            dictR.append(dr)
        return dictR

    def stop(self):
        print 'should stop logger'
        self.dbpool.disconnect()
        #self.dbpool.runInteraction(self._stop)

    def _stop(self,txn):
        txn.close()


text:
local CCSGameDataManager = class("CCSGameDataManager")

-- constructor method
function CCSGameDataManager:ctor()
	self.dataHash_ = {}
	self.objectMode_ = false
end

-- set object mode
function CCSGameDataManager:setObjectMode(objectMode)
	self.objectMode_ = objectMode or false
end

-- load data file from file path
function CCSGameDataManager:loadDataFile(filePath)
	local hashKey = self:_genHashKey(filePath)
	local fullPath = cc.FileUtils:getInstance():fullPathForFilename(filePath)

	if io.exists(fullPath) then
		if hashKey ~= nil then self.dataHash_[hashKey] = {} else return nil end
		local json = json.decode(io.readfile(fullPath))

		if self.objectMode_ then
			-- object mode
			local fieldNames = json[1]
			local length = #json

			for i = 2, length do
				local jsonData = json[i]
				local data = {}

				for j, v in ipairs(jsonData) do
					local fieldName = fieldNames[j]
					data[fieldName] = v
				end

				if data.id ~= nil then self.dataHash_[hashKey][data.id] = data end
			end
		else
			-- attribute mode
			for i, v in ipairs(json) do
				if v.id ~= nil then self.dataHash_[hashKey][v.id] = v end
			end
		end
	else
		printInfo("no game data file for path: %s", fullPath)
	end
end

--  load data fiels from file paths
function CCSGameDataManager:loadDataFiles(filePaths)
	for i, v in ipairs(filePaths) do
		self:loadDataFile(v)
	end
end

-- get game data list by hash key
function CCSGameDataManager:getGameDataList(hashKey)
	return self.dataHash_[hashKey]
end

-- get game data by hash key and id
function CCSGameDataManager:getGameDataById(hashKey, id)
	local dataList = self:getGameDataList(hashKey)
	if dataList ~= nil then return dataList[id] else return nil end
end

-- get game data by hash key, key and value
function CCSGameDataManager:getGameDataByKVP(hashKey, key, value)
	local dataList = self:getGameDataList(hashKey)

	if dataList ~= nil then
		for k, v in pairs(dataList) do
			if v[key] == value then return v end
		end
	end

	return nil
end

--  get game data by hash key and kvp pairs
function CCSGameDataManager:getGameDataByKVPs(hashKey, kvps)
	local dataList = self:getGameDataList(hashKey)
	local nums = table.nums(kvps)

	if dataList ~= nil then
		for k, v in pairs(dataList) do
			local count = 0

			for key, value in pairs(kvps) do
				if v[key] == value then count = count + 1 end
			end

			if count == nums then return v end
		end
	end

	return nil
end

-- generate key for data hash
function CCSGameDataManager:_genHashKey(filePath)
	local dir = string.split(filePath, "/")
	local filename = dir[#dir]
	local names = string.split(filename, ".")
	return names[1]
end

return CCSGameDataManager.new()


text:
using System;
using System.Diagnostics;

namespace EarTrumpet.Interop.Helpers
{
    class SettingsPageHelper
    {
        public static void Open(string page)
        {
            try
            {
                using (Process.Start(new ProcessStartInfo { UseShellExecute = true, FileName = $"ms-settings:{page}" }))
                { }
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"SettingsPageHelper Open Failed: {ex}");
            }
        }
    }
}


text:
'use strict'

var ImmutableModule = require('./immutable/module')

/* public functions */
module.exports = {
    after: after,
    afterDetach: afterDetach,
    before: before,
    beforeDetach: beforeDetach,
    controller: controller,
    extension: extension,
    getMethod: getMethod,
    model: model,
}

/* exported functions */

/**
 * @function after
 *
 * @oaram {string} targetFunctionSignature - moduleName.functionName to bind to
 * @param {function} functionObj - function to bind
 */
function after (targetFunctionSignature, functionObj) {
    return bind('after', targetFunctionSignature, functionObj)
}

/**
 * @function afterDetach
 *
 * @oaram {string} targetFunctionSignature - moduleName.functionName to bind to
 * @param {function} functionObj - function to bind
 */
function afterDetach (targetFunctionSignature, functionObj) {
    return bind('afterDetach', targetFunctionSignature, functionObj)
}

/**
 * @function before
 *
 * @oaram {string} targetFunctionSignature - moduleName.functionName to bind to
 * @param {function} functionObj - function to bind
 */
function before (targetFunctionSignature, functionObj) {
    return bind('before', targetFunctionSignature, functionObj)
}

/**
 * @function beforeDetach
 *
 * @oaram {string} targetFunctionSignature - moduleName.functionName to bind to
 * @param {function} functionObj - function to bind
 */
function beforeDetach (targetFunctionSignature, functionObj) {
    return bind('beforeDetach', targetFunctionSignature, functionObj)
}

/**
 * @function controller
 *
 * @param {string} name - name of controller
 * @param {object} spec - object containing controller functions
 *
 * @returns {object} - object containing wrapped controller functions
 */
function controller (name, spec) {
    // throw error on invlaid name
    requireValidName(name)
    // append Controller to name to get unique module name
    name = name + 'Controller'
    // return controller module
    return getModule(name, spec)
}

/**
 * @function extension
 *
 * @param {string} name - name of extension
 * @param {object} spec - object containing extension functions
 *
 * @returns {object} - object containing wrapped controller functions
 */
function extension (name, spec) {
    // throw error on invlaid name
    requireValidName(name)
    // append Controller to name to get unique module name
    name = name + 'Extension'
    // return controller module
    return getModule(name, spec)
}

/**
 * @function model
 *
 * @param {string} name - name of model
 * @param {object} spec - object containing model functions
 *
 * @returns {object} - object containing wrapped model functions
 */
function model (name, spec) {
    // throw error on invlaid name
    requireValidName(name)
    // append Model to name to get unique module name
    name = name + 'Model'
    // return model module
    return getModule(name, spec)
}

/**
 * @function getMethod
 *
 * @param {string} signature - ModuleName.FunctionName of method
 *
 * @returns {function} - method function
 */
function getMethod (signature) {
    // convert signature string to method and function name
    // throws error on invalid name
    signature = requireValidSignature(signature)
    // get module
    var module = ImmutableModule(signature.moduleName)
    // throw error if module not defined
    if (!module) {
        throw new Error('module not found '+signature.moduleName)
    }
    // get function
    var method = module[signature.functionName]
    // throw error if function not defined
    if (!method) {
        throw new Error('method not found '+signature.full)
    }
    // return wrapper function that can be used to invoke method
    return method
}

/**
 * @function getModule
 *
 * @param {string} name - name of module
 * @param {object} spec - object containing module functions
 *
 * @returns {object} - object containing wrapped module functions
 */
function getModule (name, spec) {
    // throw error on invalid name
    requireValidName(name)
    // create module
    var module = ImmutableModule(name, spec)
    // bind any deferred binds
    bindDeferred(name, module)
    // return module
    return module
}

/* private functions */

// store of functions to be bound to modules if/when they are created
var deferredBind = {}

/**
 * @function bind
 *
 * @param {string} method - when and how to bind
 * @param {string} targetFunctionSignature - moduleName.functionName to bind to
 * @param {function} functionObj - function to bind
 */
function bind (method, targetFunctionSignature, functionObj) {
    // validate signature
    var signature = requireValidSignature(targetFunctionSignature)
    // try to get module
    var module = ImmutableModule(signature.moduleName)
    // if module already exists then bind function
    if (module) {
        module.bind(method, signature.moduleName, signature.functionName, functionObj)
    }
    // if module does not exist yet it still may be created later so
    // add function to list to be bound if/when module is created
    else {
        // create deferred bind entry for mdoule
        if (!deferredBind[signature.moduleName]) {
            deferredBind[signature.moduleName] = {}
        }
        // create deferred bind entry for function
        if (!deferredBind[signature.moduleName][signature.functionName]) {
            deferredBind[signature.moduleName][signature.functionName] = {}
        }
        // create deferred bind entry for method type
        if (!deferredBind[signature.moduleName][signature.functionName][method]) {
            deferredBind[signature.moduleName][signature.functionName][method] = []
        }
        // add function to list of deferred binds
        deferredBind[signature.moduleName][signature.functionName][method].push(functionObj)
    }
}

/**
 * @function bindDeferred
 *
 * @param {string} moduleName - name of module
 * @param {object} module - module
 */
function bindDeferred (moduleName, module) {
    // return unless there are deferred binds to process
    if (!deferredBind[moduleName]) {
        return
    }
    // get all function names for deferred binds
    var functionNames = Object.keys(deferredBind[moduleName])
    // bind methods for each module function
    for (var i=0; i < functionNames.length; i++) {
        var functionName = functionNames[i]
        // get all methods for module function
        var methods = Object.keys(deferredBind[moduleName][functionName])
        // bind functions for all methods
        for (var j=0; j < methods.length; j++) {
            var method = methods[j]
            // get list of functions to bind
            var functionObjs = deferredBind[moduleName][functionName][method]
            // bind all functions
            for (var k=0; k < functionObjs.length; k++) {
                var functionObj = functionObjs[k]
                // bind function
                module.bind(method, moduleName, functionName, functionObj)
            }
        }
    }
}

/**
 * @function requireValidName
 *
 * @param {string} name - name to be evaluated for validity
 *
 * @returns {true} - on valid name
 * @throws on invalid name
 */
function requireValidName (name) {
    // require valid name
    if (name && typeof name === 'string' && name.length > 0) {
        return true
    }
    else {
        throw new Error('valid name required')
    }
}

/**
 * @function requireValidSignature
 *
 * @param {string} signature - function signature to be evaluated
 *
 * @returns {object} - moduleName, functionName
 * @throws on invalid signature
 */
 function requireValidSignature (signature) {
    // require string
    if (typeof signature !== 'string') {
        throw new Error('signature must be string')
    }
    // split function signature into moduleName and functionName
    var parts = signature.split('.')
    // require two parts
    if (parts.length !== 2) {
        throw new Error('invalid signature '+signature)
    }
    // module name is first part
    var moduleName = parts[0]
    // function name is second part
    var functionName = parts[1]
    // require names to be valid
    try {
        requireValidName(moduleName)
        requireValidName(functionName)
    }
    catch (ex) {
        throw new Error('invalid signature '+signature)
    }
    // return module and function name
    return {
        full: signature,
        functionName: functionName,
        moduleName: moduleName,
    }
 }


text:
'use strict';

angular.module('DailyFinanceApp')
  .controller('MessageBoxCtrl', function ($scope, $modalInstance, model) {
    $scope.title = model.title;
    $scope.message = model.message;
    $scope.buttons = model.buttons;
    $scope.close = function (res) {
      $modalInstance.close(res);
    };
  })
  .controller('retrievePasswordBoxCtrl', function ($scope, $modalInstance, model) {
    $scope.title = model.title;
    $scope.message = model.message;
    $scope.placeholder = model.placeholder;
    $scope.error = '';
    $scope.close = function (res) {
      if (res === 'ok') {
        $modalInstance.close(res);
      } else {
        var email = $scope.$$childTail.email;
        var result = {};
        if (email) {
          result.type = res;
          result.email = email;
          $modalInstance.close(result);
        } else {
          $scope.error = model.error;
        }
      }
    };
  });


text:
    <meta charset="utf-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="cache-control" content="no-cache">

    <link type="text/css" rel="stylesheet" href="css/index.css"/>
    <title>公告</title>