%PDF- %PDF-
Direktori : /home/waritko/db_backups/databaze/waritko_antrix2/ |
Current File : //home/waritko/db_backups/databaze/waritko_antrix2/pastebin.sql |
-- MySQL dump 10.14 Distrib 5.5.60-MariaDB, for Linux (x86_64) -- -- Host: localhost Database: waritko_antrix2 -- ------------------------------------------------------ -- Server version 5.5.60-MariaDB /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `pastebin` -- DROP TABLE IF EXISTS `pastebin`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `pastebin` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `datum` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `ip` varchar(60) NOT NULL, `obsah` longblob NOT NULL, `jazyk` varchar(20) NOT NULL, `private` tinyint(1) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=75 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `pastebin` -- LOCK TABLES `pastebin` WRITE; /*!40000 ALTER TABLE `pastebin` DISABLE KEYS */; INSERT INTO `pastebin` VALUES (1,'2012-02-25 18:41:36','46.13.67.223','#include <stdio.h>\r\n\r\nmain()\r\n{\r\n FILE *f; // promenna pro otevreni souboru\r\n // Promenne ktere budu zapisovat\r\n int i = 22;\r\n double d = 34.3335;\r\n char *retezec = \"Nejaky vesely text\";\r\n \r\n // Otevreni a kontrola\r\n f = fopen(\"soubor.txt\", \"w\"); // otevru soubor\r\n if(!f)\r\n {\r\n // Otevreni pro zapis se nepovedlo, vypis chybu\r\n puts(\"Soubor nelze vytvorit\");\r\n return;\r\n }\r\n \r\n // A ted samotny zapis\r\n fprintf(f, \"%d;%g;%s\\r\\n\", i, d, retezec);\r\n \r\n // Uzavreni souboru\r\n fclose(f);\r\n}','cpp',0),(2,'2012-02-25 18:57:51','46.13.67.223','<?php\r\n if(!isset($_GET[\'id\']))\r\n {\r\n echo \"Pastebin ID not set\";\r\n die;\r\n }\r\n include_once \'geshi.php\';\r\n include \"config.php\";\r\n $spojeni = mysql_connect($sql, $usr, $pwd);\r\n if (!$spojeni)\r\n die(\'SpojenĂ s MySQL databázĂ se nezdaĹ™ilo.\');\r\n $vysledek_zvoleni_db = mysql_select_db($db, $spojeni);\r\n if (!$vysledek_zvoleni_db)\r\n {\r\n echo mysql_errno($id_spojeni).\': \',mysql_error($id_spojeni).\'<br>\';\r\n die(\"NepodaĹ™ilo se vybrat databázi $db.\");\r\n }\r\n $id = $_GET[\'id\'];\r\n $result = mysql_query(\"select obsah, jazyk from pastebin where id=$id\", $spojeni);\r\n if($r = mysql_fetch_row($result))\r\n {\r\n $language = $r[1];\r\n $source = $r[0];\r\n $geshi = new GeSHi($source, $language);\r\n $geshi->set_header_type(GESHI_HEADER_DIV);\r\n $geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);\r\n }\r\n else\r\n {\r\n echo \"Zaznam s ID #$id neexistuje\";\r\n die;\r\n }\r\n\r\n?>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\"> \r\n <head> \r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /> \r\n <title>Waritko\'s paste</title> \r\n </head> \r\n <body>\r\n <h1>Pasted text</h1>\r\n <?php\r\n echo $geshi->parse_code(); \r\n ?>\r\n </body>\r\n</html>\r\n\r\n','php',0),(3,'2012-02-25 22:20:00','147.229.220.249','function db_list($db_rs, $paging = NULL, $joinfield = false){\r\n $bquery = db_list_query($db_rs, $joinfield);\r\n\r\n if ($paging){\r\n list($rpp, $pge) = is_array($paging) ? $paging : array($paging, 0);\r\n $offset = $rpp * $pge;\r\n $bquery .= \" LIMIT $offset, $rpp\";\r\n }\r\n\r\n $res = db_query($db_rs[DB_LINK], $bquery);\r\n if (!$res)\r\n return db_err(_(\'e-db-invalid_query\'), $bquery);\r\n else\r\n db_report($bquery);\r\n\r\n $ret = array();\r\n if (is_array($db_rs[DB_FIELDS]))\r\n while ($row = db_fetch_row($res))\r\n $ret[array_pop($row)] = $row;\r\n else\r\n while ($row = db_fetch_row($res))\r\n $ret[array_pop($row)] = array_pop($row);\r\n mysql_free_result($res);\r\n return $ret;\r\n}','php',0),(4,'2012-02-26 18:08:01','147.229.220.81','<div id=\"middle\"><H1>Miler, ZdenÄ›k</H1><div class=\"article\"><br><a href=\"javascript:ukaz_knizku(0)\"><div class=\"index\">Krtek a Vánoce</a></div><div class=\"hidden\" id=\"detail_0\"><p><b>ISBN:</b> 978-80-00-02472-1<br><b>Popis:</b> KrteÄŤek s myškou slavĂ Vánoce<br><b>AutoĹ™i:</b><br>DoskoÄŤilová, Hana<br>Miler, ZdenÄ›k<br></div></div><div class=\"article\"><br><a href=\"javascript:ukaz_knizku(1)\"><div class=\"index\">O zvÄ›davĂ©m štÄ›Ĺátku</a></div><div class=\"hidden\" id=\"detail_1\"><p><b>ISBN:</b> 80-85523-03-5<br><b>Popis:</b> Jak pejskovi slunĂÄŤko vypilo vodu.<br><b>AutoĹ™i:</b><br>HercĂková, Iva<br>Miler, ZdenÄ›k<br></div></div></div>\r\n','html4strict',0),(5,'2012-02-27 20:07:06','46.13.67.223','#include <windows.h>\r\n#include <stdio.h>\r\n#include <conio.h>\r\n#include <time.h>\r\n#include \"tty.h\"\r\n\r\nvoid PortWriteCmd(const char *str)\r\n{\r\n int i;\r\n for(i = 0; str[i] != 0; i++)\r\n {\r\n PortWrite(str[i]);\r\n }\r\n PortWrite(\'\\r\');\r\n PortWrite(\'\\n\');\r\n}\r\n\r\nint main()\r\n{\r\n int i;\r\n short cByteRead;\r\n char buffer[255];\r\n FILE *f;\r\n time_t tzac = 0;\r\n time_t tcurr = 0;\r\n int cas = 0;\r\n double hodnota = 0;\r\n\r\n\r\n // Otevru port\r\n if(PortInitialize(\"COM4\", 9600, NOPARITY, ONESTOPBIT) == FALSE)\r\n return 1;\r\n // Inicializace souboru\r\n if(!(f = fopen(\"vystup.txt\", \"w\")))\r\n {\r\n fputs(\"Nelze otevrit soubor pro vystup\", stderr);\r\n return 1;\r\n }\r\n\r\n tzac = time(NULL); // inicializace zacatku casu\r\n PortWriteCmd(\"S101\"); // Nastaveni rozsahu na milivolty\r\n Sleep(5 * 1000); // Po inicializaci cekam 5s na merak\r\n for(i = 0; i < 10; i++) // 10x provedu mereni\r\n {\r\n tcurr = time(NULL); // zjisteni casoveho razitka\r\n cas = tcurr - tzac; // vypocet casu od spusteni programu\r\n PortWriteCmd(\"R1\"); // Pozadam o data\r\n cByteRead = PortRead(buffer); // prectu data z portu\r\n buffer[cByteRead] = 0; // korektne ukoncim retezec\r\n hodnota = atof(buffer); // prevedu string na double\r\n fprintf(f, \"%d;%g\\r\\n\", cas, hodnota); // tohle jde do souboru\r\n printf(\"Hodnota v case %d: %g\\r\\n\", cas, hodnota); // a neco malo uzivateli na obrazovku\r\n Sleep(5 * 1000); // schrupnu si na 5s\r\n }\r\n\r\n\r\n\r\n fclose(f); // uzavreni souboru\r\n\r\n PortClose(hPort); // Uzavrenim koncim.\r\n return 0;\r\n}\r\n// Dalsi zajimave funkce\r\n// Zjisteni stavu portu:\r\n// ClearCommError(hPort, &dwErr, &stat);\r\n','cpp',0),(6,'2012-02-29 10:35:54','86.49.91.18','using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing Waritko;\r\nusing cestakyData;\r\n\r\nnamespace cestakyLib\r\n{\r\n /// <summary>\r\n /// Trida reprezentujici jednu cast trasy v cestovnim prikaze\r\n /// </summary>\r\n public class TrasaCast\r\n {\r\n /// <summary>\r\n /// Pocatecni misto casti trasy\r\n /// </summary>\r\n public string PocatekMisto { get; set; }\r\n\r\n /// <summary>\r\n /// Datum zacatku useku trasy\r\n /// </summary>\r\n public DateTime PocatekCas { get; set; }\r\n\r\n /// <summary>\r\n /// Konecne misto useku trasy\r\n /// </summary>\r\n public string KonecMisto { get; set; }\r\n\r\n /// <summary>\r\n /// Datum a cas konce useku trasy\r\n /// </summary>\r\n public DateTime KonecCas { get; set; }\r\n\r\n /// <summary>\r\n /// Stat, na jehoz uzemi probihala sluzebni cesta\r\n /// </summary>\r\n public string Stat { get; set; }\r\n\r\n /// <summary>\r\n /// Defaultni konstruktor inicializuje promenne na zakladni hodnotu\r\n /// </summary>\r\n public TrasaCast()\r\n {\r\n this.PocatekCas = DateTime.Now;\r\n this.KonecCas = DateTime.Now;\r\n this.PocatekMisto = \"\";\r\n this.KonecMisto = \"\";\r\n this.Stat = \"cz\";\r\n }\r\n\r\n /// <summary>\r\n /// Metoda pro vypocet nahrady za usek trasy\r\n /// </summary>\r\n /// <returns>CCastku nahrady stravneho za dany usek</returns>\r\n public decimal VypoctiNahradu()\r\n {\r\n if (this.Stat.ToLower() == \"cz\")\r\n {\r\n return this.VypoctiDomaciNahradu();\r\n }\r\n else\r\n {\r\n return this.VypoctiZahranicniNahradu();\r\n }\r\n }\r\n\r\n private decimal VypoctiZahranicniNahradu()\r\n {\r\n decimal ret = 0;\r\n DateTime tzac = this.PocatekCas;\r\n DateTime ttemp;\r\n bool cont = true;\r\n int diff;\r\n NahradyZahranici nahrady = new NahradyZahranici(this.Stat, this.PocatekCas);\r\n\r\n while (cont)\r\n {\r\n if (tzac.Date == this.KonecCas.Date)\r\n {\r\n diff = util.toTime(this.KonecCas) - util.toTime(tzac);\r\n cont = false;\r\n }\r\n else\r\n {\r\n ttemp = tzac;\r\n ttemp = ttemp.Date.AddDays(1);\r\n diff = util.toTime(ttemp) - util.toTime(tzac);\r\n tzac = ttemp;\r\n }\r\n // A ted samotne pocitani nahrad :D\r\n if (diff < 3600 - 60)\r\n {\r\n // Na ceste nebyla stravena ani hodina\r\n continue;\r\n }\r\n if (diff < 6 * 3600 - 60)\r\n {\r\n ret += nahrady.Nahrada() * 0.25m;\r\n continue;\r\n }\r\n if (diff < 12 * 3600 - 60)\r\n {\r\n ret += nahrady.Nahrada() * 0.5m;\r\n continue;\r\n }\r\n if (diff >= 12 * 3600)\r\n {\r\n ret += nahrady.Nahrada();\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n\r\n private decimal VypoctiDomaciNahradu()\r\n {\r\n decimal ret = 0;\r\n DateTime tzac = this.PocatekCas;\r\n DateTime ttemp;\r\n bool cont = true;\r\n int diff;\r\n NahradyCr nahrady = new NahradyCr(this.PocatekCas.Year);\r\n\r\n while (cont)\r\n {\r\n if (tzac.Date == this.KonecCas.Date)\r\n {\r\n diff = util.toTime(this.KonecCas) - util.toTime(tzac);\r\n cont = false;\r\n }\r\n else\r\n {\r\n ttemp = tzac;\r\n ttemp = ttemp.Date.AddDays(1);\r\n diff = util.toTime(ttemp) - util.toTime(tzac);\r\n tzac = ttemp;\r\n }\r\n\r\n if (diff > 18 * 3600 - 60)\r\n {\r\n ret += nahrady.Nahrada18();\r\n }\r\n else\r\n {\r\n if (diff > 12 * 3600 - 60)\r\n {\r\n ret += nahrady.Nahrada12();\r\n }\r\n else\r\n {\r\n if (diff >= 5 * 3600 - 60)\r\n {\r\n ret += nahrady.Nahrada5();\r\n }\r\n }\r\n }\r\n }\r\n\r\n return ret;\r\n }\r\n }\r\n}\r\n','csharp',0),(7,'2012-02-29 10:42:08','86.49.91.18','using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.IO;\r\nusing System.Net;\r\nusing System.Text.RegularExpressions;\r\nusing System.ComponentModel;\r\n\r\nnamespace hotfile\r\n{\r\n class hotfileDownloader\r\n {\r\n private const int threads = 6;\r\n private int id;\r\n private string user;\r\n private string pass;\r\n CookieCollection cookies = new CookieCollection();\r\n Queue<string> queue = new Queue<string>();\r\n System.ComponentModel.BackgroundWorker[] bw = new System.ComponentModel.BackgroundWorker[threads];\r\n\r\n public hotfileDownloader(int id, string user, string pass)\r\n {\r\n this.id = id;\r\n this.user = user;\r\n this.pass = pass;\r\n }\r\n\r\n public void addUrl(string addr)\r\n {\r\n this.queue.Enqueue(addr);\r\n }\r\n\r\n public void doDownloads()\r\n {\r\n for (int i = 0; i < threads; i++)\r\n {\r\n this.bw[i] = new BackgroundWorker();\r\n this.bw[i].DoWork += new DoWorkEventHandler(this.bw_DoWork);\r\n this.bw[i].RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);\r\n this.bw[i].WorkerReportsProgress = false;\r\n this.bw[i].WorkerSupportsCancellation = false;\r\n }\r\n this.assignJobs();\r\n while (this.queue.Count != 0)\r\n {\r\n System.Threading.Thread.Sleep(3 * 1000);\r\n }\r\n for (int i = 0; i < threads; i++)\r\n {\r\n if (this.bw[i].IsBusy)\r\n {\r\n i--;\r\n System.Threading.Thread.Sleep(5 * 1000);\r\n }\r\n }\r\n }\r\n\r\n private void bw_DoWork(object sender, DoWorkEventArgs e)\r\n {\r\n if (this.queue.Count > 0)\r\n {\r\n string addr = this.queue.Dequeue();\r\n this.download(addr);\r\n }\r\n }\r\n\r\n private void assignJobs()\r\n {\r\n for (int i = 0; i < threads; i++)\r\n {\r\n if (!this.bw[i].IsBusy)\r\n {\r\n this.bw[i].RunWorkerAsync();\r\n }\r\n }\r\n }\r\n\r\n private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)\r\n {\r\n if (this.queue.Count == 0)\r\n {\r\n return;\r\n }\r\n this.assignJobs();\r\n }\r\n\r\n public void login()\r\n {\r\n CookieContainer cc = new CookieContainer();\r\n System.Net.ServicePointManager.Expect100Continue = false;\r\n byte[] buff = System.Text.ASCIIEncoding.ASCII.GetBytes(String.Format(\"user={0}&pass={1}&Login\", this.user, this.pass));\r\n HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(\"http://hotfile.com/login.php\");\r\n req.CookieContainer = cc;\r\n req.Method = \"POST\";\r\n req.KeepAlive = false;\r\n req.UserAgent = \"curl/7.18.2(x86_64-pc-linux-gnu)libcurl/7.18.2OpenSSL/0.9.8gzlib/1.2.3.3libidn/1.8libssh2/0.18\";\r\n req.ContentLength = buff.Length;\r\n req.ContentType = \"application/x-www-form-urlencoded\";\r\n req.Referer = \"http://hotfile.com\";\r\n req.GetRequestStream().Write(buff, 0, buff.Length);\r\n req.AllowAutoRedirect = false;\r\n HttpWebResponse res = (HttpWebResponse)req.GetResponse();\r\n if (res.Cookies.Count > 0)\r\n {\r\n this.cookies = res.Cookies;\r\n }\r\n }\r\n\r\n private void download(string addr)\r\n {\r\n HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(addr);\r\n req.KeepAlive = false;\r\n req.Headers.Add(HttpRequestHeader.Cookie, this.cookies[0].ToString());\r\n req.UserAgent = req.UserAgent = \"curl/7.18.2(x86_64-pc-linux-gnu)libcurl/7.18.2OpenSSL/0.9.8gzlib/1.2.3.3libidn/1.8libssh2/0.18\";\r\n bool isDone = false;\r\n HttpWebResponse res = null;\r\n while (!isDone)\r\n {\r\n try\r\n {\r\n res = (HttpWebResponse)req.GetResponse();\r\n isDone = true;\r\n }\r\n catch\r\n {\r\n Console.WriteLine(\"[{0}] Error getting address {1}, waiting 120 seconds\", DateTime.Now.ToLongTimeString(), addr);\r\n System.Threading.Thread.Sleep(120 * 1000);\r\n }\r\n }\r\n StreamReader sr = new StreamReader(res.GetResponseStream());\r\n string txt = sr.ReadToEnd();\r\n sr.Close();\r\n Regex reg = new System.Text.RegularExpressions.Regex(\"http://hotfile.com/get/[0-9]+/[0-9a-f]+/[0-9a-f]+/([0-9a-z\\\\.\\\\-_]+)\", System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.Compiled);\r\n Match m = reg.Match(txt);\r\n res.Close();\r\n Console.WriteLine(\"[{1}] Starting download of {0} ...\", m.Groups[1].ToString(), DateTime.Now.ToLongTimeString());\r\n // Get the file\r\n req = (HttpWebRequest)HttpWebRequest.Create(m.ToString());\r\n req.KeepAlive = false;\r\n req.Headers.Add(HttpRequestHeader.Cookie, this.cookies[0].ToString());\r\n req.UserAgent = req.UserAgent = \"curl/7.18.2(x86_64-pc-linux-gnu)libcurl/7.18.2OpenSSL/0.9.8gzlib/1.2.3.3libidn/1.8libssh2/0.18\";\r\n req.Referer = addr;\r\n res = (HttpWebResponse)req.GetResponse();\r\n this.ReadFully(res.GetResponseStream(), m.Groups[1].ToString());\r\n Console.WriteLine(\"[{1}] Download of {0} completed\", m.Groups[1].ToString(), DateTime.Now.ToLongTimeString());\r\n }\r\n\r\n private void ReadFully(Stream stream, string outfile)\r\n {\r\n int initialLength = 0;\r\n int num = 1;\r\n // If we\'ve been passed an unhelpful initial length, just\r\n // use 64K.\r\n if (initialLength < 1)\r\n {\r\n initialLength = 512*1024;\r\n }\r\n\r\n // File init\r\n if (File.Exists(outfile))\r\n {\r\n while (File.Exists(String.Format(\"{0}.{1}\", num))) num++;\r\n outfile = String.Format(\"{0}.{1}\", num);\r\n }\r\n FileStream os = File.OpenWrite(outfile);\r\n\r\n byte[] buffer = new byte[initialLength];\r\n int read = 0;\r\n\r\n try\r\n {\r\n\r\n int chunk;\r\n while ((chunk = stream.Read(buffer, read, buffer.Length - read)) > 0)\r\n {\r\n read += chunk;\r\n\r\n // If we\'ve reached the end of our buffer, check to see if there\'s\r\n // any more information\r\n if (read == buffer.Length)\r\n {\r\n int nextByte = stream.ReadByte();\r\n\r\n // End of stream? If so, we\'re done\r\n if (nextByte == -1)\r\n {\r\n // Write data to outfile\r\n os.Write(buffer, 0, read);\r\n os.Close();\r\n return;\r\n }\r\n\r\n // Nope. Write read data to output\r\n os.Write(buffer, 0, read);\r\n os.WriteByte((byte)nextByte);\r\n read = 0;\r\n }\r\n }\r\n }\r\n catch\r\n {\r\n Console.Error.WriteLine(\"Error reading from the socket\");\r\n }\r\n os.Write(buffer, 0, read);\r\n os.Close();\r\n }\r\n }\r\n}\r\n','csharp',0),(9,'2012-03-13 20:44:45','88.101.131.29','foreach ($offerList[0] as $url => $oData)\r\n $html .= sprintf(\'<div class=\"place\" onmouseover=\"mapHighlight(%d, true)\" onmouseout=\"mapHighlight(%d, false)\">\r\n <img class=\"photo\" src=\"%s\" alt=\"%s\"/>\r\n <div class=\"location\">\r\n <span class=\"city\">%s</span>\r\n <span class=\"street\">%s</span>\r\n <a href=\"%s/%s/%s\" class=\"b-map\" onclick=\"return showFacilityDetail(this, 1, %s)\">%s</a></div>\r\n <div class=\"pinfo\">\r\n <span class=\"type\">%s</span>\r\n <span class=\"name\">%s</span>\r\n <span class=\"spec\">%s</span></div>\r\n <div class=\"pfoot\">\r\n <span class=\"params\">%s</span>\r\n <a href=\"%s/%s\" class=\"b-detail\" onclick=\"return showFacilityDetail(this, 0, 0)\">%s</a>\r\n </div>\r\n </div>\r\n \',\r\n $c, $c++,\r\n ROOT.DIR_FACILITY_PHOTO.$oData[8], _a(\'l-place-photo\'),\r\n $oData[1], $oData[2], // city and street\r\n ROOT_L._(\'u-detail\'), $url, _a(\'u-fa-map\'), $this->mapParams($oData), _(\'c-map\'), // URL to map, coords, button text\r\n $oData[4], $oData[0], \'params\', // type, name, parameters\r\n \'#PARAMS#\', ROOT_L._(\'u-detail\'), $url, _(\'c-detail\') // additional info, URL to detail, button text\r\n );','html4strict',0),(10,'2012-03-19 21:24:10','66.249.72.83','','',0),(11,'2012-03-31 23:27:05','88.101.131.29','$db_rs = $this->getPlaceDBRS($condition);\r\n\r\n $ordCols = array(\r\n 0 => db_cc(TABLE_APP_PLACES, STD_COL_NAME));\r\n if ($this->cLoc){\r\n $utm = GEO::GPS2UTM($this->cLoc->lat, $this->cLoc->lng);\r\n $ordCols[1] = sprintf(\'DISTANCE(utm, POINT(%F, %F))\', $utm[0], $utm[1]);}\r\n $db_rs[DB_ORDER] = isset($ordCols[$srOrd])\r\n ? $ordCols[$srOrd]\r\n : reset($ordCols);\r\n if ($srDir)\r\n $db_rs[DB_DESC] = true;\r\n $offset = 5*$page;\r\n $placeList = db_list($db_rs, array(5, $page));\r\n unset($db_rs[DB_ORDER]);\r\n $db_rs[DB_FIELDS] = \'COUNT(*)\';\r\n $this->resCount = array_shift(db_list($db_rs));\r\n $this->resRange = array(\r\n min($offset+1, $this->resCount),\r\n min($offset+5, $this->resCount));\r\n }','php',0),(12,'2012-04-01 08:53:40','80.243.181.34','','',0),(13,'2012-04-01 08:53:41','80.243.181.34','3CiDd2 <a href=\"http://yehhckaeqvsb.com/\">yehhckaeqvsb</a>, [url=http://kffajeadwnrn.com/]kffajeadwnrn[/url], [link=http://yuvzsqruxwie.com/]yuvzsqruxwie[/link], http://mpoofwjsermw.com/','csharp',0),(14,'2012-04-03 20:59:57','147.229.220.249','[\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Gambardella, Matthew\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'XML Developer\'s Guide\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Computer\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'44.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-10-01\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'An in-depth look at creating applications \r\n with XML.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk101\'\r\n },\r\n \'type\' => \'e\'\r\n }\r\n ],\r\n \'name\' => \'room\',\r\n \'attrib\' => {\r\n \'id\' => \'1\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Ralls, Kim\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Midnight Rain\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Fantasy\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'5.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-12-16\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'A former architect battles corporate zombies, \r\n an evil sorceress, and her own childhood to become queen \r\n of the world.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk102\'\r\n },\r\n \'type\' => \'e\'\r\n }\r\n ],\r\n \'name\' => \'room\',\r\n \'attrib\' => {\r\n \'id\' => \'2\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'library\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Corets, Eva\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Maeve Ascendant\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Fantasy\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'5.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-11-17\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'After the collapse of a nanotechnology \r\n society in England, the young survivors lay the \r\n foundation for a new society.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk103\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Corets, Eva\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Oberon\'s Legacy\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Fantasy\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'5.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2001-03-10\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'In post-apocalypse England, the mysterious \r\n agent known only as Oberon helps to create a new life \r\n for the inhabitants of London. Sequel to Maeve \r\n Ascendant.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk104\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Corets, Eva\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'The Sundered Grail\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Fantasy\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'5.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2001-09-10\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'The two daughters of Maeve, half-sisters, \r\n battle one another for control of England. Sequel to \r\n Oberon\'s Legacy.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk105\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Randall, Cynthia\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Lover Birds\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Romance\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'4.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-09-02\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'When Carla meets Paul at an ornithology \r\n conference, tempers fly as feathers get ruffled.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk106\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Thurman, Paula\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Splish Splash\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Romance\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'4.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-11-02\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'A deep sea diver finds true love twenty \r\n thousand leagues beneath the sea.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk107\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Knorr, Stefan\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Creepy Crawlies\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Horror\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'4.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-12-06\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'An anthology of horror stories about roaches,\r\n centipedes, scorpions and other insects.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk108\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Kress, Peter\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Paradox Lost\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Science Fiction\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'6.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-11-02\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'After an inadvertant trip through a Heisenberg\r\n Uncertainty Device, James Salway discovers the problems \r\n of being quantum.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk109\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'O\'Brien, Tim\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Microsoft .NET: The Programming Bible\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Computer\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'36.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-12-09\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Microsoft\'s .NET initiative is explored in \r\n detail in this deep programmer\'s reference.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk110\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'O\'Brien, Tim\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'MSXML3: A Comprehensive Guide\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Computer\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'36.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2000-12-01\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'The Microsoft MSXML3 parser is covered in \r\n detail, with attention to XML DOM interfaces, XSLT processing, \r\n SAX and more.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk111\'\r\n },\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Galos, Mike\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'author\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Visual Studio 7: A Comprehensive Guide\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'title\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Computer\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'genre\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'49.95\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'price\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'2001-04-16\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'publish_date\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n },\r\n {\r\n \'content\' => [\r\n {\r\n \'content\' => \'Microsoft Visual Studio 7 is explored in depth,\r\n looking at how Visual Basic, Visual C++, C#, and ASP+ are \r\n integrated into a comprehensive development \r\n environment.\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'description\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n \',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'book\',\r\n \'attrib\' => {\r\n \'id\' => \'bk112\'\r\n },\r\n \'type\' => \'e\'\r\n }\r\n ],\r\n \'name\' => \'library\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n },\r\n {\r\n \'content\' => \'\r\n\',\r\n \'type\' => \'t\'\r\n }\r\n ],\r\n \'name\' => \'catalog\',\r\n \'attrib\' => {},\r\n \'type\' => \'e\'\r\n }\r\n ];\r\n','xml',0),(15,'2012-04-03 21:06:30','147.229.220.249','<?xml version=\"1.0\"?>\r\n<catalog>\r\n <library><room id=\"1\">\r\n <book id=\"bk101\">\r\n <author>Gambardella, Matthew</author>\r\n <title>XML Developer\'s Guide</title>\r\n <genre>Computer</genre>\r\n <price>44.95</price>\r\n <publish_date>2000-10-01</publish_date>\r\n <description>An in-depth look at creating applications \r\n with XML.</description>\r\n </book></room>\r\n <room id=\"2\">\r\n <book id=\"bk102\">\r\n <author>Ralls, Kim</author>\r\n <title>Midnight Rain</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2000-12-16</publish_date>\r\n <description>A former architect battles corporate zombies, \r\n an evil sorceress, and her own childhood to become queen \r\n of the world.</description>\r\n </book></room>\r\n </library>\r\n <library>\r\n <book id=\"bk103\">\r\n <author>Corets, Eva</author>\r\n <title>Maeve Ascendant</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2000-11-17</publish_date>\r\n <description>After the collapse of a nanotechnology \r\n society in England, the young survivors lay the \r\n foundation for a new society.</description>\r\n </book>\r\n <book id=\"bk104\">\r\n <author>Corets, Eva</author>\r\n <title>Oberon\'s Legacy</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2001-03-10</publish_date>\r\n <description>In post-apocalypse England, the mysterious \r\n agent known only as Oberon helps to create a new life \r\n for the inhabitants of London. Sequel to Maeve \r\n Ascendant.</description>\r\n </book>\r\n <book id=\"bk105\">\r\n <author>Corets, Eva</author>\r\n <title>The Sundered Grail</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2001-09-10</publish_date>\r\n <description>The two daughters of Maeve, half-sisters, \r\n battle one another for control of England. Sequel to \r\n Oberon\'s Legacy.</description>\r\n </book>\r\n <book id=\"bk106\">\r\n <author>Randall, Cynthia</author>\r\n <title>Lover Birds</title>\r\n <genre>Romance</genre>\r\n <price>4.95</price>\r\n <publish_date>2000-09-02</publish_date>\r\n <description>When Carla meets Paul at an ornithology \r\n conference, tempers fly as feathers get ruffled.</description>\r\n </book>\r\n <book id=\"bk107\">\r\n <author>Thurman, Paula</author>\r\n <title>Splish Splash</title>\r\n <genre>Romance</genre>\r\n <price>4.95</price>\r\n <publish_date>2000-11-02</publish_date>\r\n <description>A deep sea diver finds true love twenty \r\n thousand leagues beneath the sea.</description>\r\n </book>\r\n <book id=\"bk108\">\r\n <author>Knorr, Stefan</author>\r\n <title>Creepy Crawlies</title>\r\n <genre>Horror</genre>\r\n <price>4.95</price>\r\n <publish_date>2000-12-06</publish_date>\r\n <description>An anthology of horror stories about roaches,\r\n centipedes, scorpions and other insects.</description>\r\n </book>\r\n <book id=\"bk109\">\r\n <author>Kress, Peter</author>\r\n <title>Paradox Lost</title>\r\n <genre>Science Fiction</genre>\r\n <price>6.95</price>\r\n <publish_date>2000-11-02</publish_date>\r\n <description>After an inadvertant trip through a Heisenberg\r\n Uncertainty Device, James Salway discovers the problems \r\n of being quantum.</description>\r\n </book>\r\n <book id=\"bk110\">\r\n <author>O\'Brien, Tim</author>\r\n <title>Microsoft .NET: The Programming Bible</title>\r\n <genre>Computer</genre>\r\n <price>36.95</price>\r\n <publish_date>2000-12-09</publish_date>\r\n <description>Microsoft\'s .NET initiative is explored in \r\n detail in this deep programmer\'s reference.</description>\r\n </book>\r\n <book id=\"bk111\">\r\n <author>O\'Brien, Tim</author>\r\n <title>MSXML3: A Comprehensive Guide</title>\r\n <genre>Computer</genre>\r\n <price>36.95</price>\r\n <publish_date>2000-12-01</publish_date>\r\n <description>The Microsoft MSXML3 parser is covered in \r\n detail, with attention to XML DOM interfaces, XSLT processing, \r\n SAX and more.</description>\r\n </book>\r\n <book id=\"bk112\">\r\n <author>Galos, Mike</author>\r\n <title>Visual Studio 7: A Comprehensive Guide</title>\r\n <genre>Computer</genre>\r\n <price>49.95</price>\r\n <publish_date>2001-04-16</publish_date>\r\n <description>Microsoft Visual Studio 7 is explored in depth,\r\n looking at how Visual Basic, Visual C++, C#, and ASP+ are \r\n integrated into a comprehensive development \r\n environment.</description>\r\n </book></library>\r\n</catalog>\r\n','xml',0),(16,'2012-04-03 21:06:36','147.229.220.249','<?xml version=\"1.0\"?>\r\n<catalog>\r\n <library><room id=\"1\">\r\n <book id=\"bk101\">\r\n <author>Gambardella, Matthew</author>\r\n <title>XML Developer\'s Guide</title>\r\n <genre>Computer</genre>\r\n <price>44.95</price>\r\n <publish_date>2000-10-01</publish_date>\r\n <description>An in-depth look at creating applications \r\n with XML.</description>\r\n </book></room>\r\n <room id=\"2\">\r\n <book id=\"bk102\">\r\n <author>Ralls, Kim</author>\r\n <title>Midnight Rain</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2000-12-16</publish_date>\r\n <description>A former architect battles corporate zombies, \r\n an evil sorceress, and her own childhood to become queen \r\n of the world.</description>\r\n </book></room>\r\n </library>\r\n <library>\r\n <book id=\"bk103\">\r\n <author>Corets, Eva</author>\r\n <title>Maeve Ascendant</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2000-11-17</publish_date>\r\n <description>After the collapse of a nanotechnology \r\n society in England, the young survivors lay the \r\n foundation for a new society.</description>\r\n </book>\r\n <book id=\"bk104\">\r\n <author>Corets, Eva</author>\r\n <title>Oberon\'s Legacy</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2001-03-10</publish_date>\r\n <description>In post-apocalypse England, the mysterious \r\n agent known only as Oberon helps to create a new life \r\n for the inhabitants of London. Sequel to Maeve \r\n Ascendant.</description>\r\n </book>\r\n <book id=\"bk105\">\r\n <author>Corets, Eva</author>\r\n <title>The Sundered Grail</title>\r\n <genre>Fantasy</genre>\r\n <price>5.95</price>\r\n <publish_date>2001-09-10</publish_date>\r\n <description>The two daughters of Maeve, half-sisters, \r\n battle one another for control of England. Sequel to \r\n Oberon\'s Legacy.</description>\r\n </book>\r\n <book id=\"bk106\">\r\n <author>Randall, Cynthia</author>\r\n <title>Lover Birds</title>\r\n <genre>Romance</genre>\r\n <price>4.95</price>\r\n <publish_date>2000-09-02</publish_date>\r\n <description>When Carla meets Paul at an ornithology \r\n conference, tempers fly as feathers get ruffled.</description>\r\n </book>\r\n <book id=\"bk107\">\r\n <author>Thurman, Paula</author>\r\n <title>Splish Splash</title>\r\n <genre>Romance</genre>\r\n <price>4.95</price>\r\n <publish_date>2000-11-02</publish_date>\r\n <description>A deep sea diver finds true love twenty \r\n thousand leagues beneath the sea.</description>\r\n </book>\r\n <book id=\"bk108\">\r\n <author>Knorr, Stefan</author>\r\n <title>Creepy Crawlies</title>\r\n <genre>Horror</genre>\r\n <price>4.95</price>\r\n <publish_date>2000-12-06</publish_date>\r\n <description>An anthology of horror stories about roaches,\r\n centipedes, scorpions and other insects.</description>\r\n </book>\r\n <book id=\"bk109\">\r\n <author>Kress, Peter</author>\r\n <title>Paradox Lost</title>\r\n <genre>Science Fiction</genre>\r\n <price>6.95</price>\r\n <publish_date>2000-11-02</publish_date>\r\n <description>After an inadvertant trip through a Heisenberg\r\n Uncertainty Device, James Salway discovers the problems \r\n of being quantum.</description>\r\n </book>\r\n <book id=\"bk110\">\r\n <author>O\'Brien, Tim</author>\r\n <title>Microsoft .NET: The Programming Bible</title>\r\n <genre>Computer</genre>\r\n <price>36.95</price>\r\n <publish_date>2000-12-09</publish_date>\r\n <description>Microsoft\'s .NET initiative is explored in \r\n detail in this deep programmer\'s reference.</description>\r\n </book>\r\n <book id=\"bk111\">\r\n <author>O\'Brien, Tim</author>\r\n <title>MSXML3: A Comprehensive Guide</title>\r\n <genre>Computer</genre>\r\n <price>36.95</price>\r\n <publish_date>2000-12-01</publish_date>\r\n <description>The Microsoft MSXML3 parser is covered in \r\n detail, with attention to XML DOM interfaces, XSLT processing, \r\n SAX and more.</description>\r\n </book>\r\n <book id=\"bk112\">\r\n <author>Galos, Mike</author>\r\n <title>Visual Studio 7: A Comprehensive Guide</title>\r\n <genre>Computer</genre>\r\n <price>49.95</price>\r\n <publish_date>2001-04-16</publish_date>\r\n <description>Microsoft Visual Studio 7 is explored in depth,\r\n looking at how Visual Basic, Visual C++, C#, and ASP+ are \r\n integrated into a comprehensive development \r\n environment.</description>\r\n </book></library>\r\n</catalog>\r\n','xml',0),(17,'2012-04-04 04:35:35','80.243.181.34','','',0),(18,'2012-04-04 04:35:35','80.243.181.34','QrTcFZ <a href=\"http://eawvuudvhazq.com/\">eawvuudvhazq</a>, [url=http://mfetvqiyxori.com/]mfetvqiyxori[/url], [link=http://vrgjscmumbkb.com/]vrgjscmumbkb[/link], http://uzkhszewhjqk.com/','csharp',0),(19,'2012-04-06 22:35:20','46.13.67.223','// Waritkuv pokus o objekty v C++\r\n\r\n#include \"Wagon.h\"\r\n\r\nnamespace waritko\r\n{\r\n // Konstruktor tridy Wagon, kontroluje aby vsechny hodnoty nebyly zaporne\r\n Wagon::Wagon(int cislo, int polozek, double zaPolozku)\r\n {\r\n this->_cislo = cislo >= 0 ? cislo : 0;\r\n this->_polozek = polozek >= 0 ? polozek : 0;\r\n this->_zaPolozku = zaPolozku >= 0 ? zaPolozku : 0;\r\n }\r\n\r\n double Wagon::CenaNakladu()\r\n {\r\n return this->_polozek * this->_zaPolozku;\r\n }\r\n\r\n int Wagon::Cislo()\r\n {\r\n return this->_cislo;\r\n }\r\n\r\n int Wagon::PocetPolozek()\r\n {\r\n return this->_polozek;\r\n }\r\n\r\n void Wagon::VylozPolozku()\r\n {\r\n this->_polozek--;\r\n }\r\n}\r\n','cpp',0),(20,'2012-04-06 22:35:51','46.13.67.223','// Waritkuv pokus o objekty v C++\r\n\r\n#ifndef __WAGON_H_\r\n#define __WAGON_H_\r\n\r\nnamespace waritko\r\n{\r\n class Wagon\r\n {\r\n protected:\r\n int _cislo;\r\n int _polozek;\r\n double _zaPolozku;\r\n public:\r\n Wagon(int cislo, int polozek, double zaPolozku);\r\n int Cislo();\r\n int PocetPolozek();\r\n double CenaNakladu();\r\n void VylozPolozku();\r\n };\r\n}\r\n\r\n#endif\r\n','cpp',0),(21,'2012-04-07 11:56:07','46.13.67.223','// Waritkuv pokus o objekty v C++\r\n\r\n#ifndef __STACK_H_\r\n#define __STACK_H_\r\n\r\n#include <stdlib.h>\r\n#include <assert.h>\r\n#include \"Wagon.h\"\r\n\r\nnamespace waritko\r\n{\r\n class Stack\r\n {\r\n protected:\r\n int _maxSize;\r\n int _count;\r\n private:\r\n Wagon **data;\r\n public:\r\n Stack(int maxSize);\r\n void Push(Wagon *w);\r\n Wagon* Pop();\r\n int Count();\r\n int MaxSize();\r\n };\r\n}\r\n\r\n#endif\r\n','cpp',0),(22,'2012-04-07 11:56:36','46.13.67.223','// Waritkuv pokus o objekty v C++\r\n\r\n#include \"Stack.h\"\r\n\r\nnamespace waritko\r\n{\r\n // Konstruktor, vytvori zasobnik pro maxSize prvku\r\n Stack::Stack(int maxSize)\r\n {\r\n // jsem liny to osetrovat pres podminky a vyjimky takze jen asserty\r\n // a ukonceni programu\r\n assert(maxSize > 0);\r\n this->_maxSize = maxSize;\r\n this->data = (Wagon**)calloc(maxSize, sizeof(Wagon*));\r\n assert(this->data != NULL);\r\n this->_count = 0;\r\n }\r\n\r\n int Stack::Count()\r\n {\r\n return this->_count;\r\n }\r\n\r\n int Stack::MaxSize()\r\n {\r\n return this->_maxSize;\r\n }\r\n \r\n // Celkem jednoducha metoda, proste jen vlozi do zasobniku novy vagon\r\n void Stack::Push(Wagon *w)\r\n {\r\n assert(this->_count < this->_maxSize);\r\n this->data[this->_count] = w;\r\n this->_count++;\r\n }\r\n\r\n // Opak predchozi metody, vrati nejvyssi (nejnovejsi) vagon ze zasobniku\r\n Wagon* Stack::Pop()\r\n {\r\n assert(this->_count > 0);\r\n this->_count--;\r\n return this->data[this->_count-1];\r\n }\r\n}\r\n','cpp',0),(23,'2012-04-08 00:06:08','88.101.131.29','function getRegCounties($db){\r\n $sType = \'unknown\';\r\n list($rList, $cList) = listRC($db);\r\n\r\n $hRegList = \'<fieldset class=\"locList\" id=\"regList\"><legend>\'._a(\'l-regions\').\'</legend><div class=\"list\"><ul>\';\r\n $hCntList = \'<fieldset class=\"locList\" id=\"cntList\"><legend>\'._a(\'l-counties\').\'</legend><div class=\"list\">\';\r\n \r\n foreach ($rList as $rID => $rData){\r\n \r\n //print_r($rData);\r\n $hRegList .= sprintf(\'<li id=\"rlr-%s\" onclick=\"mapSwitchReg(\'%s\');\">%s</li>\', $rData[0], $rData[0], $rData[1]);\r\n $hCntList .= sprintf(\'<ul id=\"rlc-%s\">\', $rData[0]);\r\n \r\n foreach ($cList[$rID] as $cData)\r\n $hCntList .= sprintf(\'<li id=\"rlc-%s\" onclick=\"mapSwitchCounty(\'%s\')\">%s</li>\', $cData[0], $cData[0], $cData[1]);\r\n $hCntList .= \'</ul>\';\r\n }\r\n\r\n return array(\r\n $hRegList.\'</ul></div></fieldset>\',\r\n $hCntList.\'</div></fieldset>\');\r\n}','php',0),(24,'2012-04-08 12:50:03','88.101.131.29','function showLocationList(loc){\r\n if (!((loc != undefined) && loc))\r\n loc = lType;\r\n loadCacheableContent(\'p-llist\', 1, loc+\'#list\', \'filter/\'+sType+\'/\'+loc);\r\n var dList = $(\'#dist-names-\'+loc).val().split(\':\');\r\n for (var d in dList) if (dList[d])\r\n setCB(\'#di-\'+dList[d], true);\r\n return false;\r\n}','javascript',0),(25,'2012-04-11 17:44:37','78.102.34.56','#include \"Stack.h\"\r\n#include \"Wagon.h\"\r\n#include <cstdlib>\r\n#include <iostream>\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string>\r\n#include <time.h>\r\nint P,C1;\r\nint C2 = 1000;\r\nusing namespace std;\r\nusing namespace vlak;\r\n\r\nint main ()\r\n{\r\n srand(time(0));\r\n int C2 = 0;\r\n int C1 = (rand() % 10)+1;\r\n Stack* Vlak2= new Stack(rand() % 40 + 1);\r\n int N = (Vlak2->MaxSize());\r\n Stack* Wagon1= new Stack(N);\r\n Stack* Wagon2= new Stack(N);\r\n Stack* Wagon3= new Stack(N);\r\n for (int i=1; i <= (N-1); i++)\r\n {\r\n P = rand()%(10-1)+1;\r\n C1 = rand()%(1000-100)+100;\r\n Wagon* V=new Wagon(i,P,C1);\r\n Vlak2->Push(V);\r\n cout << \"G\" << V->Cislo() << \"[\" << V->PocetPolozek() << \"]\" << \"[\" << V->CenaNakladu()/V->PocetPolozek() << \"]\" << endl;\r\n }\r\n cout << endl;\r\n Vlak2->Push(NULL);\r\n for (int m=1;m<N;m++)\r\n {\r\n Wagon* value = Vlak2->Pop();\r\n int l = value->CenaNakladu() / value->PocetPolozek();\r\n if( 0 < l ){\r\n if ( l <= 333){\r\n cout << \"G\" << value->Cislo() << \"[1]\" << endl;\r\n C2 = C2 + value->CenaNakladu();\r\n Wagon1->Push(value);\r\n }}\r\n if( 334 <= l )\r\n {\r\n if ( l <= 666){\r\n cout << \"G\" << value->Cislo() << \"[2]\" << endl;\r\n C2 = C2 + value->CenaNakladu();\r\n Wagon2->Push(value);\r\n //cout << \"Zkouska vyberu prvku(vagonu) \" << value->Cislo()<< \" , \" << value->PocetPolozek()<< \" , \" << value->CenaNakladu() << \" , \" << value->CenaNakladu()/value->PocetPolozek() <<endl;\r\n }}\r\n if( 667 <= l ){\r\n if ( l <= 1000){\r\n cout << \"G\" << value->Cislo() << \"[3]\" << endl;\r\n C2 = C2 + value->CenaNakladu();\r\n Wagon3->Push(value);\r\n }\r\n }}\r\n Wagon1->Push(NULL);\r\n Wagon2->Push(NULL);\r\n Wagon3->Push(NULL);\r\n for ( int i = 1; i < N; i++){\r\n for (int g = 1; g < Wagon1->Count(); g++){\r\n Wagon* Wag1 = Wagon1->Pop();\r\n for (int y = 1; y < Wag1->PocetPolozek(); y++)\r\n cout << Wag1->PocetPolozek() << endl ;\r\n }\r\n }\r\n cout << C2 << endl;\r\n cout << Wagon1->Count() << endl;\r\n cout << Wagon2->Count() << endl;\r\n cout << Wagon3->Count() << endl;\r\n cout << N-1 << endl;\r\n /**Wagon* value = Vlak2->Pop();\r\n cout << \"Zkouska vyberu prvku(vagonu) \" << value->Cislo()<< \" , \" << value->PocetPolozek()<< \" , \" << value->CenaNakladu()<<endl;\r\n Wagon* value1 = Vlak2->Pop();\r\n cout << \"Zkouska vyberu prvku(vagonu) \" << value1->Cislo()<< \" , \" << value1->PocetPolozek()<< \" , \" << value1->CenaNakladu()<<endl;\r\n Wagon* value2 = Vlak2->Pop();\r\n cout << \"Zkouska vyberu prvku(vagonu) \" << value2->Cislo()<< \" , \" << value2->PocetPolozek()<< \" , \" << value2->CenaNakladu()<<endl;\r\n **/\r\n system(\"PAUSE\");\r\n return EXIT_SUCCESS;\r\n}\r\n','cpp',0),(30,'2012-07-16 08:55:04','199.64.72.252','using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Drawing;\r\nusing System.Data;\r\nusing System.Text;\r\nusing System.Windows.Forms;\r\nusing DevExpress.XtraEditors;\r\nusing Honeywell.MBEMEA.ConfigApp.Data;\r\nusing Honeywell.MBEMEA.ConfigApp.Logic;\r\nusing Honeywell.MBEMEA.ConfigApp.Templates;\r\nusing Honeywell.MBEMEA.CommonViews.Progress;\r\nusing Honeywell.MBEMEA.Common.CommandManager;\r\nusing Honeywell.MBEMEA.Common.EventArgs;\r\nusing Honeywell.MBEMEA.ConfigApp.Dialogs;\r\nusing System.IO;\r\n\r\nnamespace Honeywell.MBEMEA.ConfigApp.Views.Hardware.HardwareTreeDetails.HardwareDevices\r\n{\r\n public partial class Bus2WirelessMasterDetail : TreeNodeTemplate\r\n {\r\n public Bus2WirelessMasterDetail()\r\n {\r\n InitializeComponent();\r\n }\r\n\r\n private void Bus2WirelessMasterDetail_Load(object sender, EventArgs e)\r\n {\r\n logicalPeripheralControl1.Initialize();\r\n }\r\n\r\n protected override void SelectAdditionalDataID (int UID)\r\n {\r\n HardwareDeviceBindingSource.Position = HardwareDeviceBindingSource.Find (\"UID\", UID);\r\n }\r\n\r\n protected override bool AdditionalDataModified ()\r\n {\r\n if ((HardwareDeviceBindingSource.Position >= 0) &&\r\n (HardwareDeviceBindingSource.Count > 0) &&\r\n (HardwareDeviceBindingSource.Current != null) &&\r\n (HardwareDeviceBindingSource.Current is DataRowView))\r\n {\r\n HardwareDeviceBindingSource.EndEdit ();\r\n DataRowView dataRowView = HardwareDeviceBindingSource.Current as DataRowView;\r\n InternalDataSet.HardwareDeviceRow hwDeviceRow = dataRowView.Row as InternalDataSet.HardwareDeviceRow;\r\n if (hwDeviceRow.RowState != DataRowState.Unchanged)\r\n return true;\r\n }\r\n return logicalPeripheralControl1.AdditionalDataChanged;\r\n }\r\n\r\n protected override bool EnableAddButton()\r\n {\r\n return true;\r\n }\r\n\r\n protected override void BuildAdditionalData(DataRow row)\r\n {\r\n InternalDataSet.HardwareDeviceRow hwDeviceRow = GenericTableOperations.FindParentRow(row) as InternalDataSet.HardwareDeviceRow;\r\n ValidBusAddresses.FillAvailableBusAddresses(hwDeviceRow, comboBoxEditAddress);\r\n logicalPeripheralControl1.BuildAdditionalData(row);\r\n rfMasterAssignDevices1.BuildAdditionalData(row);\r\n base.BuildAdditionalData(row);\r\n }\r\n\r\n protected override void SaveAdditionalData(DataRow row)\r\n {\r\n logicalPeripheralControl1.SaveAdditionalData(row);\r\n rfMasterAssignDevices1.SaveAdditionalData(row);\r\n }\r\n\r\n<<<<<<< .mine\r\n public override bool AdditionalDataModified\r\n {\r\n get\r\n {\r\n return logicalPeripheralControl1.AdditionalDataChanged || rfMasterAssignDevices1.AdditionalDataChanged;\r\n }\r\n }\r\n=======\r\n>>>>>>> .r1793\r\n\r\n private void btnDetectDevices_Click(object sender, EventArgs e)\r\n {\r\n InternalDataSet.HWBus2WirelessMasterRow hwRow = CurrentRow as InternalDataSet.HWBus2WirelessMasterRow;\r\n rfMasterAssignDevices1.AddController(hwRow);\r\n rfMasterAssignDevices1.ClearDetectedDevices();\r\n rfMasterAssignDevices1.ClearDetectedDevices();\r\n string receivedXML;\r\n DateTime end = DateTime.Now.AddSeconds(3);\r\n while (DateTime.Now < end)\r\n {\r\n // Convert this to some async worker\r\n bool result = DetectWirelessUser(hwRow.UID, out receivedXML);\r\n if (result)\r\n {\r\n if (!string.IsNullOrEmpty(receivedXML))\r\n {\r\n rfMasterAssignDevices1.FillDetectedDevices(receivedXML);\r\n }\r\n }\r\n else\r\n {\r\n Honeywell.MBEMEA.ConfigApp.Dialogs.MessageBox.Show(Honeywell.MBEMEA.ConfigApp.Properties.Resources.ErrorDetectingWirelessMembers, MessageType.Error, MessageBoxButtons.OK);\r\n }\r\n }\r\n }\r\n\r\n private bool DetectWirelessUser(int controllerUID, out string receivedXML)\r\n {\r\n bool result = true;\r\n\r\n receivedXML = null;\r\n\r\n // Show info about transfer\r\n WaitWithProgress.Start(WaitWithProgress.WaitProgressType.DetectBusUser);\r\n\r\n FileStream fs = new FileStream(@\"C:\\temp\\wireless.xml\", FileMode.Open, FileAccess.Read);\r\n byte[] data = new byte[fs.Length];\r\n fs.Read(data, 0, (int)fs.Length);\r\n fs.Close();\r\n receivedXML = Encoding.UTF8.GetString(data);\r\n WaitWithProgress.Stop();\r\n\r\n /*string message = \"\";\r\n try\r\n {\r\n XmlCommands.Command xmlCommand = XmlCommands.Command.DetectBusMembers;\r\n\r\n Program.MainForm.Enabled = false;\r\n result = XmlCommandManager.SendAndWait(Program.ServiceClient, new CommandEventArgs(Program.StartParams.PanelID, xmlCommand, new Object[] { controllerUID }), DetectionTimeout, out receivedXML);\r\n Program.MainForm.Enabled = true;\r\n\r\n }\r\n catch (Exception e)\r\n {\r\n message = e.Message;\r\n result = false;\r\n }\r\n finally\r\n {\r\n WaitWithProgress.Stop();\r\n }\r\n\r\n if (result == false)\r\n {\r\n Honeywell.MBEMEA.ConfigApp.Dialogs.MessageBox.Show(string.Format(\"{0}: {1}\", \"Error detecting bus members\", message), MessageType.Error, MessageBoxButtons.OK);\r\n }\r\n else if (string.IsNullOrEmpty(receivedXML))\r\n {\r\n Honeywell.MBEMEA.ConfigApp.Dialogs.MessageBox.Show(\"No bus members detected\", MessageType.Information, MessageBoxButtons.OK);\r\n }*/\r\n\r\n\r\n return result;\r\n }\r\n }\r\n}\r\n','csharp',0),(31,'2012-10-03 12:56:54','199.64.72.252','// PROJECT 1 by Waritko\r\n// Created: 2012-10-03\r\n// This is quite ugly C code, but try to imagine how it would look written in some\r\n// OO language (C# for example) minus the console related functions\r\n\r\n#include \"proj1.h\"\r\n\r\n// Global char count array (this way it is safer than to pass pointer and\r\n// presume that passed array is long enought)\r\nunsigned char _characterCounts[256];\r\n\r\n\r\n// Initializes character count array\r\nvoid Init()\r\n{\r\n for(int i = 0; i < 256; i++)\r\n {\r\n _characterCounts[i] = 0;\r\n }\r\n}\r\n\r\n// Counts characters in STDIN\r\nvoid ProcessSTDIN()\r\n{\r\n int readCharacter = 0;\r\n\r\n // Init counts array\r\n Init();\r\n // And count characters in stdin\r\n while((readCharacter = fgetc(stdin)) != EOF)\r\n {\r\n if(_characterCounts[readCharacter] != UCHAR_MAX)\r\n {\r\n _characterCounts[readCharacter]++;\r\n }\r\n }\r\n}\r\n\r\n// Prints one char stats on output in simple format\r\nvoid PrintCharSimple(int character, int count)\r\n{\r\n printf(\"%d\", character);\r\n if(isprint(character))\r\n {\r\n printf(\" \'%c\'\", character);\r\n }\r\n if(count < UCHAR_MAX)\r\n {\r\n printf(\": %d\\n\", count);\r\n }\r\n else\r\n {\r\n printf(\": NNN\\n\");\r\n }\r\n}\r\n\r\n// Simple printing, easiest of them all\r\nvoid PrintAllSimple()\r\n{\r\n for(int i = 0; i < 256; i++)\r\n {\r\n if(_characterCounts[i] > 0)\r\n {\r\n if(_characterCounts[i] > 0)\r\n {\r\n PrintCharSimple(i, _characterCounts[i]);\r\n }\r\n }\r\n }\r\n}\r\n\r\n// Prints top $count characters (including zero ones)\r\nvoid PrintTopSimple(int count)\r\n{\r\n charCount counts[256];\r\n charCount tmp;\r\n\r\n // Fill helper array\r\n for(int i = 0; i < 256; i++)\r\n {\r\n counts[i].character = i;\r\n counts[i].count = _characterCounts[i];\r\n }\r\n\r\n // Sort the array\r\n for(int i = 0; i < 256; i++)\r\n {\r\n for(int j = 1; j < 256-i; j++)\r\n {\r\n if(counts[j].count > counts[j-1].count)\r\n {\r\n // swap them\r\n tmp = counts[j];\r\n counts[j] = counts[j-1];\r\n counts[j-1] = tmp;\r\n }\r\n }\r\n }\r\n\r\n // and write out\r\n for(int i = 0; i < count; i++)\r\n {\r\n PrintCharSimple(counts[i].character, counts[i].count);\r\n }\r\n}\r\n\r\n// Dummy main process, somebody do cmdline params parsing... :D\r\nint main(char **argv, int argc)\r\n{\r\n ProcessSTDIN();\r\n PrintAllSimple();\r\n printf(\"------------------------------------\\n\");\r\n PrintTopSimple(10);\r\n\r\n return 0;\r\n}\r\n','cpp',0),(32,'2012-10-12 09:02:49','147.229.178.216','/* \r\n * File: main.cpp\r\n * Author: maruska\r\n *\r\n * Created on 9. Ĺ™Ăjen 2012, 17:14\r\n */\r\n\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n#include <string.h>\r\n#include <iostream>\r\nusing namespace std;\r\n\r\nclass typeParam{\r\n\r\npublic:\r\n \r\n std::string content;\r\n int port;\r\n int printHelp();\r\n int printErr(int Errors);\r\n \r\n enum Errors{\r\n NO_ERR,\r\n ERR_PRM\r\n };\r\n \r\nprivate:\r\n \r\n};\r\n\r\n\r\nint typeParam::printHelp()\r\n{\r\ntypeParam *err = new typeParam;\r\n \r\n cout << endl << \"----------------------\" << endl;\r\n cout << \"NápovÄ›da\" << endl;\r\n cout << \"----------------------\" << endl;\r\n \r\n return err->NO_ERR;\r\n}\r\n\r\nint typeParam::printErr(int typeParam::Errors){ \r\n typeParam *err = new typeParam;\r\n \r\n switch(err->Errors){\r\n case err->ERR_PRM:\r\n cerr << \"Chyba parametru!\" << endl;\r\n break;\r\n default:\r\n cerr << \"Chyba zadanych parametru nebo prikazu!\" << endl;\r\n break;\r\n \r\n }\r\n}\r\n\r\n\r\n\r\n\r\nint main(int argc, char** argv) {\r\n typeParam *parm = new typeParam;\r\n typeParam *err = new typeParam;\r\n\r\n \r\n if(argc == 2 && strcmp(argv[1], \"-h\") == 0){\r\n parm->printHelp();\r\n return EXIT_SUCCESS;\r\n }\r\n else if(argc == 3 && strcmp(argv[1], \"-c\") == 0){\r\n \r\n }\r\n else {\r\n parm->printErr(err->ERR_PRM);\r\n return EXIT_FAILURE;\r\n }\r\n return EXIT_SUCCESS;\r\n}\r\n','cpp',0),(33,'2012-10-12 09:44:05','199.64.72.252','/*\r\n* File: main.cpp\r\n* Author: maruska\r\n*\r\n* Created on 9. Ĺ™Ăjen 2012, 17:14\r\n*/\r\n\r\n#include <iostream>\r\nusing namespace std;\r\n\r\nclass typeParam\r\n{\r\npublic:\r\n\r\n string content;\r\n int port;\r\n int printHelp();\r\n int printErr(int Errors);\r\n\r\n static enum Errors{\r\n NO_ERR,\r\n ERR_PRM\r\n };\r\n\r\nprivate:\r\n\r\n};\r\n\r\n\r\nint typeParam::printHelp()\r\n{\r\n //typeParam *err = new typeParam;\r\n\r\n cout << endl << \"----------------------\" << endl;\r\n cout << \"NápovÄ›da\" << endl;\r\n cout << \"----------------------\" << endl;\r\n\r\n return typeParam::Errors::NO_ERR;\r\n}\r\n\r\nint typeParam::printErr(int Errors)\r\n{ \r\n //typeParam *err = new typeParam;\r\n\r\n switch(Errors)\r\n {\r\n case typeParam::Errors::ERR_PRM:\r\n cerr << \"Chyba parametru!\" << endl;\r\n break;\r\n default:\r\n cerr << \"Chyba zadanych parametru nebo prikazu!\" << endl;\r\n break;\r\n }\r\n\r\n return 0; // tez bys mohla z fce neco vracet kdyz uz neni void :D\r\n}\r\n\r\n\r\n\r\n\r\nint main(int argc, char** argv) {\r\n typeParam *parm = new typeParam;\r\n //typeParam *err = new typeParam;\r\n\r\n\r\n if(argc == 2 && strcmp(argv[1], \"-h\") == 0){\r\n parm->printHelp();\r\n return EXIT_SUCCESS;\r\n }\r\n else if(argc == 3 && strcmp(argv[1], \"-c\") == 0){\r\n\r\n }\r\n else {\r\n parm->printErr(typeParam::Errors::ERR_PRM);\r\n return EXIT_FAILURE;\r\n }\r\n return EXIT_SUCCESS;\r\n}\r\n','cpp',0),(34,'2012-10-12 09:47:09','147.229.178.216','/* \r\n * File: main.cpp\r\n * Author: maruska\r\n *\r\n * Created on 9. Ĺ™Ăjen 2012, 17:14\r\n */\r\n\r\n#include <stdlib.h>\r\n#include <stdio.h>\r\n#include <string.h>\r\n#include <iostream>\r\nusing namespace std;\r\n\r\nclass typeParam{\r\n\r\npublic:\r\n \r\n std::string content;\r\n int port;\r\n int printHelp();\r\n int printErr(int Errors);\r\n \r\n enum Errors{\r\n NO_ERR,\r\n ERR_PRM\r\n };\r\n \r\nprivate:\r\n \r\n};\r\n\r\n\r\nint typeParam::printHelp()\r\n{\r\ntypeParam *err = new typeParam;\r\n \r\n cout << endl << \"----------------------\" << endl;\r\n cout << \"NápovÄ›da\" << endl;\r\n cout << \"----------------------\" << endl;\r\n \r\n return err->NO_ERR;\r\n}\r\n\r\nint typeParam::printErr(int Errors){ \r\n \r\n \r\n switch(Errors){\r\n case ERR_PRM:\r\n cerr << \"Chyba parametru!\" << endl;\r\n break;\r\n default:\r\n cerr << \"Chyba zadanych parametru nebo prikazu!\" << endl;\r\n break;\r\n \r\n }\r\n \r\n}\r\n\r\n\r\n\r\n\r\nint main(int argc, char** argv) {\r\n typeParam *parm = new typeParam;\r\n typeParam *err = new typeParam;\r\n\r\n \r\n if(argc == 2 && strcmp(argv[1], \"-h\") == 0){\r\n parm->printHelp();\r\n return EXIT_SUCCESS;\r\n }\r\n else if(argc == 3 && strcmp(argv[1], \"-c\") == 0 && argv[2] != 0){\r\n cout << \"prdel prde prdel!\" << endl;\r\n }\r\n else {\r\n parm->printErr(err->ERR_PRM);\r\n return EXIT_FAILURE;\r\n }\r\n return EXIT_SUCCESS;\r\n}\r\n','cpp',0),(35,'2012-10-12 09:55:19','77.93.194.60','/*\r\n* File: main.cpp\r\n* Author: maruska\r\n*\r\n* Created on 9. Ĺ™Ăjen 2012, 17:14\r\n*/\r\n\r\n#include <iostream>\r\nusing namespace std;\r\n\r\n// Enumy doporucuju deklarovat mimo tridu pokud nevis, co delas :D\r\n// Ono to dava smysl i v tride, ale musi to na ni mit logickou vazbu :)\r\nenum Errors{\r\n NO_ERR,\r\n ERR_PRM\r\n};\r\n\r\nclass typeParam\r\n{\r\n public:\r\n string content;\r\n int port;\r\n int printHelp();\r\n int printErr(int Errors);\r\n private:\r\n};\r\n\r\n\r\nint typeParam::printHelp()\r\n{\r\n //typeParam *err = new typeParam;\r\n\r\n cout << endl << \"----------------------\" << endl;\r\n cout << \"NápovÄ›da\" << endl;\r\n cout << \"----------------------\" << endl;\r\n\r\n return NO_ERR;\r\n}\r\n\r\nint typeParam::printErr(int Errors)\r\n{ \r\n switch(Errors)\r\n {\r\n case ERR_PRM:\r\n cerr << \"Chyba parametru!\" << endl;\r\n break;\r\n default:\r\n cerr << \"Chyba zadanych parametru nebo prikazu!\" << endl;\r\n break;\r\n }\r\n\r\n return 0; // tez bys mohla z fce neco vracet kdyz uz neni void :D\r\n}\r\n\r\n\r\n\r\n\r\nint main(int argc, char** argv) {\r\n typeParam *parm = new typeParam;\r\n\r\n if(argc == 2 && strcmp(argv[1], \"-h\") == 0){\r\n parm->printHelp();\r\n return EXIT_SUCCESS;\r\n }\r\n else if(argc == 3 && strcmp(argv[1], \"-c\") == 0){\r\n\r\n }\r\n else {\r\n parm->printErr(ERR_PRM);\r\n return EXIT_FAILURE;\r\n }\r\n return EXIT_SUCCESS;\r\n}\r\n','cpp',0),(36,'2012-10-21 13:19:16','88.101.29.249','http://www.gouletpens.com/Scribal_Work_Shop_Leviathan_Green_Ink_p/sw02le.htm\r\n','html4strict',0),(37,'2012-11-18 17:56:58','94.113.104.130','unit wssql;\r\ninterface\r\n type\r\n int = longint;\r\n student = record\r\n jmeno : string[30];\r\n prijmeni : string[30];\r\n vek : int;\r\n pohlavi : int;\r\n mail : string[60];\r\n tel : string[20];\r\n mesto : string[30];\r\n end;\r\n evidence = array[0..100] of student;\r\n database = file of student;\r\n\r\nprocedure ws_getall(var db : database; var ev : evidence; var num : int);\r\nprocedure ws_connect(dbname : string; var db : database);\r\nprocedure ws_create_db(dbname : string; var db : database);\r\nprocedure ws_close(var db : database);\r\nprocedure ws_saveall(var db : database; var ev : evidence; var num : int);\r\nprocedure ws_clear_evid(var evid : evidence; var num : int);\r\nprocedure ws_add(var evid : evidence; stud : student; var num : int);\r\n\r\nimplementation\r\nprocedure ws_connect(dbname : string; var db : database);\r\n begin\r\n (*otevre soubor databaze pro cteni*)\r\n assign(db, dbname);\r\n reset(db);\r\n end;\r\n\r\nprocedure ws_getall(var db : database; var ev : evidence; var num : int);\r\n var\r\n i : int;\r\n begin\r\n i := 0;\r\n while not eof(db) do\r\n begin\r\n read(db, ev[i]);\r\n inc(i);\r\n end;\r\n num := i;\r\n end;\r\n\r\nprocedure ws_create_db(dbname : string; var db : database);\r\n begin\r\n assign(db, dbname);\r\n rewrite(db);\r\n end;\r\n\r\nprocedure ws_close(var db : database);\r\n begin\r\n close(db);\r\n end;\r\n\r\nprocedure ws_saveall(var db : database; var ev : evidence; var num : int);\r\n var\r\n i : int;\r\n begin\r\n for i := 1 to num do\r\n begin\r\n write(db, ev[i-1]);\r\n end;\r\n close(db);\r\n end;\r\n\r\nprocedure ws_clear_evid(var evid : evidence; var num : int);\r\n var\r\n i : int;\r\n free : student;\r\n begin\r\n with free do\r\n begin\r\n jmeno := \'\';\r\n prijmeni := \'\';\r\n vek := 0;\r\n pohlavi := 0;\r\n mesto := \'\';\r\n mail := \'\';\r\n tel := \'\';\r\n end;\r\n for i := 0 to 100 do\r\n begin\r\n evid[i] := free;\r\n end;\r\n num := 0;\r\n end;\r\n\r\nprocedure ws_add(var evid : evidence; stud : student; var num : int);\r\n begin\r\n evid[num] := stud;\r\n inc(num);\r\n end;\r\n\r\nbegin\r\n\r\nend.','pascal',0),(38,'2012-11-28 15:45:56','77.93.194.60','{\r\n \"skinName\": \"Ezreal\",\r\n \"ranked\": false,\r\n \"skinIndex\": 3,\r\n \"fellowPlayers\": [\r\n {\r\n \"championId\": 131,\r\n \"summonerId\": 31604245,\r\n \"summonerName\": \"Ellector\",\r\n \"teamId\": 100\r\n },\r\n {\r\n \"championId\": 113,\r\n \"summonerId\": 30444160,\r\n \"summonerName\": \"Asheare\",\r\n \"teamId\": 100\r\n }],\r\n \"gameType\": \"MATCHED_GAME\",\r\n \"experienceEarned\": 0,\r\n \"eligibleFirstWinOfDay\": true,\r\n \"difficulty\": \"MEDIUM\",\r\n \"gameMapId\": 10,\r\n \"leaver\": false,\r\n \"spell1\": 4,\r\n \"spell2\": 7,\r\n \"gameTypeEnum\": \"MATCHED_GAME\",\r\n \"teamId\": 100,\r\n \"summonerId\": 30488609,\r\n \"statistics\": [\r\n {\r\n \"statType\": \"MAGIC_DAMAGE_TAKEN\",\r\n \"value\": 7984,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"TOTAL_HEAL\",\r\n \"value\": 0,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ITEM3\",\r\n \"value\": 3132,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"TURRETS_KILLED\",\r\n \"value\": 2,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"NEUTRAL_MINIONS_KILLED\",\r\n \"value\": 10,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"GOLD_EARNED\",\r\n \"value\": 8045,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"TOTAL_DAMAGE_TAKEN\",\r\n \"value\": 12532,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"MINIONS_KILLED\",\r\n \"value\": 50,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"TOTAL_TIME_SPENT_DEAD\",\r\n \"value\": 70,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"CHAMPIONS_KILLED\",\r\n \"value\": 8,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"LARGEST_KILLING_SPREE\",\r\n \"value\": 4,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"LARGEST_CRITICAL_STRIKE\",\r\n \"value\": 0,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"LARGEST_MULTI_KILL\",\r\n \"value\": 1,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ITEM5\",\r\n \"value\": 0,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"BARRACKS_KILLED\",\r\n \"value\": 1,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"TOTAL_DAMAGE_DEALT\",\r\n \"value\": 52437,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"SIGHT_WARDS_BOUGHT_IN_GAME\",\r\n \"value\": 0,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"MAGIC_DAMAGE_DEALT_PLAYER\",\r\n \"value\": 7156,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"VISION_WARDS_BOUGHT_IN_GAME\",\r\n \"value\": 0,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ITEM4\",\r\n \"value\": 0,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ITEM1\",\r\n \"value\": 3181,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ASSISTS\",\r\n \"value\": 4,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"PHYSICAL_DAMAGE_TAKEN\",\r\n \"value\": 4427,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ITEM2\",\r\n \"value\": 3134,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"LEVEL\",\r\n \"value\": 13,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"PHYSICAL_DAMAGE_DEALT_PLAYER\",\r\n \"value\": 45280,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"NUM_DEATHS\",\r\n \"value\": 4,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"ITEM0\",\r\n \"value\": 3006,\r\n \"dataVersion\": 0\r\n },\r\n {\r\n \"statType\": \"WIN\",\r\n \"value\": 1,\r\n \"dataVersion\": 0\r\n }],\r\n \"afk\": false,\r\n \"boostXpEarned\": 0,\r\n \"level\": 30,\r\n \"invalid\": false,\r\n \"userId\": 35146496,\r\n \"createDate\": \"2012-11-22 21:25:05Z\",\r\n \"userServerPing\": 24,\r\n \"premadeSize\": 0,\r\n \"boostIpEarned\": 0,\r\n \"gameId\": 412417095,\r\n \"timeInQueue\": 0,\r\n \"ipEarned\": 191,\r\n \"gameMode\": \"CLASSIC\",\r\n \"difficultyString\": \"MEDIUM\",\r\n \"subType\": \"BOT_3x3\",\r\n \"queueType\": \"BOT_3x3\",\r\n \"premadeTeam\": false,\r\n \"championId\": 81,\r\n \"dataVersion\": 2\r\n},','javascript',0),(39,'2012-12-17 04:45:28','188.143.232.211','VZtVdP <a href=\"http://wjgehbkwcoan.com/\">wjgehbkwcoan</a>, [url=http://cmvmcgxyoxrv.com/]cmvmcgxyoxrv[/url], [link=http://azleargvdrzz.com/]azleargvdrzz[/link], http://qefbplpscmdh.com/','csharp',0),(40,'2013-01-29 17:41:15','178.72.250.6','#include <stdio.h>\r\n#include <ctype.h>\r\n#include <stdlib.h>\r\n\r\n\r\nint main() \r\n{\r\n int matice1[9];\r\n int matice2[9];\r\n int vysledek[9];\r\n int i, j;\r\n int opakovat=0; //opakovani celeho programu\r\n int volba; //switch pro vybrani operace\r\n int cislo; //koeficient pro nasobeni matice\r\n FILE *soubor_se_zadanim;\r\n FILE *soubor_s_vysledkem;\r\n\r\n do\r\n {\r\n soubor_se_zadanim = fopen(\"D:\\\\matice.txt\",\"rt\");\r\n if (soubor_se_zadanim == NULL)\r\n { //vstup z klavesnice\r\n printf(\"Zadej prvni matici (po radcich):\\n\");\r\n for (i=0; i<9; i++)\r\n {\r\n scanf(\"%d\", &matice1[i]);\r\n }\r\n printf(\"Prvky matice1 jsou:\");\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[0], matice1[1], matice1[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[3], matice1[4], matice1[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[6], matice1[7], matice1[8]);\r\n\r\n printf(\"\\nZadej druhou matici (po radcich):\\n\");\r\n for (i=0; i<9; i++)\r\n {\r\n scanf(\"%d\", &matice2[i]);\r\n }\r\n printf(\"Prvky matice1 jsou:\");\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[0], matice2[1], matice2[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[3], matice2[4], matice2[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[6], matice2[7], matice2[8]);\r\n }\r\n else \r\n { //vstup ze souboru\r\n i=0;\r\n j=0;\r\n while (j<9)\r\n {\r\n fscanf(soubor_se_zadanim, \"%d\", &matice1[i]);\r\n j++;\r\n i++;\r\n }\r\n i=0;\r\n while (fscanf(soubor_se_zadanim, \"%d\", &matice2[i]) == 1)\r\n {\r\n i++;\r\n }\r\n fclose(soubor_se_zadanim);\r\n }\r\n\r\n //vyber, co chci pocitat\r\n printf(\"\\nCo chces s maticemi delat?\");\r\n printf(\"\\n1 - Vynasobit mezi sebou\");\r\n printf(\"\\n2 - Vynasobit prvni matici cislem\");\r\n printf(\"\\n3 - Transponovat prvni matici\");\r\n printf(\"\\nVolba: \");\r\n scanf(\"%d\", &volba);\r\n\r\n switch(volba)\r\n {\r\n case 1:\r\n { //soucet matic\r\n vysledek[0] = matice1[0]*matice2[0] + matice1[1]*matice2[3] + matice1[2]*matice2[6];\r\n vysledek[1] = matice1[0]*matice2[1] + matice1[1]*matice2[4] + matice1[2]*matice2[7];\r\n vysledek[2] = matice1[0]*matice2[2] + matice1[1]*matice2[5] + matice1[2]*matice2[8];\r\n \r\n vysledek[3] = matice1[3]*matice2[0] + matice1[4]*matice2[3] + matice1[5]*matice2[6];\r\n vysledek[4] = matice1[3]*matice2[1] + matice1[4]*matice2[4] + matice1[5]*matice2[7];\r\n vysledek[5] = matice1[3]*matice2[2] + matice1[4]*matice2[5] + matice1[5]*matice2[8];\r\n\r\n vysledek[6] = matice1[6]*matice2[0] + matice1[6]*matice2[3] + matice1[6]*matice2[6];\r\n vysledek[7] = matice1[6]*matice2[1] + matice1[6]*matice2[4] + matice1[6]*matice2[7];\r\n vysledek[8] = matice1[6]*matice2[2] + matice1[6]*matice2[5] + matice1[6]*matice2[8];\r\n break;\r\n }\r\n case 2:\r\n { //nasobeni cislem\r\n printf(\"\\nZadej cislo: \");\r\n scanf(\"%d\", &cislo);\r\n for (i=0; i<9; i++)\r\n vysledek[i] = matice1[i]*cislo;\r\n break;\r\n }\r\n case 3:\r\n { //transponovani\r\n vysledek[0] = matice1[0];\r\n vysledek[1] = matice1[3];\r\n vysledek[2] = matice1[6];\r\n vysledek[3] = matice1[1];\r\n vysledek[4] = matice1[4];\r\n vysledek[5] = matice1[7];\r\n vysledek[6] = matice1[2];\r\n vysledek[7] = matice1[5];\r\n vysledek[8] = matice1[8];\r\n break;\r\n }\r\n default:\r\n printf(\"Spatna volba.\");\r\n }\r\n\r\n \r\n\r\n //vypis vysledku\r\n printf(\"\\n\\nVysledek:\");\r\n printf(\"\\n%d\\t%d\\t%d\", vysledek[0], vysledek[1], vysledek[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", vysledek[3], vysledek[4], vysledek[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", vysledek[6], vysledek[7], vysledek[8]);\r\n\r\n //vypis vysledku do souboru\r\n soubor_s_vysledkem = fopen(\"D:\\\\soubor_s_vysledkem.txt\", \"wt\");\r\n fprintf(soubor_s_vysledkem,\"%d\\t%d\\t%d\", vysledek[0], vysledek[1], vysledek[2]);\r\n fprintf(soubor_s_vysledkem,\"\\n%d\\t%d\\t%d\", vysledek[3], vysledek[4], vysledek[5]);\r\n fprintf(soubor_s_vysledkem,\"\\n%d\\t%d\\t%d\", vysledek[6], vysledek[7], vysledek[8]);\r\n fclose(soubor_s_vysledkem);\r\n\r\n //dotaz na opakovani programu\r\n printf(\"\\n\\nOpakovat program? [1/0] : \");\r\n scanf(\"%d\", &opakovat);\r\n system(\"CLS\");\r\n\r\n } \r\n while (opakovat == 1);\r\n\r\n //for (i=0; i<10; i++)\r\n // printf(\"%d\\n\", pole1[i]);\r\n system(\"pause\");\r\n\r\n return 0;\r\n}','cpp',0),(41,'2013-01-30 08:16:11','178.72.250.6','#include <stdio.h>\r\n#include <ctype.h>\r\n#include <stdlib.h>\r\n\r\n\r\nint main() \r\n{\r\n int matice1[9];\r\n int matice2[9];\r\n int vysledek[9];\r\n int i, j;\r\n int opakovat=0; //opakovani celeho programu\r\n int volba; //switch pro vybrani operace\r\n int cislo; //koeficient pro nasobeni matice\r\n FILE *soubor_se_zadanim;\r\n FILE *soubor_s_vysledkem;\r\n\r\n do\r\n {\r\n soubor_se_zadanim = fopen(\"D:\\\\soubor_se_zadanim.txt\",\"rt\");\r\n if (soubor_se_zadanim == NULL)\r\n { //vstup z klavesnice\r\n printf(\"Zadej prvni matici (po radcich):\\n\");\r\n for (i=0; i<9; i++)\r\n {\r\n scanf(\"%d\", &matice1[i]);\r\n }\r\n printf(\"Prvky matice1 jsou:\");\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[0], matice1[1], matice1[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[3], matice1[4], matice1[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[6], matice1[7], matice1[8]);\r\n\r\n printf(\"\\nZadej druhou matici (po radcich):\\n\");\r\n for (i=0; i<9; i++)\r\n {\r\n scanf(\"%d\", &matice2[i]);\r\n }\r\n printf(\"Prvky matice2 jsou:\");\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[0], matice2[1], matice2[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[3], matice2[4], matice2[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[6], matice2[7], matice2[8]);\r\n }\r\n else \r\n { //vstup ze souboru\r\n i=0;\r\n j=0;\r\n while (j<9)\r\n {\r\n fscanf(soubor_se_zadanim, \"%d\", &matice1[i]);\r\n j++;\r\n i++;\r\n }\r\n printf(\"Prvky matice1 jsou:\");\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[0], matice1[1], matice1[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[3], matice1[4], matice1[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice1[6], matice1[7], matice1[8]);\r\n i=0;\r\n while (fscanf(soubor_se_zadanim, \"%d\", &matice2[i]) == 1)\r\n {\r\n i++;\r\n }\r\n fclose(soubor_se_zadanim);\r\n printf(\"\\nPrvky matice2 jsou:\");\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[0], matice2[1], matice2[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[3], matice2[4], matice2[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", matice2[6], matice2[7], matice2[8]);\r\n }\r\n\r\n //vyber, co pocitat\r\n printf(\"\\nCo chces s maticemi delat?\");\r\n printf(\"\\n1 - Vynasobit mezi sebou\");\r\n printf(\"\\n2 - Vynasobit prvni matici cislem\");\r\n printf(\"\\n3 - Transponovat prvni matici\");\r\n printf(\"\\nVolba: \");\r\n scanf(\"%d\", &volba);\r\n\r\n switch(volba)\r\n {\r\n case 1:\r\n { //soucet matic\r\n vysledek[0] = matice1[0]*matice2[0] + matice1[1]*matice2[3] + matice1[2]*matice2[6];\r\n vysledek[1] = matice1[0]*matice2[1] + matice1[1]*matice2[4] + matice1[2]*matice2[7];\r\n vysledek[2] = matice1[0]*matice2[2] + matice1[1]*matice2[5] + matice1[2]*matice2[8];\r\n \r\n vysledek[3] = matice1[3]*matice2[0] + matice1[4]*matice2[3] + matice1[5]*matice2[6];\r\n vysledek[4] = matice1[3]*matice2[1] + matice1[4]*matice2[4] + matice1[5]*matice2[7];\r\n vysledek[5] = matice1[3]*matice2[2] + matice1[4]*matice2[5] + matice1[5]*matice2[8];\r\n\r\n vysledek[6] = matice1[6]*matice2[0] + matice1[7]*matice2[3] + matice1[8]*matice2[6];\r\n vysledek[7] = matice1[6]*matice2[1] + matice1[7]*matice2[4] + matice1[8]*matice2[7];\r\n vysledek[8] = matice1[6]*matice2[2] + matice1[7]*matice2[5] + matice1[8]*matice2[8];\r\n break;\r\n }\r\n case 2:\r\n { //nasobeni cislem\r\n printf(\"\\nZadej cislo: \");\r\n scanf(\"%d\", &cislo);\r\n for (i=0; i<9; i++)\r\n vysledek[i] = matice1[i]*cislo;\r\n break;\r\n }\r\n case 3:\r\n { //transponovani\r\n vysledek[0] = matice1[0];\r\n vysledek[1] = matice1[3];\r\n vysledek[2] = matice1[6];\r\n vysledek[3] = matice1[1];\r\n vysledek[4] = matice1[4];\r\n vysledek[5] = matice1[7];\r\n vysledek[6] = matice1[2];\r\n vysledek[7] = matice1[5];\r\n vysledek[8] = matice1[8];\r\n break;\r\n }\r\n default:\r\n printf(\"Spatna volba.\");\r\n }\r\n\r\n \r\n\r\n //vypis vysledku\r\n printf(\"\\n\\nVysledek:\");\r\n printf(\"\\n%d\\t%d\\t%d\", vysledek[0], vysledek[1], vysledek[2]);\r\n printf(\"\\n%d\\t%d\\t%d\", vysledek[3], vysledek[4], vysledek[5]);\r\n printf(\"\\n%d\\t%d\\t%d\", vysledek[6], vysledek[7], vysledek[8]);\r\n\r\n //vypis vysledku do souboru\r\n soubor_s_vysledkem = fopen(\"D:\\\\soubor_s_vysledkem.txt\", \"wt\");\r\n fprintf(soubor_s_vysledkem,\"%d\\t%d\\t%d\", vysledek[0], vysledek[1], vysledek[2]);\r\n fprintf(soubor_s_vysledkem,\"\\n%d\\t%d\\t%d\", vysledek[3], vysledek[4], vysledek[5]);\r\n fprintf(soubor_s_vysledkem,\"\\n%d\\t%d\\t%d\", vysledek[6], vysledek[7], vysledek[8]);\r\n fclose(soubor_s_vysledkem);\r\n\r\n //dotaz na opakovani programu\r\n printf(\"\\n\\nOpakovat program? [1/0] : \");\r\n scanf(\"%d\", &opakovat);\r\n system(\"CLS\");\r\n\r\n } \r\n while (opakovat == 1);\r\n\r\n return 0;\r\n}','cpp',0),(42,'2013-01-30 08:27:01','199.64.72.252','/** Multiplies two given matrices\r\n * @param a Matrix to be multiplied\r\n * @param b Matrix to multiply by\r\n * @return Product of two given matrices\r\n */\r\nWMATHLIB_API w_matrix w_mmul(w_matrix a, w_matrix b)\r\n{\r\n W_INT i;\r\n W_INT j;\r\n W_INT k;\r\n w_matrix c;\r\n w_msize sa;\r\n w_msize sb;\r\n w_msize sc;\r\n if(a.data == NULL || a.cols == 0 || a.rows == 0 || b.data == NULL || b.cols == 0 || b.rows == 0)\r\n {\r\n // if some parameter of w_matrix is null\r\n fprintf(stderr, \"One of matrices which has to be multiplied is uninitialized or hasn\'t propertly\\n set number of columns or rows. First of given matrices\\n\");\r\n return a;\r\n }\r\n c = w_mcreate(b.cols, a.rows);\r\n sa.cols = a.cols;\r\n sa.rows = a.rows;\r\n sb.cols = b.cols;\r\n sb.rows = b.rows;\r\n sc.cols = c.cols;\r\n sc.rows = c.rows;\r\n for(i = 0; i < c.rows; i++)\r\n {\r\n for(j = 0; j < c.cols; j++)\r\n {\r\n for(k = 0; k < a.cols; k++)\r\n {\r\n c.data[w_mindex(sc, i, j)] = c.data[w_mindex(sc, i, j)] + a.data[w_mindex(sa, i, k)] * b.data[w_mindex(sb, k, j)];\r\n }\r\n }\r\n }\r\n return c;\r\n}','cpp',0),(43,'2013-03-21 11:49:55','199.64.72.252','using System;\r\nusing System.Runtime.Serialization;\r\n\r\nnamespace Honeywell.MBEMEA.CommServer.Contract\r\n{\r\n [DataContract]\r\n public class GetLogDataEventArgs : System.EventArgs\r\n {\r\n\r\n public GetLogDataEventArgs(DateTime startTime, DateTime stopTime)\r\n {\r\n StartTime = startTime;\r\n StopTime = stopTime;\r\n\r\n EntryCnt = 0;\r\n }\r\n\r\n public GetLogDataEventArgs(int startPosition, int count)\r\n {\r\n StartPosition = startPosition;\r\n StartTime = DateTime.MinValue;\r\n StopTime = DateTime.MinValue;\r\n\r\n EntryCnt = count;\r\n }\r\n\r\n [DataMember]\r\n public int StartPosition { get; set; }\r\n\r\n [DataMember]\r\n public DateTime StartTime { get; set; }\r\n\r\n [DataMember]\r\n public DateTime StopTime { get; set; }\r\n\r\n [DataMember]\r\n public int EntryCnt { get; set; }\r\n\r\n [DataMember]\r\n public int ResultCnt { get; set; }\r\n }\r\n\r\n}\r\n','csharp',0),(44,'2013-03-25 07:27:10','188.143.232.211','aJTM45 <a href=\"http://zzcrrzkqeptc.com/\">zzcrrzkqeptc</a>, [url=http://qvkgyhanaofj.com/]qvkgyhanaofj[/url], [link=http://ynylzowzdtah.com/]ynylzowzdtah[/link], http://inetjsnfzvsv.com/','csharp',0),(45,'2013-03-28 10:07:47','178.72.252.115','#define _CRT_SECURE_NO_WARNINGS\r\n#include <stdio.h>\r\n\r\n\r\n\r\n\r\nint main(int argc, char* argv[])\r\n{\r\n\r\n FILE *zdroj, *cil;\r\n int znak;\r\n int i, j, k;\r\n char potvrzeni; //pro verzi bez ciloveho souboru\r\n int pismeno_kolikrat[16];\r\n char pismeno[26]={\'a\',\'A\',\'c\',\'C\',\'d\',\'D\',\'e\',\'E\',\'i\',\'I\',\'n\',\'N\',\'o\',\'O\',\'r\',\'R\',\'s\',\'S\',\'t\',\'T\',\'u\',\'U\',\'y\',\'Y\',\'z\',\'Z\'};\r\n int pismena_celkem=0; //celkovy pocet nahrazenych pismen\r\n int zmena_ve_slove=0;\r\n int pocet_slov=0;\r\n int a=0; //pomocna promenna pro skok po poslednim slove\r\n\r\n \r\n\r\n for (i=0; i<16; i++) //vynulovani pocitadla pro jednotliva pismena\r\n {\r\n pismeno_kolikrat[i] = 0;\r\n }\r\n \r\n switch (argc)\r\n {\r\n case 1: //zadan pouze nazev souboru\r\n {\r\n printf (\"\\nProgram je nutno spoustet z prikazove radky!\\nFormat: diakritika.exe ZdrojovySoubor CilovySoubor.\\nPri vynechani CilovehoSouboru dojde k prepisu originalniho textu.\\n\");\r\n return 0;\r\n break;\r\n }\r\n case 2: //zadan nazev souboru+zdroj\r\n {\r\n printf (\"\\nFormat: diakritika.exe ZdrojovySoubor CilovySoubor.\\nPri vynechani CilovehoSouboru dojde k prepisu originalniho textu.\\n\");\r\n printf (\"Neni zadan CilovySoubor. Bude prepsan ZdrojovySoubor. Pokracovat? [A/N] \\n\");\r\n scanf (\"%c\", &potvrzeni);\r\n if (potvrzeni == \'a\' || potvrzeni == \'A\')\r\n {\r\n //tady budu prepisovat stavajici soubor\r\n return 0;\r\n }\r\n else\r\n {\r\n printf (\"\\nPreklad zrusen.\\n\");\r\n return 0;\r\n }\r\n break;\r\n }\r\n case 3: //zadano vse, plny program\r\n {\r\n printf (\"\\nFormat: diakritika.exe ZdrojovySoubor CilovySoubor.\\nPri vynechani CilovehoSouboru dojde k prepisu originalniho textu.\\n\");\r\n printf (\"Vlozen ZdrojovySoubor i CilovySoubor, preklad bude proveden do CilovehoSouboru.\\n\\n\");\r\n zdroj = fopen (argv[1], \"rt\");\r\n if (zdroj == NULL)\r\n {\r\n printf (\"Nelze otevrit ZdrojovySoubor %s!\\n\", argv[1]);\r\n return 0;\r\n }\r\n cil = fopen (argv[2], \"wt\");\r\n if (cil == NULL)\r\n {\r\n printf (\"Nelze otevrit/zalozit CilovySoubor %s!\\n\", argv[2]);\r\n return 0;\r\n }\r\n //cteni jednotlivych znaku\r\n while ((znak = getc(zdroj)) != EOF) //zacatek funkce\r\n {\r\n switch (znak)\r\n {\r\n case 225: //á\r\n {\r\n znak = 97;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[0]++;\r\n break;\r\n }\r\n case 193: //Ă\r\n {\r\n znak = 65;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[0]++;\r\n break;\r\n }\r\n case 232: //ÄŤ\r\n {\r\n znak = 99;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[1]++;\r\n break;\r\n }\r\n case 200: //ÄŚ\r\n {\r\n znak = 67;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[1]++;\r\n break;\r\n }\r\n case 239: //ÄŹ\r\n {\r\n znak = 100;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[2]++;\r\n break;\r\n }\r\n case 207: //ÄŽ\r\n {\r\n znak = 68;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[2]++;\r\n break;\r\n }\r\n case 233: //Ă©\r\n {\r\n znak = 101;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[3]++;\r\n break;\r\n }\r\n case 201: //É\r\n {\r\n znak = 69;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[3]++;\r\n break;\r\n }\r\n case 236: //Ä›\r\n {\r\n znak = 101;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[3]++;\r\n break;\r\n }\r\n case 204: //Äš\r\n {\r\n znak = 69;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[3]++;\r\n break;\r\n }\r\n case 237: //Ă\r\n {\r\n znak = 105;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[4]++;\r\n break;\r\n }\r\n case 205: //ĂŤ\r\n {\r\n znak = 73;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[4]++;\r\n break;\r\n }\r\n case 242: //Ĺ\r\n {\r\n znak = 110;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[5]++;\r\n break;\r\n }\r\n case 210: //Ň\r\n {\r\n znak = 78;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[5]++;\r\n break;\r\n }\r\n case 243: //Ăł\r\n {\r\n znak = 111;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[6]++;\r\n break;\r\n }\r\n case 211: //Ă“\r\n {\r\n znak = 79;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[6]++;\r\n break;\r\n }\r\n case 248: //Ĺ™\r\n {\r\n znak = 114;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[7]++;\r\n break;\r\n }\r\n case 216: //Ĺ\r\n {\r\n znak = 82;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[7]++;\r\n break;\r\n }\r\n case 154: //š\r\n {\r\n znak = 115;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[8]++;\r\n break;\r\n }\r\n case 138: //Ĺ \r\n {\r\n znak = 83;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[8]++;\r\n break;\r\n }\r\n case 157: //ĹĄ\r\n {\r\n znak = 116;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[9]++;\r\n break;\r\n }\r\n case 141: //Ť\r\n {\r\n znak = 84;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[9]++;\r\n break;\r\n }\r\n case 250: //Ăş\r\n {\r\n znak = 117;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[10]++;\r\n break;\r\n }\r\n case 218: //Ăš\r\n {\r\n znak = 85;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[10]++;\r\n break;\r\n }\r\n case 249: //ĹŻ\r\n {\r\n znak = 117;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[10]++;\r\n break;\r\n }\r\n case 217: //Ĺ®\r\n {\r\n znak = 85;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[10]++;\r\n break;\r\n }\r\n case 253: //Ă˝\r\n {\r\n znak = 121;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[11]++;\r\n break;\r\n }\r\n case 221: //Ăť\r\n {\r\n znak = 89;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[11]++;\r\n break;\r\n }\r\n case 158: //Ĺľ\r\n {\r\n znak = 122;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[12]++;\r\n break;\r\n }\r\n case 142: //Ĺ˝\r\n {\r\n znak = 90;\r\n putc (znak, cil);\r\n zmena_ve_slove++;\r\n pismeno_kolikrat[12]++;\r\n break;\r\n }\r\n//JUMP: \r\n default:\r\n {\r\n if ((znak == 32/*mezera*/ || znak == 10/*enter*/ || znak == 40/*(*/ || znak == 41/*)*/ || znak == 44/*,*/ || znak == 46/*.*/ || znak == EOF) && zmena_ve_slove != 0)\r\n {\r\n pocet_slov++;\r\n zmena_ve_slove = 0;\r\n }\r\n putc (znak, cil);\r\n break;\r\n }\r\n }\r\n } //konec funkce\r\n break;\r\n }\r\n default:\r\n {\r\n printf(\"\\nChyba! Vlozeno prilis mnoho argumentu.\\n\");\r\n printf (\"Format: diakritika.exe ZdrojovySoubor CilovySoubor\\nPri vynechani CilovehoSouboru dojde k prepisu originalniho textu.\\n\");\r\n return 0;\r\n break;\r\n }\r\n }\r\n/* a++;\r\n if (a == 1)\r\n {\r\n goto JUMP;\r\n }*/\r\n fclose (zdroj);\r\n fclose (cil);\r\n\r\n for (i=0; i<16; i++)\r\n {\r\n pismena_celkem += pismeno_kolikrat[i];\r\n }\r\n printf (\"Preklad hotov. Zmeneno %d pismen v %d slovech.\\n\", pismena_celkem, pocet_slov);\r\n printf (\"Podrobny vypis:\\n\");\r\n printf (\"Pismeno\\t\\tPocet vyskytu\\n\");\r\n for (i=0, j=0, k=1; i<13; i++, j=j+2, k=k+2)\r\n {\r\n printf (\" %c/%c\\t\\t\\t%dx\\n\", pismeno[j], pismeno[k], pismeno_kolikrat[i]);\r\n }\r\n return 0;\r\n}','cpp',0),(46,'2013-04-09 16:14:52','199.64.72.252',' function getPlayerAPDetails($pid, $start = 0, $range = \'\')\r\n {\r\n $start = mysql_real_escape_string($start);\r\n if($range != \'\')\r\n {\r\n $start = getRangeStart($range);\r\n }\r\n $out = new stdClass();\r\n $sum = 0;\r\n $res = mysql_query(\"select sum(ap) as created from actions where action in (\'resonator_create\', \'link_create\', \'capture\', \'field_create\') AND `when` >= $start AND who=\".$pid);\r\n if($r = mysql_fetch_object($res))\r\n {\r\n $out->created = $r->created;\r\n $sum += $r->created;\r\n }\r\n $res = mysql_query(\"select sum(ap) as destroyed from actions where action in (\'resonator_destroy\', \'link_destroy\', \'field_destroy\') AND `when` >= $start AND who=\".$pid);\r\n if($r = mysql_fetch_object($res))\r\n {\r\n $out->destroyed = $r->destroyed;\r\n $sum += $r->destroyed;\r\n }\r\n $out->total = $sum;\r\n $out->details = new stdClass();\r\n // Funny details :D\r\n $res = mysql_query(\"select * from (select distinct action, sum(ap) as ap from actions where who=$pid and `when` > $start group by action) as act right join (SELECT DISTINCT action FROM `actions`) as actlist on act.action=actlist.action\");\r\n print_r(mysql_error());\r\n while($r = mysql_fetch_object($res))\r\n {\r\n if($r->ap)\r\n {\r\n $out->details->{$r->action} = $r->ap;\r\n }\r\n else\r\n {\r\n $out->details->{$r->action} = 0;\r\n }\r\n }\r\n\r\n return $out;\r\n }\r\n echo json_encode(getPlayerAPDetails(71, 0, \'day\'));','php',0),(47,'2013-06-04 09:46:09','199.64.72.252','DialogResult dlrFile = exportSaveFileDialog.ShowDialog();\r\n if (dlrFile == DialogResult.OK)\r\n {\r\n var dlgExportPassword = new DoublePasswordDialog();\r\n var dlrPassword = DialogResult.Retry;\r\n while (dlrPassword == DialogResult.Retry)\r\n {\r\n dlrPassword = dlgExportPassword.ShowDialog();\r\n if (dlrPassword == DialogResult.OK)\r\n {\r\n var exporter = new PanelConfigurationExporter(GetFocusedConfigurationID(), panelID);\r\n exporter.SetPanelInfo();\r\n exporter.SaveExportedConfiguration(exportSaveFileDialog.FileName, dlgExportPassword.Password);\r\n XtraMessageBox.Show(Resources.ConfigurationExported, Resources.ConfigurationExportedCaption);\r\n }\r\n dlgExportPassword.ClearPasswords();\r\n }\r\n }','csharp',0),(48,'2013-07-14 17:34:49','178.72.252.115','private void textBoxCmd_KeyPress(object sender, KeyPressEventArgs e)\r\n {\r\n string Set = \"\";\r\n if (e.KeyChar == \'\\n\' || e.KeyChar == \'\\r\')\r\n {\r\n bool Uspat = false;\r\n string Vstup = textBoxCmd.Text.Trim().ToUpper();\r\n string reg = \"(S10[0-5]|S11[0-5]|S12[0-7]|S13[0-7]|S14[0-4]|S15[0-4]|S16[0-1]|S17[0-4]|R1)\";\r\n Regex test = new Regex(reg);\r\n if (test.IsMatch(Vstup))\r\n {\r\n if (Vstup.StartsWith(\"S\"))\r\n {\r\n Uspat = true;\r\n Set = Vstup;\r\n }\r\n toolStripStatusLabel1.ForeColor = Color.Black;\r\n toolStripStatusLabel1.Text = \"PROVĂDĂŤM\";\r\n this.Update(); // prekresli se\r\n }\r\n else\r\n {\r\n toolStripStatusLabel1.ForeColor = Color.Red;\r\n toolStripStatusLabel1.Text = \"CHYBA\";\r\n return;\r\n }\r\n ttyClient.Instance.SendMessage(Vstup);\r\n string Data = \"\"; \r\n Data = ttyClient.Instance.ReadMessage();\r\n if (Vstup == \"R1\" && Data == \"=>\")\r\n {\r\n Data = ttyClient.Instance.ReadMessage();\r\n }\r\n if (!Uspat)\r\n { \r\n switch (Set)\r\n {\r\n case \"S100\":\r\n {\r\n Data += \"V\";\r\n break;\r\n }\r\n default:\r\n {\r\n Data += \"xxx\";\r\n break;\r\n }\r\n }\r\n lblDisplay.Text = Data;\r\n }\r\n else\r\n {\r\n Thread.Sleep(3000);\r\n }\r\n\r\n toolStripStatusLabel1.Text = \"OK\";\r\n textBoxCmd.Text = \"\";\r\n }\r\n }','csharp',0),(49,'2013-10-15 13:26:25','78.102.111.158',';**************************************************************\r\n;\r\n; Program HelloWorld - IAS\r\n; FIT VUT v Brne\r\n;\r\n;**************************************************************\r\n; Preklad programu lze provest nasledovne:\r\n; nasm -fobj helloworld.asm\r\n; alink -oPE -subsys console helloworld.obj\r\n; nebo pomoci davky run.bat:\r\n; run.bat hello\r\n;**************************************************************\r\n\r\n%include \'rw32.inc\' ; nacteni knihovny rw32.inc\r\n\r\n[segment .data use32] ; definice zacatku datoveho segmentu\r\n \r\n; testovaci retezec\r\nsMessage db \"Hello World!\",10,13,0\r\n \r\n[segment .code use32] ; definice zacatku kodoveho segementu\r\n \r\nprologue ; makro -- inicializace programu\r\n \r\n ; vlastni program\r\n mov esi,sMessage \r\n call WriteString\r\n\r\nepilogue ; makro -- ukonceni programu','asm',0),(50,'2013-12-01 15:26:04','147.229.93.190','/*\r\n * Soubor: proj2.c\r\n * Datum: 2007-11-21\r\n * Autor: Martin Vařák, xvarak00@stud.fit.vutbr.cz\r\n * Projekt: IZP - Projekt č. 2 - Iterační výpočty\r\n * Popis: Program provádí výpočty funkcí sin, ln pomocí aproximace\r\n * a vypocet prumeru a smerodatne odchylky\r\n */\r\n\r\n#include \"proj2.h\"\r\n\r\n/**\r\n * Parsuje parametry prikazoveho radku\r\n * @param argc Pocet argumentu v prikazove radce\r\n * @param argv Pole hodnot argumentu prikazove radky\r\n */\r\nparams parseCmdLine(int argc, char *argv[])\r\n{\r\n params ret;\r\n ret.code = ERR_OK;\r\n ret.eps = 0.0;\r\n\r\n if(argc < 2 || argc > 3)\r\n {\r\n // Pokud nemame spravny pocet argumentu, vratime chybovy kod\r\n ret.code = ERR_CMD;\r\n return ret;\r\n }\r\n\r\n // Napoveda\r\n if(!strcmp(argv[1], \"-h\") || !strcmp(argv[1], \"--help\"))\r\n {\r\n // Pokud uzivatel chtel pouze napovedu, vratime chybovy kod, ktery\r\n // znamena tisk napovedy\r\n ret.code = ERR_HLP;\r\n return ret;\r\n }\r\n\r\n // Sinus\r\n if(!strcmp(argv[1], \"-sin\"))\r\n {\r\n ret.type = TYPE_SIN;\r\n if(argc == 3)\r\n {\r\n // Pokud chceme pocitat sinus, potrebujeme nacist epsilon\r\n ret.eps = atof(argv[2]);\r\n }\r\n else\r\n {\r\n // Pokud epsilon nebylo zadano, vratime chybu\r\n ret.code = ERR_CMD;\r\n }\r\n\r\n if(ret.eps < 0)\r\n {\r\n // Neni mozno pocitat se zapornym epsilon, vratime chybovy kod\r\n ret.code = ERR_EPS;\r\n }\r\n return ret;\r\n }\r\n\r\n // Prirozeny logaritmus\r\n if(!strcmp(argv[1], \"-ln\"))\r\n {\r\n ret.type = TYPE_LN;\r\n if(argc == 3)\r\n {\r\n // Pro prirozeny logaritmus je rovnez nutno znat epsilon\r\n ret.eps = atof(argv[2]);\r\n }\r\n else\r\n {\r\n // Pokud epsilon nebylo zadano, vratime chybu\r\n ret.code = ERR_CMD;\r\n }\r\n\r\n if(ret.eps < 0)\r\n {\r\n // Neni mozno pocitat se zapornym epsilon, vratime chybovy kod\r\n ret.code = ERR_EPS;\r\n }\r\n return ret;\r\n }\r\n\r\n // Ar. prumer\r\n if(!strcmp(argv[1], \"-mv\"))\r\n {\r\n ret.type = TYPE_MV;\r\n return ret;\r\n }\r\n\r\n // Standardni odchylka\r\n if(!strcmp(argv[1], \"-stddev\"))\r\n {\r\n ret.type = TYPE_DEV;\r\n return ret;\r\n }\r\n\r\n // Pokud nebyl zadan nektery z vyse uvedenych parametru, vratime\r\n // chybovy kod\r\n ret.code = ERR_CMD;\r\n return ret;\r\n}\r\n\r\n/**\r\n * Vypise na stderr chybovou hlasku v zavislosti na chybovem kodu\r\n * @param code Chybovy kod\r\n */\r\nvoid printError(int code)\r\n{\r\n switch(code)\r\n {\r\n case ERR_HLP:\r\n {\r\n // Napoveda\r\n printHelp();\r\n break;\r\n }\r\n case ERR_CMD:\r\n {\r\n // Chyba prikazove radky\r\n fputs(\"Chybny format prikazove radky\\n\\n\", stderr);\r\n printHelp();\r\n break;\r\n }\r\n case ERR_EPS:\r\n {\r\n // Chybne epsilon\r\n fputs(\"Epsilon musi byt vetsi nez nula, neni mozno pocitat se zapornym epsilon\\n\", stderr);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Vypise na stderr napovedu k pouzivani programu\r\n */\r\nvoid printHelp()\r\n{\r\n fputs(\"Program pro vypocet hodnot funkci pomoci aproximace\\n\", stderr);\r\n fputs(\"Martin Varak <xvarak00@stud.fit.vutbr.cz>\\n\", stderr);\r\n fputs(\" -h\\tTiskne tuto napovedu\\n\", stderr);\r\n fputs(\" -sin <eps>\\tPocita sinus s presnosti <eps>\\n\", stderr);\r\n fputs(\" -ln <eps>\\tPocita prirozeny logaritmus s presnosti <eps>\\n\", stderr);\r\n fputs(\" -mv\\t\\tPocita aritmeticky prumer\\n\", stderr);\r\n fputs(\" -stddev\\tPocita smerodatnou odchylku\\n\\n\", stderr);\r\n}\r\n\r\n/**\r\n * Funkce k vypoctu sinu pomoci aproximace\r\n * @param x X, ve kterem pocitat fcni hodnotu\r\n * @param eps Presnost vypostu (epsilon)\r\n * @return sin x\r\n */\r\ndouble aprox_sin(double x, double eps)\r\n{\r\n double last = 0.0;\r\n double ret;\r\n double xpow;\r\n int one = 1;\r\n double fact = 1;\r\n int n = 3;\r\n\r\n if(x > 1e15)\r\n {\r\n // Jelikoz nad 1e15 je jiz vypocet sinu znacne nepresny kvuli omezeni\r\n // presnosti typu double na 15 platnych cislic, vracim nan\r\n return 0.0/0.0;\r\n }\r\n \r\n // Jelikoz je sin() periodicka fce, timto dostanu x do rozumneho rozsahu\r\n // ve kterem je aproximace presna\r\n x = fmod(x, IZP_2PI);\r\n xpow = x;\r\n\r\n ret = one*(x/fact);\r\n one *= -1;\r\n // Cyklus aproximace ma rovnez urceny minimalni pocet iteraci (SIN_MIN_ITER)\r\n while(fabs(last - ret) > eps)\r\n {\r\n last = ret;\r\n xpow = xpow*x*x;\r\n fact = fact*(n-1)*n;\r\n ret += one*(xpow/fact);\r\n one *= -1;\r\n n += 2;\r\n }\r\n return ret;\r\n}\r\n\r\n/**\r\n * Funkce k vypoctu aritmetickeho prumeru\r\n * @param x \r\n * @param prevSum Suma vsech predchozich prvku posloupnosti\r\n * @param prevCount Pocet vsech predchozich prvku posloupnosti\r\n * @return Aritmeticky prumer\r\n */\r\ndouble mv(double x, double *prevSum, int *prevCount)\r\n{\r\n int tmp;\r\n\r\n *prevCount += 1;\r\n *prevSum += x;\r\n x = *prevSum;\r\n tmp = *prevCount;\r\n return x/tmp;\r\n}\r\n\r\n/**\r\n * \r\n */\r\ndouble w_stddev(double x, double *prevSum, double *prevSqr, int *prevCount)\r\n{\r\n double medVal = mv(x, prevSum, prevCount);\r\n double ret;\r\n double temp;\r\n\r\n *prevSqr += x*x;\r\n ret = (*prevSqr)-(*prevSum)*medVal*2+(*prevCount)*medVal*medVal;\r\n // pro prvni prvek vratim nulu\r\n if(*prevCount == 1)\r\n {\r\n return 0.0;\r\n }\r\n temp = ((double)1/(double)(*prevCount-1));\r\n ret = temp*ret;\r\n ret = sqrt(ret);\r\n return ret;\r\n}\r\n\r\n/**\r\n * Funkce k vypoctu prirozeneho logaritmu pomoci aproximace\r\n * @param x X, ve kterem pocitat funkcni hodnotu\r\n * @param eps Presnost vypoctu (epsilon)\r\n * @return ln x\r\n */\r\ndouble aprox_ln(double x, double eps)\r\n{\r\n double last = 0.0;\r\n double ret;\r\n int n = 3;\r\n double xpow;\r\n int iters = 0;\r\n\r\n if(x < 0)\r\n {\r\n // Pro zaporne x neni logaritmus definovan, vracim nan\r\n return 0.0/0.0;\r\n }\r\n if(x == 0)\r\n {\r\n // Pro x rovno nule je logaritmus nekonecny, vracim inf\r\n return 1/0.0;\r\n }\r\n if(finite(x))\r\n {\r\n // Pro nekonecne x je logaritmus rovnez nekonecny, vracim inf\r\n return 1/0.0;\r\n }\r\n\r\n // Optimalizace vstupu na hodnotu, kterou lze pocitat pomoci rozvoje\r\n while(x > IZP_E)\r\n {\r\n // Pokud je vstup prilis veliky, vydelime ho na hodnotu, ve ktere \r\n // funkce konverguje\r\n x /= IZP_E;\r\n iters++;\r\n }\r\n while(x < ((float)1/IZP_E))\r\n {\r\n // V pripade, ze je vstup prilis maly, vynasobime jej na hodnotu,\r\n // ve ktere funkce rozumne konverguje\r\n x *= IZP_E;\r\n iters--;\r\n }\r\n\r\n x = (x-1)/(x+1);\r\n xpow = x;\r\n ret = xpow;\r\n while(fabs(last - ret) > eps)\r\n {\r\n last = ret;\r\n xpow = xpow*x*x;\r\n ret += (1/(double)n)*xpow;\r\n n += 2;\r\n }\r\n return (ret*2)+iters;\r\n}\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n params par;\r\n double input; // Vstupni hodnota\r\n double output = 0; // Vystupni hodnota\r\n double temp = 0; // Pomocna promenna pro funkce mv a w_stddev\r\n double temp2 = 0; // Pomocna promenna pro funkci w_stddev\r\n int inttmp = 0; // Pomocna promenna pro funkce mv a w_stddev\r\n int readStatus; // Promenna pro stav nacitani\r\n\r\n par = parseCmdLine(argc, argv);\r\n if(par.code != ERR_OK)\r\n {\r\n // Pokud nebyl vysledek nacitani parametru prikazove radky v poradku,\r\n // vytisknu chybovou zpravu\r\n printError(par.code);\r\n return par.code;\r\n }\r\n\r\n // Smycka na zpracovani dat\r\n while(!feof(stdin))\r\n {\r\n readStatus = fscanf(stdin, \"%lf\", &input);\r\n if(!readStatus)\r\n {\r\n // Pokud se nenacetl parametr odstranim bordel a do inputu priradim nan\r\n while(!isspace(getc(stdin)));\r\n input = 0.0/0.0;\r\n }\r\n if(readStatus == EOF)\r\n {\r\n // Pokud jsem narazil na konec souboru, ukoncim aplikaci\r\n return ERR_OK;\r\n }\r\n // Zpracovani dat\r\n switch(par.type)\r\n {\r\n case TYPE_MV:\r\n {\r\n output = mv(input, &temp, &inttmp);\r\n break;\r\n }\r\n\r\n case TYPE_SIN:\r\n {\r\n output = aprox_sin(input, par.eps);\r\n break;\r\n }\r\n\r\n case TYPE_LN:\r\n {\r\n output = aprox_ln(input, par.eps);\r\n break;\r\n }\r\n\r\n case TYPE_DEV:\r\n {\r\n output = w_stddev(input, &temp, &temp2, &inttmp);\r\n break;\r\n }\r\n }\r\n printf(\"%.10le\\n\", output);\r\n }\r\n return par.code;\r\n}\r\n','cpp',0),(51,'2013-12-01 15:26:24','147.229.93.190','/*\r\n * Soubor: proj2.c\r\n * Datum: 2007-11-21\r\n * Autor: Martin Vařák, xvarak00@stud.fit.vutbr.cz\r\n * Projekt: IZP - Projekt č. 2 - Iterační výpočty\r\n * Popis: Program provádí výpočty funkcí sin, ln pomocí aproximace\r\n * a vypocet prumeru a smerodatne odchylky\r\n */\r\n\r\n#ifndef __PROJ2_H_\r\n#define __PROJ2_H_\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h>\r\n#include <ctype.h>\r\n#include <assert.h>\r\n#include <math.h>\r\n\r\nconst double IZP_E = 2.7182818284590452354; // e\r\nconst double IZP_PI = 3.14159265358979323846; // pi\r\nconst double IZP_2PI = 6.28318530717958647692; // 2*pi\r\nconst double IZP_PI_2 = 1.57079632679489661923; // pi/2\r\nconst double IZP_PI_4 = 0.78539816339744830962; // pi/4\r\n\r\n// Definice chybovych kodu\r\n#define ERR_OK 0\r\n#define ERR_HLP 1\r\n#define ERR_CMD 2\r\n#define ERR_EPS 3\r\n\r\n// Definice pomocnych konstant\r\n#define TYPE_SIN 1 // sinus\r\n#define TYPE_LN 2 // logaritmus\r\n#define TYPE_MV 3 // prumer\r\n#define TYPE_DEV 4 // stadnardni odchylka\r\n\r\n// Definice funkce finite jak pro VC++, tak pro GCC\r\n#ifdef _WIN32\r\n#define finite !_finite\r\n#else\r\n#define finite isinf\r\n#endif\r\n\r\n// Definice datovych typu\r\ntypedef struct _params\r\n{\r\n int code;\r\n int type;\r\n double eps;\r\n} params;\r\n\r\n// Prototypy funkci\r\nparams parseCmdLine(int argc, char *argv[]);\r\nvoid printError(int code);\r\nvoid printHelp();\r\ndouble aprox_sin(double x, double eps);\r\ndouble mv(double x, double *prevSum, int *prevCount);\r\ndouble aprox_ln(double x, double eps);\r\ndouble w_stddev(double x, double *prevSum, double *prevSqr, int *prevCount);\r\n\r\n#endif\r\n','cpp',0),(52,'2014-01-13 19:54:46','199.64.72.253','[\"901b3f2f802544c28a65c2fdd7484f3f.d\", 1363469414731, {\r\n \"plext\": {\r\n \"text\": \"PanBobek destroyed the Link Kostel Nejsvu011btu011bju0161u00ed Trojice (Bou017eetu011bchova 2502/2A, 612 00 Brno-Brno-Kru00e1lovo Pole, Czech Republic) to Pomnu00edk padlu00fdm pu0159u00edsluu0161nu00edku016fm Rud (Bou017eetu011bchova 2502/2A, 612 00 Brno-Brno-Kru00e1lovo Pole, Czech Republic)\",\r\n \"markup\": [\r\n [\"PLAYER\", {\r\n \"plain\": \"PanBobek\",\r\n \"guid\": \"1df4f4621fab45b2944cd9e6e9a5ee2a.c\",\r\n \"team\": \"RESISTANCE\"\r\n }],\r\n [\"TEXT\", {\r\n \"plain\": \" destroyed the Link \"\r\n }],\r\n [\"PORTAL\", {\r\n \"name\": \"Kostel Nejsvu011btu011bju0161u00ed Trojice\",\r\n \"plain\": \"Kostel Nejsvu011btu011bju0161u00ed Trojice (Bou017eetu011bchova 2502/2A, 612 00 Brno-Brno-Kru00e1lovo Pole, Czech Republic)\",\r\n \"team\": \"ALIENS\",\r\n \"latE6\": 49227201,\r\n \"address\": \"Bou017eetu011bchova 2502/2A, 612 00 Brno-Brno-Kru00e1lovo Pole, Czech Republic\",\r\n \"lngE6\": 16596125,\r\n \"guid\": \"d117a9ffc7e944e19b97cd21dbf8cc7a.11\"\r\n }],\r\n [\"TEXT\", {\r\n \"plain\": \" to \"\r\n }],\r\n [\"PORTAL\", {\r\n \"name\": \"Pomnu00edk padlu00fdm pu0159u00edsluu0161nu00edku016fm Rud\",\r\n \"plain\": \"Pomnu00edk padlu00fdm pu0159u00edsluu0161nu00edku016fm Rud (Bou017eetu011bchova 2502/2A, 612 00 Brno-Brno-Kru00e1lovo Pole, Czech Republic)\",\r\n \"team\": \"ALIENS\",\r\n \"latE6\": 49227573,\r\n \"address\": \"Bou017eetu011bchova 2502/2A, 612 00 Brno-Brno-Kru00e1lovo Pole, Czech Republic\",\r\n \"lngE6\": 16595859,\r\n \"guid\": \"7736733c7c3140729cb41c104afc9fe4.11\"\r\n }]\r\n ],\r\n \"plextType\": \"SYSTEM_BROADCAST\",\r\n \"team\": \"ALIENS\"\r\n }\r\n}]','javascript',0),(53,'2014-01-30 13:55:25','199.64.72.254','<?php\r\n\r\nuse Nette\\Application\\Routers\\RouteList,\r\n Nette\\Application\\Routers\\Route;\r\n\r\n\r\n/**\r\n * Router factory.\r\n */\r\nclass RouterFactory\r\n{\r\n\r\n /**\r\n * @return Nette\\Application\\IRouter\r\n */\r\n public function createRouter()\r\n {\r\n $router = new RouteList();\r\n $router[] = new Route(\'//www.sdum.net/<action (cenik|kontakt|odhlaseni)>[/<id>]\', array(\'presenter\' => \'Homepage\',\r\n \'action\' => array(\r\n Route::VALUE => \'default\',\r\n Route::FILTER_TABLE => array(\r\n // řetězec v URL => presenter\r\n \'cenik\' => \'price\',\r\n \'kontakt\' => \'contact\',\r\n// \'\' => \'\',\r\n ),\r\n ),\r\n \'id\' => null,\r\n ));\r\n $router[] = new Route(\'//www.sdum.net/<presenter (login)>/<action=default>\');\r\n // There should be ideally route that allows all presenters but Homepage, always should point to <site>.sdum.cz\r\n $router[] = new Route(\'//<site>.sdum.net/<presenter>/<action>[/<id>]\', array(\r\n \'presenter\' => array(\r\n Route::VALUE => \'Homepage\',\r\n Route::FILTER_TABLE => array(\r\n // řetězec v URL => presenter\r\n \'app\' => \'app\',\r\n \'administrace\' => \'Administration\',\r\n ),\r\n ),\r\n \'action\' => array(\r\n Route::VALUE => \'default\',\r\n Route::FILTER_TABLE => array(\r\n // řetězec v URL => presenter\r\n \'odhlaseni\' => \'logout\',\r\n \'nastenka\' => \'dashboard\',\r\n \'novinky\' => \'news\',\r\n \'schuze\' => \'meetings\',\r\n \'soubory\' => \'files\',\r\n \'kontakty\' => \'contacts\',\r\n// \'\' => \'\',\r\n ),\r\n ),\r\n \'id\' => NULL,\r\n ));\r\n return $router;\r\n }\r\n\r\n}\r\n','php',0),(54,'2014-02-05 08:39:06','199.64.72.254','<?php\r\n\r\nuse Nette\\Application\\Routers\\RouteList,\r\n Nette\\Application\\Routers\\Route;\r\n\r\n\r\n/**\r\n * Router factory.\r\n */\r\nclass RouterFactory\r\n{\r\n /**\r\n * @return Nette\\Application\\IRouter\r\n */\r\n public function createRouter()\r\n {\r\n $router = new RouteList();\r\n $router[] = new Route(\'//www.(sdum.net|s-dum.cz|schuzebd.eu|schuzebd.cz)/<action (cenik|kontakt|odhlaseni)>[/<id>]\', array(\'presenter\' => \'Homepage\',\r\n \'action\' => array(\r\n Route::VALUE => \'default\',\r\n Route::FILTER_TABLE => array(\r\n // řetězec v URL => presenter\r\n \'cenik\' => \'price\',\r\n \'kontakt\' => \'contact\',\r\n// \'\' => \'\',\r\n ),\r\n ),\r\n \'id\' => null,\r\n ));\r\n $router[] = new Route(\'//www.(sdum.net|s-dum.cz|schuzebd.eu|schuzebd.cz)/<presenter (login)>/<action=default>\');\r\n // There should be ideally route that allows all presenters but Homepage, always should point to <site>.sdum.cz\r\n $router[] = new Route(\'//<site>.(sdum.net|s-dum.cz|schuzebd.eu|schuzebd.cz)/<presenter>/<action>[/<id>]\', array(\r\n \'presenter\' => array(\r\n Route::VALUE => \'Homepage\',\r\n Route::FILTER_TABLE => array(\r\n // řetězec v URL => presenter\r\n \'app\' => \'app\',\r\n \'administrace\' => \'Administration\',\r\n ),\r\n ),\r\n \'action\' => array(\r\n Route::VALUE => \'default\',\r\n Route::FILTER_TABLE => array(\r\n // řetězec v URL => presenter\r\n \'odhlaseni\' => \'logout\',\r\n \'nastenka\' => \'dashboard\',\r\n \'novinky\' => \'news\',\r\n \'schuze\' => \'meetings\',\r\n \'soubory\' => \'files\',\r\n \'kontakty\' => \'contacts\',\r\n// \'\' => \'\',\r\n ),\r\n ),\r\n \'id\' => NULL,\r\n ));\r\n return $router;\r\n }\r\n\r\n}\r\n','php',0),(55,'2014-02-05 09:12:43','62.245.116.31',' $router[] = new Route(\'//www.<domain>.<tld>/<action (cenik|kontakt|odhlaseni)>[/<id>]\', \'Homeage:default\');\r\n $router[] = new Route(\'//www.<domain>.<tld>/login\', \'Login:default\');\r\n $router[] = new Route(\'<site>.<domain>.<tld>/<presenter>/<action>\', \'App:default\');','php',0),(56,'2014-02-05 16:04:51','199.64.72.254','<?php\r\n/** Dashboard presenter */\r\nabstract class AppPresenter extends BasePresenter\r\n{\r\n /** @persistent */\r\n public $site;\r\n\r\n /**\r\n * @var Site Site model\r\n */\r\n protected $siteModel;\r\n\r\n /**\r\n * @var int Site ID\r\n */\r\n protected $siteId = 0;\r\n\r\n /**\r\n * Injects site model to presenter\r\n * @param Site $site Model for authentication\r\n */\r\n public function injectSite(Site $site)\r\n {\r\n $this->siteModel = $site;\r\n \\Nette\\Diagnostics\\Debugger::barDump($site);\r\n }\r\n\r\n /**\r\n * Common initializations on request startup\r\n */\r\n protected function startup()\r\n {\r\n parent::startup();\r\n\r\n // Check if user is logged in\r\n /*if(!$this->getUser()->isLoggedIn())\r\n {\r\n $this->redirect(\'Login:default\');\r\n }*/\r\n\r\n // Set layout\r\n $this->setLayout(\'layout.inapp\');\r\n\r\n // Get site ID\r\n $this->siteId = $this->$siteModel->getSiteId($this->site);\r\n }\r\n}','php',0),(57,'2014-02-07 18:42:51','78.102.111.158','{\r\n \"gameId\": 754087745,\r\n \"invalid\": false,\r\n \"gameMode\": \"CLASSIC\",\r\n \"gameType\": \"MATCHED_GAME\",\r\n \"subType\": \"NORMAL\",\r\n \"mapId\": 1,\r\n \"teamId\": 100,\r\n \"championId\": 83,\r\n \"spell1\": 4,\r\n \"spell2\": 14,\r\n \"level\": 30,\r\n \"createDate\": 1391788687403,\r\n \"fellowPlayers\": [\r\n {\r\n \"summonerId\": 30690237,\r\n \"teamId\": 100,\r\n \"championId\": 267\r\n },\r\n {\r\n \"summonerId\": 26215716,\r\n \"teamId\": 200,\r\n \"championId\": 114\r\n },\r\n {\r\n \"summonerId\": 34578922,\r\n \"teamId\": 100,\r\n \"championId\": 157\r\n },\r\n {\r\n \"summonerId\": 24008975,\r\n \"teamId\": 200,\r\n \"championId\": 7\r\n },\r\n {\r\n \"summonerId\": 39916795,\r\n \"teamId\": 100,\r\n \"championId\": 51\r\n },\r\n {\r\n \"summonerId\": 33897117,\r\n \"teamId\": 200,\r\n \"championId\": 121\r\n },\r\n {\r\n \"summonerId\": 33535070,\r\n \"teamId\": 200,\r\n \"championId\": 29\r\n },\r\n {\r\n \"summonerId\": 22920586,\r\n \"teamId\": 200,\r\n \"championId\": 54\r\n },\r\n {\r\n \"summonerId\": 38994324,\r\n \"teamId\": 100,\r\n \"championId\": 79\r\n }\r\n ],\r\n \"statistics\": [\r\n {\r\n \"id\": 1,\r\n \"name\": \"LEVEL\",\r\n \"value\": 15\r\n },\r\n {\r\n \"id\": 2,\r\n \"name\": \"GOLD_EARNED\",\r\n \"value\": 8371\r\n },\r\n {\r\n \"id\": 4,\r\n \"name\": \"NUM_DEATHS\",\r\n \"value\": 12\r\n },\r\n {\r\n \"id\": 7,\r\n \"name\": \"MINIONS_KILLED\",\r\n \"value\": 113\r\n },\r\n {\r\n \"id\": 8,\r\n \"name\": \"CHAMPIONS_KILLED\",\r\n \"value\": 3\r\n },\r\n {\r\n \"id\": 9,\r\n \"name\": \"GOLD_SPENT\",\r\n \"value\": 6615\r\n },\r\n {\r\n \"id\": 10,\r\n \"name\": \"TOTAL_DAMAGE_DEALT\",\r\n \"value\": 58892\r\n },\r\n {\r\n \"id\": 11,\r\n \"name\": \"TOTAL_DAMAGE_TAKEN\",\r\n \"value\": 40527\r\n },\r\n {\r\n \"id\": 25,\r\n \"name\": \"LOSE\",\r\n \"value\": 1\r\n },\r\n {\r\n \"id\": 24,\r\n \"name\": \"TEAM\",\r\n \"value\": 100\r\n },\r\n {\r\n \"id\": 89,\r\n \"name\": \"ITEM1\",\r\n \"value\": 3110\r\n },\r\n {\r\n \"id\": 88,\r\n \"name\": \"ITEM0\",\r\n \"value\": 3004\r\n },\r\n {\r\n \"id\": 31,\r\n \"name\": \"PHYSICAL_DAMAGE_DEALT_PLAYER\",\r\n \"value\": 36813\r\n },\r\n {\r\n \"id\": 91,\r\n \"name\": \"ITEM3\",\r\n \"value\": 3065\r\n },\r\n {\r\n \"id\": 30,\r\n \"name\": \"LARGEST_MULTI_KILL\",\r\n \"value\": 1\r\n },\r\n {\r\n \"id\": 90,\r\n \"name\": \"ITEM2\",\r\n \"value\": 2044\r\n },\r\n {\r\n \"id\": 102,\r\n \"name\": \"TRUE_DAMAGE_DEALT_PLAYER\",\r\n \"value\": 1528\r\n },\r\n {\r\n \"id\": 34,\r\n \"name\": \"MAGIC_DAMAGE_TAKEN\",\r\n \"value\": 15649\r\n },\r\n {\r\n \"id\": 103,\r\n \"name\": \"TRUE_DAMAGE_DEALT_TO_CHAMPIONS\",\r\n \"value\": 1528\r\n },\r\n {\r\n \"id\": 32,\r\n \"name\": \"MAGIC_DAMAGE_DEALT_PLAYER\",\r\n \"value\": 20550\r\n },\r\n {\r\n \"id\": 100,\r\n \"name\": \"PHYSICAL_DAMAGE_DEALT_TO_CHAMPIONS\",\r\n \"value\": 9274\r\n },\r\n {\r\n \"id\": 33,\r\n \"name\": \"PHYSICAL_DAMAGE_TAKEN\",\r\n \"value\": 22893\r\n },\r\n {\r\n \"id\": 101,\r\n \"name\": \"TOTAL_DAMAGE_DEALT_TO_CHAMPIONS\",\r\n \"value\": 20205\r\n },\r\n {\r\n \"id\": 99,\r\n \"name\": \"MAGIC_DAMAGE_DEALT_TO_CHAMPIONS\",\r\n \"value\": 9402\r\n },\r\n {\r\n \"id\": 97,\r\n \"name\": \"SIGHT_WARDS_BOUGHT\",\r\n \"value\": 1\r\n },\r\n {\r\n \"id\": 110,\r\n \"name\": \"ITEM6\",\r\n \"value\": 3350\r\n },\r\n {\r\n \"id\": 43,\r\n \"name\": \"TOTAL_HEAL\",\r\n \"value\": 19132\r\n },\r\n {\r\n \"id\": 40,\r\n \"name\": \"TIME_PLAYED\",\r\n \"value\": 2049\r\n },\r\n {\r\n \"id\": 109,\r\n \"name\": \"TOTAL_TIME_CROWD_CONTROL_DEALT\",\r\n \"value\": 854\r\n },\r\n {\r\n \"id\": 106,\r\n \"name\": \"WARD_PLACED\",\r\n \"value\": 7\r\n },\r\n {\r\n \"id\": 104,\r\n \"name\": \"TRUE_DAMAGE_TAKEN\",\r\n \"value\": 1984\r\n },\r\n {\r\n \"id\": 44,\r\n \"name\": \"TOTAL_UNITS_HEALED\",\r\n \"value\": 1\r\n },\r\n {\r\n \"id\": 48,\r\n \"name\": \"ASSISTS\",\r\n \"value\": 9\r\n }\r\n ]\r\n}','javascript',0),(58,'2014-02-08 19:16:31','78.102.111.158','Waritkov vyšpehoval Orlní Hnízdo\r\nOdesláno\r\ndnes 02:34:31\r\nÚtočník\r\n \r\n\r\nwaritko z Waritkov\r\n Legionář Pretorián Imperián Equites Legáti Equites Imperatoris Equites Caesaris Římské beranidlo Ohnivý katapult Senátor Osadník Hrdina\r\nJednotky 0 0 0 4 0 0 0 0 0 0 0\r\nZtráty 0 0 0 0 0 0 0 0 0 0 0\r\nSuroviny \r\nDřevo628\r\nHlína919\r\nŽelezo833\r\nObilí891\r\n \r\nÚkryt200\r\nObránce\r\n \r\n\r\nmaxa121 z Orlní Hnízdo\r\n Pálkař Oštěpař Sekerník Zvěd Rytíř Teuton jezdec Germánské beranidlo Katapult Kmenový vůdce Osadník Hrdina\r\nJednotky 0 30 15 0 0 0 0 0 0 0 0\r\nZtráty 0 0 0 0 0 0 0 0 0 0 0\r\nObránce\r\n \r\n\r\nPodpora\r\n Falanga Šermíř Slídič Theutates Blesk Druid jezdec Haeduan Dřevěné beranidlo Válečný katapult Náčelník Osadník Hrdina\r\nJednotky 97 0 0 0 25 0 0 0 0 0 1\r\nZtráty 0 0 0 0 0 0 0 0 0 0 0\r\n \r\nWaritkov\r\nLoajalita: 100%\r\n1/1\r\nVesnice\r\n \r\n\r\n Waritkov\r\n \r\n\r\nDenní úkoly\r\nDenní odměny\r\nPřehled úkolů\r\n\r\n Aukce\r\n Rezidence nebo palác 10\r\n Osadníci\r\n\r\nÚvod Fórum Odkazy FAQ - Answers VOP O nás\r\n\r\n© 2004 - 2014 Travian Games GmbH\r\nČas serveru: 16:12:51\r\n','ini',0),(59,'2014-02-27 15:04:54','147.229.176.96','/* OneMax.cc: Evolutionary solving of Queens palcement problem.\r\n *\r\n * Author(s): Jiri Jaros (jarosjir@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <vector>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 8;\r\n\r\n\r\n\r\n//------------------Fitness function for Queen problem-----------------------//\r\nfloat QueensFitness(GAGenome& g){\r\n //-- Fitness function is based on testing and counting conflicts between --//\r\n //-- paricular queens. In order to permutation encoding is used queens, --//\r\n //-- it is necessaty to test only diagonal directions --//\r\n\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n int fitness;\r\n \r\n for(int i = 0; i < dimension; i++)\r\n {\r\n for(int j = i+1; j < dimension; j++)\r\n {\r\n try\r\n {\r\n if(genome.gene(i) == genome.gene()) fitness++;\r\n }\r\n catch {} // fuck this shit...\r\n }\r\n }\r\n \r\n \r\n \r\n return fitness;\r\n} //- OneMaxFitnessFunction -//\r\n\r\n\r\n//--------------------------- Init function ----------------------------------//\r\nvoid QueensInitializer(GAGenome& g) {\r\n //-- creation of permutation chromozome --//\r\n\r\nVector<int> tmp;\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &) g;\r\n for(int i = 0; i < dimension; i++)\r\n {\r\n int num = GARandomInt(0, dimension - 1);\r\n if(std::find(tmp.begin(), tmp.end(), num)!=tmp.end())\r\n {\r\n i--; break;\r\n }\r\n tmp.push(num);\r\n genome.gene(i, num);\r\n }\r\n \r\n\r\n \r\n} //- Initializer -//\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n int i, j, x;\r\n\r\n cout << endl;\r\n for (x = 0; x < (dimension * 4) + 1; x++)\r\n cout << \"-\";\r\n cout << endl;\r\n\r\n for (j = 0; j < dimension; j++) {\r\n for (i = 0; i < dimension; i++) {\r\n cout << \"|\";\r\n if (genome.gene(i) == j)\r\n cout << \" X \";\r\n else\r\n cout << \" \";\r\n }\r\n cout << \"|\";\r\n cout << endl;\r\n for (x = 0; x < (dimension * 4) + 1; x++)\r\n cout << \"-\";\r\n cout << endl;\r\n }\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n \r\n //-- Declaration of population with genome size and Fitness function --//\r\n GA1DArrayGenome<int> genome(dimension, QueensFitness);\r\n \r\n //-- Genetic operations --//\r\n genome.initializer(::QueensInitializer);\r\n genome.mutator(GA1DArrayGenome<int>::SwapMutator); //- Fill mutator\r\n genome.crossover(GA1DArrayGenome<int>::PartialMatchCrossover); //- Fill Crossover\r\n\r\n \r\n //-- Declaration of genetic algorithm --//\r\n GASimpleGA ga(genome);\r\n \r\n// GATournamentSelector selector;\r\n// ga.selector(selector);\r\n //-- search for global maximum --//\r\n ga.minimize();\r\n \r\n //-- Parameters setting --//\r\n ga.parameters(argc,argv);\r\n \r\n //-- Start of evolution process --//\r\n ga.initialize();\r\n while(!ga.done()){\r\n ++ga; \r\n \r\n if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n << ga.population().min() <<endl;\r\n \r\n if (ga.population().min() == 0) break;\r\n }\r\n ga.flushScores();\r\n \r\n \r\n //-- Print statistics --//\r\n cout <<endl << \"Final statistics:\" << endl;\r\n cout << ga.statistics() << endl;\r\n \r\n cout << \"The best solution: \" << ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n PrintPhenotype(ga.statistics().bestIndividual());\r\n \r\n return 0;\r\n} //- main -//\r\n','cpp',0),(60,'2014-02-27 15:33:04','147.229.176.96','/* OneMax.cc: Evolutionary solving of Queens palcement problem.\r\n *\r\n * Author(s): Jiri Jaros (jarosjir@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <algorithm>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 8;\r\n\r\n\r\n\r\n//------------------Fitness function for Queen problem-----------------------//\r\nfloat QueensFitness(GAGenome& g){\r\n //-- Fitness function is based on testing and counting conflicts between --//\r\n //-- paricular queens. In order to permutation encoding is used queens, --//\r\n //-- it is necessaty to test only diagonal directions --//\r\n\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n int fitness;\r\n \r\n for(int i = 0; i < dimension; i++)\r\n {\r\n for(int j = i+1; j < dimension; j++)\r\n {\r\n if(genome.gene(j)+j+1 == genome.gene(i) || genome.gene(j)-i-1 == genome.gene(i))\r\n {\r\n fitness++;\r\n }\r\n }\r\n }\r\n \r\n \r\n \r\n return fitness;\r\n} //- OneMaxFitnessFunction -//\r\n\r\n\r\n//--------------------------- Init function ----------------------------------//\r\nvoid QueensInitializer(GAGenome& g) {\r\n //-- creation of permutation chromozome --//\r\n\r\n vector<int> tmp;\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &) g;\r\n \r\n \r\n for(int i = 0; i < dimension; i++)\r\n {\r\n int num = GARandomInt(0, dimension - 1);\r\n \r\n if(!tmp.empty() && (std::find(tmp.begin(), tmp.end(), num)!=tmp.end()))\r\n {\r\n i--; \r\n continue;\r\n }\r\n tmp.push_back(num);\r\n genome.gene(i, num);\r\n }\r\n \r\n\r\n \r\n} //- Initializer -//\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n int i, j, x;\r\n\r\n cout << endl;\r\n for (x = 0; x < (dimension * 4) + 1; x++)\r\n cout << \"-\";\r\n cout << endl;\r\n\r\n for (j = 0; j < dimension; j++) {\r\n for (i = 0; i < dimension; i++) {\r\n cout << \"|\";\r\n if (genome.gene(i) == j)\r\n cout << \" X \";\r\n else\r\n cout << \" \";\r\n }\r\n cout << \"|\";\r\n cout << endl;\r\n for (x = 0; x < (dimension * 4) + 1; x++)\r\n cout << \"-\";\r\n cout << endl;\r\n }\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n \r\n //-- Declaration of population with genome size and Fitness function --//\r\n GA1DArrayGenome<int> genome(dimension, QueensFitness);\r\n \r\n //-- Genetic operations --//\r\n genome.initializer(::QueensInitializer);\r\n genome.mutator(GA1DArrayGenome<int>::SwapMutator); //- Fill mutator\r\n genome.crossover(GA1DArrayGenome<int>::PartialMatchCrossover); //- Fill Crossover\r\n\r\n \r\n //-- Declaration of genetic algorithm --//\r\n GASimpleGA ga(genome);\r\n \r\n// GATournamentSelector selector;\r\n// ga.selector(selector);\r\n //-- search for global maximum --//\r\n ga.minimize();\r\n \r\n //-- Parameters setting --//\r\n ga.parameters(argc,argv);\r\n \r\n //-- Start of evolution process --//\r\n ga.initialize();\r\n while(!ga.done()){\r\n ++ga; \r\n \r\n if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n << ga.population().min() <<endl;\r\n \r\n if (ga.population().min() == 0) break;\r\n }\r\n ga.flushScores();\r\n \r\n \r\n //-- Print statistics --//\r\n cout <<endl << \"Final statistics:\" << endl;\r\n cout << ga.statistics() << endl;\r\n \r\n cout << \"The best solution: \" << ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n PrintPhenotype(ga.statistics().bestIndividual());\r\n \r\n return 0;\r\n} //- main -//\r\n','cpp',0),(61,'2014-02-27 16:01:10','147.229.176.96','/* OneMax.cc: Evolutionary solving of Queens palcement problem.\r\n *\r\n * Author(s): Jiri Jaros (jarosjir@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <algorithm>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 8;\r\n\r\n\r\n\r\n//------------------Fitness function for Queen problem-----------------------//\r\nfloat QueensFitness(GAGenome& g){\r\n //-- Fitness function is based on testing and counting conflicts between --//\r\n //-- paricular queens. In order to permutation encoding is used queens, --//\r\n //-- it is necessaty to test only diagonal directions --//\r\n\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n int fitness;\r\n \r\n for(int i = 0; i < dimension; i++)\r\n {\r\n for(int j = i+1; j < dimension; j++)\r\n {\r\n int left = genome.gene(i)-(j-i);\r\n int right = genome.gene(i)+(j-i);\r\n if(left >= 0 && right < dimension && (genome.gene(j) == left || genome.gene(j) == right))\r\n fitness++;\r\n }\r\n }\r\n \r\n \r\n \r\n return fitness;\r\n} //- OneMaxFitnessFunction -//\r\n\r\n\r\n//--------------------------- Init function ----------------------------------//\r\nvoid QueensInitializer(GAGenome& g) {\r\n //-- creation of permutation chromozome --//\r\n\r\n vector<int> tmp;\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &) g;\r\n \r\n \r\n for(int i = 0; i < dimension; i++)\r\n {\r\n int num = GARandomInt(0, dimension - 1);\r\n \r\n if(!tmp.empty() && (std::find(tmp.begin(), tmp.end(), num)!=tmp.end()))\r\n {\r\n i--; \r\n continue;\r\n }\r\n tmp.push_back(num);\r\n genome.gene(i, num);\r\n }\r\n \r\n\r\n \r\n} //- Initializer -//\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n GA1DArrayGenome<int> &genome = (GA1DArrayGenome<int> &)g;\r\n int i, j, x;\r\n\r\n cout << endl;\r\n for (x = 0; x < (dimension * 4) + 1; x++)\r\n cout << \"-\";\r\n cout << endl;\r\n\r\n for (j = 0; j < dimension; j++) {\r\n for (i = 0; i < dimension; i++) {\r\n cout << \"|\";\r\n if (genome.gene(i) == j)\r\n cout << \" X \";\r\n else\r\n cout << \" \";\r\n }\r\n cout << \"|\";\r\n cout << endl;\r\n for (x = 0; x < (dimension * 4) + 1; x++)\r\n cout << \"-\";\r\n cout << endl;\r\n }\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n \r\n //-- Declaration of population with genome size and Fitness function --//\r\n GA1DArrayGenome<int> genome(dimension, QueensFitness);\r\n \r\n //-- Genetic operations --//\r\n genome.initializer(::QueensInitializer);\r\n genome.mutator(GA1DArrayGenome<int>::SwapMutator); //- Fill mutator\r\n genome.crossover(GA1DArrayGenome<int>::PartialMatchCrossover); //- Fill Crossover\r\n\r\n \r\n //-- Declaration of genetic algorithm --//\r\n GASimpleGA ga(genome);\r\n \r\n// GATournamentSelector selector;\r\n// ga.selector(selector);\r\n //-- search for global maximum --//\r\n ga.minimize();\r\n \r\n //-- Parameters setting --//\r\n ga.parameters(argc,argv);\r\n \r\n //-- Start of evolution process --//\r\n ga.initialize();\r\n while(!ga.done()){\r\n ++ga; \r\n \r\n if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n << ga.population().min() <<endl;\r\n \r\n if (ga.population().min() == 0) break;\r\n }\r\n ga.flushScores();\r\n \r\n \r\n //-- Print statistics --//\r\n cout <<endl << \"Final statistics:\" << endl;\r\n cout << ga.statistics() << endl;\r\n \r\n cout << \"The best solution: \" << ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n PrintPhenotype(ga.statistics().bestIndividual());\r\n \r\n return 0;\r\n} //- main -//\r\n','cpp',0),(62,'2014-03-13 14:52:03','147.229.176.92','/* numericOptimistation.cc: Search for optimum of a numeric function.\r\n *\r\n * Author(s): Jiri Petrlik (ipetrlik@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 4; // dimension of optimised function\r\nconst int resolution=24; // number of bits per value\r\nconst double minValue=-500; // min value\r\nconst double maxValue=500; // max value\r\n\r\n\r\n//------------------Fitness function -----------------------//\r\nfloat fitness(GAGenome& g){\r\n //---------------Type your code here ---------------------//\r\n\r\n GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;\r\n\r\n double result=0;\r\n for(int i = 0; i < dimension; i++)\r\n {\r\n int tmp = 0;\r\n for(int j = 0; j < resolution; j++)\r\n {\r\n tmp = tmp << 1;\r\n tmp += genome.gene(i*resolution + j);\r\n }\r\n double dtmp = (double)tmp / (double)((1 << 24) - 1);\r\n dtmp = dtmp * (maxValue - minValue) + minValue;\r\n result = dtmp * sin(sqrt(fabs(dtmp)));\r\n }\r\n result = 418.9829 * dimension - result;\r\n \r\n\r\n return result;\r\n\r\n}\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;\r\n\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n \r\n //-- Declaration of population with genome size and Fitness function --//\r\n GA1DBinaryStringGenome genome(dimension*resolution, fitness);\r\n \r\n //-- Declaration of genetic algorithm --//\r\n GASimpleGA ga(genome);\r\n \r\n //-- search for global minimum --//\r\n ga.minimize();\r\n \r\n ga.nGenerations(10000);\r\n ga.populationSize(1000);\r\n\r\n //-- Parameters setting --//\r\n ga.parameters(argc,argv);\r\n \r\n //-- Start of evolution process --//\r\n ga.initialize();\r\n while(!ga.done()){\r\n ++ga; \r\n \r\n if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n << ga.population().min() <<endl;\r\n \r\n if (ga.population().min() == 0) break;\r\n }\r\n ga.flushScores();\r\n \r\n \r\n //-- Print statistics --//\r\n cout <<endl << \"Final statistics:\" << endl;\r\n cout << ga.statistics() << endl;\r\n \r\n cout << \"The best solution: \" << ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n PrintPhenotype(ga.statistics().bestIndividual());\r\n \r\n return 0;\r\n} //- main -//\r\n','cpp',0),(63,'2014-03-13 15:03:09','147.229.176.92','/* numericOptimistation.cc: Search for optimum of a numeric function.\r\n *\r\n * Author(s): Jiri Petrlik (ipetrlik@fit.vutbr.cz)\r\n *\r\n */\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <vector>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n//---------------------- Parameters of evolution ----------------------------//\r\nconst int dimension = 5; // dimension of optimised function\r\nconst int resolution=24; // number of bits per value\r\nconst double minValue=-500; // min value\r\nconst double maxValue=500; // max value\r\n\r\n\r\n//------------------Fitness function -----------------------//\r\nfloat fitness(GAGenome& g){\r\n //---------------Type your code here ---------------------//\r\n\r\n GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g;\r\n\r\n double result=0;\r\n for(int i = 0; i < dimension; i++)\r\n {\r\n int tmp = 0;\r\n for(int j = 0; j < resolution; j++)\r\n {\r\n tmp = tmp << 1;\r\n tmp += genome.gene(i*resolution + j);\r\n }\r\n double dtmp = (double)tmp / (double)((1 << 24) - 1);\r\n dtmp = dtmp * (maxValue - minValue) + minValue;\r\n result += dtmp * sin(sqrt(fabs(dtmp)));\r\n }\r\n result = 418.9829 * dimension - result;\r\n \r\n\r\n return result;\r\n\r\n}\r\n\r\n//--------------------------- Print phenotype function -----------------------//\r\nvoid PrintPhenotype(const GAGenome &g) {\r\n\r\n GA1DBinaryStringGenome &genome = (GA1DBinaryStringGenome &)g; \r\n \r\n for(int i = 0; i < dimension; i++)\r\n {\r\n int tmp = 0;\r\n for(int j = 0; j < resolution; j++)\r\n {\r\n tmp = tmp << 1;\r\n tmp += genome.gene(i*resolution + j);\r\n }\r\n double dtmp = (double)tmp / (double)((1 << 24) - 1);\r\n dtmp = dtmp * (maxValue - minValue) + minValue;\r\n cout << \"Gene \" << i << \": \" << dtmp << endl;\r\n }\r\n\r\n}\r\n\r\n\r\n//--------------------------- main function ----------------------------------//\r\nint main(int argc, char **argv) {\r\n \r\n //-- Declaration of population with genome size and Fitness function --//\r\n GA1DBinaryStringGenome genome(dimension*resolution, fitness);\r\n \r\n //-- Declaration of genetic algorithm --//\r\n GASimpleGA ga(genome);\r\n \r\n //-- search for global minimum --//\r\n ga.minimize();\r\n \r\n ga.nGenerations(1000);\r\n //ga.populationSize(1000);\r\n\r\n //-- Parameters setting --//\r\n ga.parameters(argc,argv);\r\n \r\n //-- Start of evolution process --//\r\n ga.initialize();\r\n while(!ga.done()){\r\n ++ga; \r\n \r\n if ((ga.statistics().generation() % ga.scoreFrequency()) == 0)\r\n cout <<\"Generation \" << ga.statistics().generation() << \" - Best fitness: \" \r\n << ga.population().min() <<endl;\r\n \r\n if (ga.population().min() == 0) break;\r\n }\r\n ga.flushScores();\r\n \r\n \r\n //-- Print statistics --//\r\n cout <<endl << \"Final statistics:\" << endl;\r\n cout << ga.statistics() << endl;\r\n \r\n cout << \"The best solution: \" << ga.statistics().bestIndividual() <<\" , Fitness = \" << ga.population().min() << endl;\r\n PrintPhenotype(ga.statistics().bestIndividual());\r\n \r\n return 0;\r\n} //- main -//\r\n','cpp',0),(64,'2014-03-19 20:16:44','199.64.72.254','První epocha\r\n============\r\n\r\n1\r\n-\r\n\r\nDortmunder se vysmrkal. „Pane správce,“ řekl, „nedovedete si představit, jak si\r\nvážím osobní péče, kterou jste mi věnoval. “S papírovým kapesníkem nemohl nic\r\ndělat, takže ho v pěsti jen sežmoulal do koule.\r\n\r\nSprávce věznice Outes se na Dortmundera uznale usmál, zvedl se za stolem, přešel\r\nk němu, poklepal ho po rameni a řekl: „Největší potěšení mi způsobují ti, které\r\nmůžu zachránit.“ Byl to typ moderního vykonavatele státní moci — energický\r\natlet, vyce-povaný na univerzitě, reformista, idealista a k tomu člověk\r\nostentativně kamarádský. Dortmunder ho nenáviděl.\r\n\r\nSprávce věznice prohlásil: „Doprovodím vás k bráně, Dortmunder. “\r\n\r\n„To nemusíte, pane správce, “ odmítl Dortmunder. Papírový kapesník ho studil a\r\nlepil se mu do dlaně.\r\n\r\n„Bude to pro mě potěšení,“ řekl správce. „Až uvidím, jak vycházíte, a pomyslím\r\nsi, že už víckrát v životě neuklouznete, že se nikdy neocitnete v těchto zdech,\r\nnemáte ponětí, jaké potěšení mi způsobí pomyšlení, že jsem se taky svou malou\r\nhřivnou podílel na vaší rehabilitaci.“\r\n\r\nDortmunder žádné potěšení nepociťoval. Střelil svou celu za tři sta dolarů —\r\noplývala totiž kohoutkem s teplou vodou a vedl z ní tunel do výdejny léčiv,\r\ntakže za tu cenu byla babku — a ty peníze měl dostat na ruku, až bude odcházet.\r\nDřív si je vzít nemohl, protože by je u něho při poslední prohlídce našli. Ale\r\njak se jich domůže, když správce bude stát zrovna vedle něho?\r\n\r\nZkusil to zahrát do autu: „Pane správce, sem do téhle kanceláře jsem za vámi\r\nvždycky chodil, tady jsem poslouchal, jak mi — “\r\n\r\n„Tak pojďte, Dortmunder,“ přerušil ho správce, „Povídat si můžeme cestou k\r\nbráně. “\r\n\r\nA tak šli k bráně spolu. Když přecházeli velký vězeňský dvůr, uviděl Dortmunder\r\npři svém posledním špacíru Creasyho, vězně důvěrníka se třemi céčky,\r\noznačujícími jeho privilegované postavení: užuž se k němu hnal, ale ten moment\r\nse zarazil. Creasy drobným gestem naznačil: Je to v kýblu.\r\n\r\nU brány správce napřáhl ruku a řekl: „Tak zlomte vaz, Dortmunder. Chtěl bych\r\ndoufat, že vás víckrát neuvidím.“ Byl to vtip, protože se zachechtal.\r\n\r\nDortmunder přendal žvanec kapesníku do leve ruky. Byl skutečně plný, měl dlaň\r\ncelou poblebtanou Stiskl správci podávanou ruku a řekl: „Taky doufám, že vás už\r\nvíckrát nespatřím, pane správce.\" To nebyl vtip, ale Dortmunder se nicméně taky\r\nzachechtal.\r\n\r\nVýraz ve správcově tváři působil náhle poněkud skelně. „Ano, “ řekl. „Ano.“\r\n\r\nDortmunder se otočil a správci sjel pohled na dlaň.\r\n\r\nVelká brána se otevřela, Dortmunder vyšel ven a brána za ním zaklapla. Byl\r\nvolný, svůj dluh společnosti splatil. Ale taky ulítl o tři kila, himlhergot. S\r\ntěma prachama počítal. Zbývá mu všehovšudy deset boulí a lístek na vlak.\r\n\r\nZhnuseně odhodil papírový kapesník na chodník.\r\n\r\nZnečišťování.\r\n\r\n2\r\n-\r\n\r\nKelp viděl, jak Dortmunder vyšel do slunečního světla a zůstal chvilku stát a\r\njen se rozhlížel. Kelp znal ten pocit, tu první minutu svobody, svobodného\r\nvzduchu, svobodného slunce. Nechtěl Dortmunderovi zkazit radost, a tak čekal,\r\nale když konečně Dortmunder vyrazil po chodníku kupředu, nastartoval Kelp motor\r\na sunul se s dlouhou černou limuzínou po vozovce pomalu za ním.\r\n\r\nVůz to byl pěkný, cadillac, po stranách záclonky, v zadním okénku žaluzie,\r\nklimatizace, technické fígle tak dokonalé, že když proti vám v noci vyjelo auto,\r\nsvětla se automaticky ztlumila, a vůbec tu byla všechna možná vylepšení, která\r\nčlověku šetří práci, Kelp vůz klofl předešlou noc v New Yorku. Chtělo se mu\r\nzajet sem spíš vozem než se tlouct vlakem, takže si vyšel v noci vybrat vůz, a\r\nnašel na Východní 67. ulici právě tenhle. Měl samozřejmě tabulku s doktorským\r\noznačením MUDr., a takové vozy Kelp vždycky hned automaticky zkoušel, protože\r\ndoktoři většinou nechávají klíčky ve voze, a lékařská profese ho opět\r\nnezklamala.\r\n\r\nSamozřejmě, že teď vůz už tabulku s doktorským MUDr. neměl. Stát přece\r\nneobětoval jen tak výdaje na čtyřletou Kelpovu výuku, aby ho nenaučil vyrábět\r\ntabulky na auta.\r\n\r\nSunul se za Dortmunderem, velká černá limuzína tiše předla, pod pneumatikami\r\nkřupala zaneřáděíiá vozovka a Kelp uvažoval, jak to Dortmundera překvapí a\r\npotěší, až uvidí právě v okamžiku, kdy vypadl na ulici, přátelskou tvář. Užuž\r\nchtěl zmáčknout klakson, ale v tom okamžiku se Dortmunder jako na obrtlíku\r\nprudce otočil, podíval se na tichou černou limuzínu se záclonkami v okénkách, v\r\nobličeji mu vyskočil panický výraz a vzápětí uháněl po chodníku jako blázen,\r\ndrže se přihrben těsně při šedé vězeňské zdi.\r\n\r\nNa kontrolním panelu u dvířek cadillaku byly čtyři knoflíky na ovládání okének.\r\nJediný háček byl v tom, že Kelp ne a ne si zapamatovat, kterým knoflíkem še\r\notvírá a zavírá které okénko. Stiskl jeden knoflík a dolů sklouzlo pravé zadní.\r\n„Dortmundere!“ zařval a šlápl na plyn, až milý cadillac po vozovce poposkočil.\r\nKolem dokola nikde nikdo, jen černá limuzína a prchající muž. Po stráně strměla\r\nve své šedivé výšce vězeňská věž a na druhé stráně ulice se táhla řada zakrslých\r\numouněných domků, tichých a jako zabedněných, s okny osleplými záclonami a\r\nzávěsy.\r\n\r\nKelp s autem šněroval po celé ulici, protože jeho pozornost rozvrátil zmatek s\r\nknoflíky na ovládání okének. Vtom dolů sjelo levé zadní a Kelp znovu zahulákal\r\nDortmunderovo jméno, ale Dortmunder ho pořád neslyšel. Kelp nahmátl další\r\nknoflík, stiskl a nahoru vyjelo pravé zadní. Cadillac nadskočil a vyhoupl se na\r\nobrubník, pneumatiky sklouzly zapleveleným prostorem mezi obrubníkem a chodníkem\r\na v tu chvíli již Kelp mířil přímo na Dortmundera, který se otočil, připlácl se\r\nzády ke zdi, rozpřáhl do široka ruce a zaječel jako strašidlo, které věstí smrt.\r\n\r\nV posledním okamžiku dupl Kelp na brzdy. Byly to brzdy s posilovačem a Kelp je\r\njedním rázem zablokoval, takže cadillac zůstal stát jako přibitý a Kelp se\r\nodrazil setrvačností od volantu.\r\n\r\nDortmunder prudce vystrčil jednu roztřesenou ruku a opřel se o vibrující kapotu\r\nvozu.\r\n\r\nKelp se pokoušel vylézt, ale v rozrušení zmáčkl zase jiný knoflík, ten, který\r\nautomaticky zavírá všechny čtyři dveře. „Zatracený doktoři!“ zařval, zmáčkl\r\nvšechny knoflíky, co kde viděl, a nakonec se vytrhl z vozu jako potápěč z obětí\r\nchobotnice.\r\n\r\nDortmunder se pořád ještě opíral o zeď, mírně předkloněn, a jednou rukou se\r\npřidržoval kapoty. Byl celý sinalý a nebyla to pouze vězeňská bledost.\r\n\r\nKelp došel k němu. „Člověče, co zdrháš?“ řekl. „To jsem já, tvůj starej kamarád,\r\nKelp.“ A napřáhl ruku.\r\n\r\nDortmunder mu jednu ubalil přímo do oka.\r\n\r\n3\r\n-\r\n\r\n„Nemusels dělat nic jinýho než troubit,“ vyčítal Dortmunder. Skučel, protože ho\r\nna ruce štípal kotník, přesně v místě, kde si ho sedřel o Kelpovu tvář, Přitiskl\r\nsi jej k ústům.\r\n\r\n„Vždyť jsem taky chtěl,“ vysvětloval Kelp,\"„jenže se to ňáko zvrtlo. Ale teď je\r\nvšecko zas fajn.“\r\n\r\nA už jeli po dálnici do New Yorku, rychlostí nařízenou na pětašedesát mil za\r\nhodinu. Kelp nemusel dělat nic jiného než držet ruku na volantu a tu a tam se\r\npodívat jestli jsou pořád ještě ve vozovce, a jinak se vůz ovládal sám.\r\n\r\nDortmunder se cítil poškozený. Tři sta doláčů v čudu, vylekaný, že by z toho\r\nmohl dostat psotník, tady ho skoro přejede nějaký blázen v cadillaku, a ještě k\r\ntomu si odře kotník, a to všechno v jednom jediném dni.\r\n\r\n„A vůbec, co chceš? “ zeptal se. „Dali mi lístek na vlak, nepotřeboval jsem, aby\r\nmě někdo vozil.“\r\n\r\n„Určitě potřebuješ ňákou fušku, “ odpověděl Kelp. „Pokuď ovšem nemáš už něco v\r\npácu.“\r\n\r\n„Nic v pácu nemám, “ odpověděl Dortmunder. A když si to zároveň uvědomil,\r\npopudilo ho to. \' „Tak abys věděl, mám pro tebe přímo přepychovej sós, “\r\nvyjádřil se Kelp. Po tváři se mu rozléval blažený úsměv.\r\n\r\nDortmunder se rozhodl, že už se nebude cítit ublížený. „No jo,“ prohlásil,\r\n„poslechnout si to můžu. Vo co kráčí?“\r\n\r\nKelp začal: „Slyšels někdy o místě, který se jmenuje Talabwo?“\r\n\r\nDortmunder svraštil čelo. „Není to nějakej ostrov v Jižním Pacifiku? “\r\n\r\n„Ale né, to je země. V Africe.“\r\n\r\n„O té jsem nikdy neslyšel,“ pravil Dortmunder. „Slyšel jsem o Kongu. “\r\n\r\n„To je blízko,“ upřesňoval Kelp. „Aspoň myslím. „V těchhle zemích to musí bejt\r\nvo hubu, co? Myslím jako vedro.“\r\n\r\n„Hm, to víš, asi jo,“ souhlasil Kelp. „Nevím. Nikdy jsem tam nebyl.“\r\n\r\n„Myslím, že tam by se mi dvakrát nechtělo“ řekl Dortmunder. „Mají tam taky\r\nnemoce. A hodně zabíjejí bělochy.“\r\n\r\n„Jenom jeptišky,\" podotkl Kelp. „Ale nejde o kšeft tam, jde o něco rovnou tady,\r\nv starejch zlatejch Státech.“\r\n\r\n„Á.“ Dortmunder si olízl kotník a pak řekl: „Tak proč mi vykládáš o tom druhým\r\nmístě?“\r\n\r\n','cuesheet',0),(65,'2014-03-27 15:04:52','147.229.176.90','/* GP.cc: Program tries to approximate simple numerical function - params from command line.\r\n*\r\n* Author(s): Petr Pospichal (ipospichal@fit.vutbr.cz)\r\n*\r\n*/\r\n\r\n#include <stdio.h>\r\n#include <iostream>\r\n#include <string>\r\n#include <ga/ga.h>\r\n#include <math.h>\r\n#include <stack>\r\n#include <vector>\r\n//#include <limits.h>\r\n\r\n\r\n\r\nusing namespace std;\r\n\r\n\r\n#define VARIABLE 0\r\n#define CONSTANT 1\r\n#define UNARY_OPERATOR 2\r\n#define BINARY_OPERATOR 3\r\n\r\n\r\nstruct GPTreeItem_T {\r\n short type;\r\n string name;\r\n float const_value;\r\n float (*unaryfunc)(float);\r\n float (*binaryfunc)(float,float);\r\n};\r\n\r\n#define TREE_ITEM_VARIABLE(name) { VARIABLE, name, 0.0, NULL, NULL }\r\n#define TREE_ITEM_CONSTANT(name,value) { CONSTANT, name, value, NULL, NULL }\r\n#define TREE_ITEM_UNARY_OPERATOR(name,ptr) { UNARY_OPERATOR, name, 0.0, ptr, NULL }\r\n#define TREE_ITEM_BINARY_OPERATOR(name,ptr) { BINARY_OPERATOR, name, 0.0, NULL, ptr }\r\n\r\nfloat Plus(float a, float b) { return a+b; }\r\nfloat Minus(float a, float b) { return a-b; }\r\nfloat Multiplication(float a, float b) { return a*b; }\r\nfloat Division(float a, float b) { return a/b; }\r\n\r\n\r\nconst GPTreeItem_T TreeItems[] = {\r\n TREE_ITEM_VARIABLE(\"x\"),\r\n TREE_ITEM_CONSTANT(\"-1.0\",-1.0),\r\n TREE_ITEM_CONSTANT(\"1.0\",1.0),\r\n TREE_ITEM_BINARY_OPERATOR(\"+\",Plus),\r\n TREE_ITEM_BINARY_OPERATOR(\"-\",Minus),\r\n TREE_ITEM_BINARY_OPERATOR(\"*\",Multiplication),\r\n TREE_ITEM_BINARY_OPERATOR(\"/\",Division)\r\n};\r\n\r\nconst unsigned int TreeItemsCount = (sizeof TreeItems)/(sizeof TreeItems[0]);\r\n\r\n\r\n#define CROSSOVER_MOD 0.8\r\n#define MUTATION_MOD 1.2\r\n#define GENERATIONS_MOD 100\r\n#define CHROM_LEN_PENALIZATION 2\r\n//#define CHROM_LEN_PENALIZATION 0.1\r\n//#define CHROM_LEN_PENALIZATION 10\r\n\r\n#define NO_SCALING\r\n//#define SCALING_LINEAR\r\n//#define SCALING_SIGMA\r\n\r\n//#define GOAL_FUNC1\r\n//#define GOAL_FUNC2\r\n//#define GOAL_FUNC3\r\n#define GOAL_FUNC4\r\n\r\n\r\n#define DEBUG_POPULATION\r\n\r\nconst int MAX_DEPTH = 3; // max random tree depth param\r\n\r\n\r\n#ifdef GOAL_FUNC1\r\n// x\r\n #define GOAL_STRING \"x\"\r\nconst float GoalFunc[][2] = {\r\n {0.0 , 0.0},\r\n {1.0 , 1.0},\r\n {2.0 , 2.0},\r\n {3.0 , 3.0},\r\n {4.0 , 4.0}\r\n};\r\n#endif\r\n\r\n#ifdef GOAL_FUNC2\r\n// x^2+1\r\n #define GOAL_STRING \"x^2 + 1\"\r\nconst float GoalFunc[][2] = {\r\n {0.0 , 1.0},\r\n {1.0 , 2.0},\r\n {2.0 , 5.0},\r\n {3.0 , 10.0},\r\n {4.0 , 17.0}\r\n};\r\n#endif\r\n\r\n#ifdef GOAL_FUNC3\r\n// x^2+x+1\r\n #define GOAL_STRING \"x^2 + x + 1\"\r\nconst float GoalFunc[][2] = {\r\n {0.0 , 1.0},\r\n {1.0 , 3.0},\r\n {2.0 , 7.0},\r\n {3.0 , 13.0},\r\n {4.0 , 21.0}\r\n};\r\n#endif\r\n\r\n#ifdef GOAL_FUNC4\r\n// TODO find function for these points\r\n #define GOAL_STRING \"to be found\"\r\nconst float GoalFunc[][2] = {\r\n {0.0 , 1.0},\r\n {1.0 , 5.0},\r\n {2.0 , 31.0},\r\n {3.0 , 121.0},\r\n {4.0 , 341.0}\r\n};\r\n#endif\r\n\r\n\r\n\r\nclass GaMyTreeIter : public GATreeIterBASE {\r\npublic:\r\n GaMyTreeIter(const GATreeBASE & t) : GATreeIterBASE(t) {} // just call parent constructor\r\n\r\n GANodeBASE* getRootNode()\r\n { return this->node; } // this allows us to get to root node pointer so we can traverse tree easily\r\n \r\n};\r\n\r\n\r\n\r\n// The objective function is declared here and defined below.\r\nfloat objective(GAGenome &);\r\n\r\n// This is the declaration for the initialization operator for our trees.\r\nvoid TreeInitializer(GAGenome &);\r\n\r\n// This is a recursive function that will be used in the \'write\' method for \r\n// our tree genomes.\r\nvoid WriteNode(ostream & os, GANode<int> * n);\r\n\r\nvoid PreorderWalk( GANode<int> * n, void function(GANodeBASE * node), void* params );\r\nvoid PostoderWalk( GANode<int> * n, void function(GANodeBASE * node, void* params), void* params );\r\n\r\nstring GetNodeName(int n) { return TreeItems[n].name; }\r\n\r\nint GetTreeItemType(int n) { return TreeItems[n].type; }\r\n\r\nvoid PrintNodeType(GANodeBASE * node, void* params) { cout << GetNodeName(((GANode<int> *)node)->contents) << \" \"; }\r\n\r\n\r\nint\r\nmain(int argc, char *argv[])\r\n{\r\n \r\n //cout << GoalFunc[1][1] << endl;\r\n //cout << TreeItems[0].name << endl;\r\n cout.flush();\r\n \r\n // See if we\'ve been given a seed to use (for testing purposes). When you\r\n // specify a random seed, the evolution will be exactly the same each time\r\n // you use that seed number.\r\n \r\n unsigned int seed = 0;\r\n for(int i=1; i<argc; i++) {\r\n if(strcmp(argv[i++],\"seed\") == 0) {\r\n //seed = atoi(argv[i]);\r\n GARandomSeed(atoi(argv[i]));\r\n }\r\n }\r\n \r\n // Set the default values of the parameters.\r\n\r\n const int popsize=10; // this param is used twice\r\n\r\n GAParameterList params;\r\n GASimpleGA::registerDefaultParameters(params);\r\n params.set(gaNpopulationSize, popsize);\r\n params.set(gaNpCrossover, CROSSOVER_MOD);\r\n params.set(gaNpMutation, MUTATION_MOD);\r\n params.set(gaNnGenerations, GENERATIONS_MOD);\r\n params.set(gaNelitism,true);\r\n //params.set(gaNnBestGenomes,10);\r\n //params.set(gaNminimaxi,true);\r\n //params.set(gaNminimaxi,true);\r\n //params.set(gaNscoreFilename, \"bog.dat\");\r\n //params.set(gaNscoreFrequency, 1); // record score every 10th generation\r\n //params.set(gaNflushFrequency, 10); // dump scores every 10th recorded score\r\n //params.parse(argc, argv, gaFalse); // Parse the command line for GAlib args.\r\n\r\n GATreeGenome<int> genome(objective),genome2(objective);\r\n genome.initializer(TreeInitializer);\r\n genome.mutator(GATreeGenome<int>::SwapSubtreeMutator);\r\n genome.crossover(GATreeGenome<int>::OnePointCrossover); \r\n \r\n GASimpleGA ga(genome); \r\n ga.parameters(params);\r\n #ifdef NO_SCALING\r\n GANoScaling scale;\r\n #endif\r\n #ifdef SCALING_LINEAR\r\n GALinearScaling scale;\r\n #endif\r\n #ifdef SCALING_SIGMA\r\n GASigmaTruncationScaling scale;\r\n #endif\r\n\r\n ga.scaling(scale);\r\n ga.minimize();\r\n ga.initialize();\r\n int gen=0;\r\n while(!ga.done())\r\n {\r\n gen++;\r\n #ifdef DEBUG_POPULATION\r\n //cout << \"============== generation \" << gen << endl << \"--- new objective evaluations\" << endl;\r\n #endif\r\n ga.step(); // do one generation of the evolution\r\n #ifdef DEBUG_POPULATION\r\n //cout << \"--- current population\" << endl;\r\n for (int i=0; i<popsize;i++)\r\n {\r\n //cout << i << \" (\" << ga.population().individual(i).fitness() << \"): \" << ga.population().individual(i);\r\n }\r\n\r\n genome2=ga.statistics().bestIndividual();\r\n //cout << \"--- best\" << endl;\r\n float objvalue = ::objective(genome2);\r\n //cout << \" (\" << objvalue << \", \" << genome2.fitness() << \"):\" << ga.statistics().bestIndividual() << endl;\r\n #endif\r\n }\r\n\r\n genome2 = ga.statistics().bestIndividual();\r\n cout << \"=================\" << endl << \"The GA generated this tree (sould be \" << GOAL_STRING << \")\\n\" << genome2;\r\n cout << \"objective: \" << genome2.score() << \" fitness:\" << genome2.fitness() << \", \" << genome2.size() << \" nodes, \" << genome2.depth() << \" levels deep.\\n\\n\";\r\n cout << \"==============\" << endl;\r\n cout << genome2.score() - CHROM_LEN_PENALIZATION * genome2.size() << endl;\r\n cout << \"==============\" << endl;\r\n\r\n //cout << ga.statistics() << endl;\r\n \r\n \r\n return 0;\r\n}\r\n\r\n/* ----------------------------------------------------------------------------\r\n\r\n This function is calculating intermetiate results of the tree interpretation. It uses stack to store operands, inputs and outputs. \r\n\r\n*/\r\n\r\nvoid calculateResult(GANodeBASE * node, void* params)\r\n{\r\n //cout << \"calculateResult \" << endl;\r\n vector<float>* stack = (std::vector<float>*)params; // stack is passed using void*\r\n float x=stack->at(0); // value of x is stored on the first position\r\n\r\n int treeitemindex=((GANode<int> *)node)->contents; // get value of tree item (node), use it to index constant array of tree elements\r\n int type=GetTreeItemType(treeitemindex); // get note type\r\n float op1,op2,result=0.0;\r\n switch(type)\r\n {\r\n // do operation depending on note type\r\n case BINARY_OPERATOR: //cout << \"binary\" << endl; \r\n op1=stack->back();stack->pop_back(); // binary operator -> use two operands from stack\r\n op2=stack->back();stack->pop_back();\r\n result=TreeItems[treeitemindex].binaryfunc(op1,op2); // ... calculate result\r\n stack->push_back(result); // and put it back on the stack\r\n break;\r\n case UNARY_OPERATOR: //cout << \"unary\" << endl; \r\n op1=stack->back();stack->pop_back();\r\n result=TreeItems[treeitemindex].unaryfunc(op1);\r\n stack->push_back(result);\r\n break;\r\n case CONSTANT: //cout << \"constant\" << endl; \r\n stack->push_back(TreeItems[treeitemindex].const_value); // push constant to stack\r\n break;\r\n case VARIABLE: //cout << \"variable\" << endl; \r\n stack->push_back(x); // push x value to stack\r\n break;\r\n default:\r\n cout<< \"error no operator defined\" << endl; exit(0);\r\n break; \r\n }\r\n\r\n}\r\n\r\n\r\n\r\n/*----------------------------------------------------------------------------\r\n\r\n Objective function of getting \"fitness\" of tree chromosome. Compares values of GoalFunc on defined x points with interpreted tree chromosome. Fitness is defined as sum of all differences between goal function and interpreted tree plus possible penalization for longer chromosomes. \r\n\r\n*/\r\n\r\nfloat objective(GAGenome & t){\r\n GATreeGenome<int> & tree= (GATreeGenome<int> &)t;\r\n\r\n vector<float> stack; // stack for storing elements and intermediate results as we walk the tree\r\n\r\n GaMyTreeIter *iterator = new GaMyTreeIter(tree); \r\n GANodeBASE * nod = iterator->getRootNode(); // root node pointer used as traversal start point\r\n \r\n\r\n int GoalFuncPoints = sizeof(GoalFunc)/sizeof(GoalFunc[0]);\r\n float objective=0.0;\r\n \r\n // for each point of the goal function, interpret the tree\r\n // could be optimized - how?\r\n for(int point=0;point<GoalFuncPoints;point++)\r\n {\r\n stack.clear(); \r\n float x=GoalFunc[point][0];\r\n float reference=GoalFunc[point][1];\r\n float result=0.0;\r\n\r\n stack.push_back(x); // use stack for sending x-value to calculation function\r\n //cout << \"point \" << point << \" x \" << reference << \" \" << endl;\r\n\r\n // call tree traversal with calculateResult func, which interpretes the tree for defined x value\r\n PostoderWalk((GANode<int> *)nod, calculateResult, static_cast<void*>(& stack) );\r\n\r\n // get result value from stack after interpretation\r\n result=stack.back();\r\n if(stack.size()!=2) // stack should contain only x-value and result, otherwise traversal was incorrect (possibly damaged or not initialized tree)\r\n {\r\n cout << \" error interpreting expression, incorrect derivation tree \" << endl; exit(1);\r\n }\r\n\r\n //cout << \" size: \" << stack.size() << endl;\r\n //cout << \" reference: \" << reference << \" result:\" << result << endl;\r\n objective+=fabs(reference-result); // get sum of difference beween goal func and interpreted result\r\n }\r\n\r\n if(isnan(objective) || isinf(objective)) objective=1e5; // get rid of NaN and Inf results (division by zero)\r\n objective+=tree.size()*CHROM_LEN_PENALIZATION; // possibly penalize longer chromosomes\r\n\r\n #ifdef DEBUG_POPULATION \r\n cout << \" (\" << objective << \"): \" << tree;\r\n #endif \r\n\r\n return objective; \r\n}\r\n\r\n\r\n\r\n\r\n// Initializer for tree chromosomes to maximum depth of MAX_DEPTH constant. Ensures that trees are traversable, eg. binary operator has 2 children, unary only one etc.\r\nvoid \r\nMakeRandomTreeNode(GATreeGenome<int> &tree, int depth, bool after)\r\n{\r\n int randomitem=GARandomInt(0,TreeItemsCount-1);\r\n //GPTreeItem_T randomitem=TreeItems[randomitemnum];\r\n short randomitemtype=TreeItems[randomitem].type;\r\n \r\n // if we reached maximum depth, create only terminals\r\n if(depth>=MAX_DEPTH)\r\n {\r\n // not entirely optimal :)\r\n while(randomitemtype!=CONSTANT && randomitemtype!=VARIABLE)\r\n {\r\n randomitem=GARandomInt(0,TreeItemsCount-1);\r\n //randomitem=TreeItems[randomitemnum];\r\n randomitemtype=TreeItems[randomitem].type;\r\n }\r\n // cout << \" depth, below \" << GetNodeName(randomitem) << endl;\r\n tree.insert(randomitem,GATreeBASE::BELOW);\r\n return;\r\n }\r\n \r\n // insert side-by-side or below current node?\r\n if(after)\r\n {\r\n tree.insert(randomitem,GATreeBASE::AFTER);\r\n } else {\r\n tree.insert(randomitem,GATreeBASE::BELOW);\r\n }\r\n \r\n // constants and variables do not have children\r\n if(randomitemtype==CONSTANT || randomitemtype==VARIABLE)\r\n { \r\n return;\r\n } else if(randomitemtype==UNARY_OPERATOR)\r\n { // unary operator has one children\r\n MakeRandomTreeNode(tree, depth+1, false);\r\n } else if(randomitemtype==BINARY_OPERATOR)\r\n { // binary has two children\r\n //cout << \" binary operator \" << endl;\r\n MakeRandomTreeNode(tree, depth+1, false);\r\n tree.parent(); // move the iterator up one level\r\n MakeRandomTreeNode(tree, depth+1, false);\r\n } else {\r\n cout << \"MakeRandomTreeNode error, unknown operator number :\" << randomitemtype;\r\n }\r\n \r\n tree.parent(); // up one level\r\n}\r\n\r\n\r\n\r\n\r\n/* ----------------------------------------------------------------------------\r\nHere is the initializer for our genomes. It builds a tree of n items of type\r\nint. Notice that we first destroy any tree that is already in the genome \r\nbefore we do our initialization. This is so that the genomes can be re-used.\r\nWhen you re-run a GA, it does not destroy the individuals in the population - \r\nit reuses them. Thus, the initializer must make sure that the genome is \r\ncleaned up before it tries to initialize it.\r\n---------------------------------------------------------------------------- */\r\nvoid\r\nTreeInitializer(GAGenome & c)\r\n{\r\n GATreeGenome<int> &child=(GATreeGenome<int> &)c;\r\n \r\n // destroy any pre-existing tree\r\n child.root();\r\n child.destroy();\r\n\r\n // make random tree\r\n MakeRandomTreeNode(child,0,false);\r\n}\r\n\r\n\r\n// just for inspiration\r\nvoid \r\nPreorderWalk( GANode<int> * n, void function(GANodeBASE * node, void* params), void* params )\r\n{\r\n if(!n) return;\r\n GANodeBASE * node = (GANodeBASE *)n;\r\n \r\n //cout << GetNodeName(((GANode<GPTreeItem_T> *)node)->contents) << \" \";\r\n //cout << GetNodeName(((GANode<int> *)node)->contents) << \" aaa\" << endl;\r\n function(node,params);\r\n \r\n PreorderWalk((GANode<int> *)node->child, function, params);\r\n \r\n for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){\r\n //cout << GetNodeName(((GANode<GPTreeItem_T> *)tmp)->contents) << \" \";\r\n function(tmp,params);\r\n PreorderWalk((GANode<int> *)tmp->child, function, params);\r\n }\r\n}\r\n\r\n\r\n// Function for walking the tree genome. Results in calling \"function\" in reverse-polish-notation order on nodes\r\nvoid \r\nPostoderWalk( GANode<int> * n, void function(GANodeBASE * node, void* params), void* params )\r\n{\r\n\r\n if(!n) return;\r\n GANodeBASE * node = (GANodeBASE *)n;\r\n //cout << \"PostorderWalk: \" << n << endl; \r\n //cout << GetNodeName(((GANode<int> *)node)->contents) << \" aaa\" << endl;\r\n \r\n PostoderWalk((GANode<int> *)node->child, function, params);\r\n\r\n for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){\r\n //cout << GetNodeName(((GANode<GPTreeItem_T> *)tmp)->contents) << \" \";\r\n PostoderWalk((GANode<int> *)tmp->child, function, params);\r\n function(tmp,params);\r\n }\r\n\r\n function(node,params); \r\n \r\n}\r\n\r\n\r\n\r\n/* ----------------------------------------------------------------------------\r\nTree genome method overrides\r\n-------------------------------------------------------------------------------\r\nHere we override the built-in methods for the tree class. We can do this\r\nbecause the tree class is template-ized - when the compiler looks for an\r\ninstance of the tree class methods, it finds these so it won\'t generate an\r\ninstance from the templates. You can do this with ANY method of a template\r\nclass. Here we do it only for the write method.\r\nThe default write operator prints out po //TreeItemsCount\r\ninters to the contents of each node.\r\nHere we print out the actual contents of each node. This assumes that the \r\nobject in our node has the operator<< defined for it.\r\n---------------------------------------------------------------------------- */\r\nvoid \r\nWriteNode(ostream & os, GANode<int> * n)\r\n{\r\n if(!n) return;\r\n GANodeBASE * node = (GANodeBASE *)n;\r\n os.width(10);\r\n os << (((GANode<int> *)node)) << \" \";\r\n os.width(10);\r\n os << GetNodeName(((GANode<int> *)node)->contents) << \" \";\r\n //os << GetNodeName((*(GANode<int> *)node)) << \" \";\r\n os.width(10); \r\n if(node->parent) os << ((GANode<int> *)node->parent) << \" \";\r\n else os << \"_\" << \" \";\r\n os.width(10); \r\n if(node->child) os << ((GANode<int> *)node->child) << \" \";\r\n else os << \"_\" << \" \";\r\n os.width(10);\r\n if(node->next) os << (((GANode<int> *)node->next)) << \" \";\r\n else os << \"_\" << \" \";\r\n os.width(10);\r\n if(node->prev) os << (((GANode<int> *)node->prev)) << \"\\n\";\r\n else os << \".\\n\";\r\n WriteNode(os, (GANode<int> *)node->child);\r\n \r\n for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){\r\n os.width(10);\r\n os << (((GANode<int> *)tmp)) << \" \";\r\n os.width(10);\r\n os << GetNodeName(((GANode<int> *)tmp)->contents) << \" \";\r\n //os << GetNodeName(((GANode<int> *)tmp)) << \" \";\r\n os.width(10);\r\n if(tmp->parent) os << (((GANode<int> *)tmp->parent)) << \" \";\r\n else os << \"_\" << \" \";\r\n os.width(10); \r\n if(tmp->child) os << (((GANode<int> *)tmp->child)) << \" \";\r\n else os << \"_\" << \" \";\r\n os.width(10); \r\n if(tmp->next) os << (((GANode<int> *)tmp->next)) << \" \";\r\n else os << \"_\" << \" \";\r\n os.width(10); \r\n if(tmp->prev) os << (((GANode<int> *)tmp->prev)) << \"\\n\";\r\n else os << \".\\n\";\r\n WriteNode(os, (GANode<int> *)tmp->child);\r\n }\r\n}\r\n\r\n\r\n// function for printing out the phenotype to screen\r\ntemplate<> int\r\nGATreeGenome<int>::write(ostream & os) const\r\n{\r\n //os << \" ptr type parent child next prev\\n\";\r\n //WriteNode(os, (GANode<int> *)rt);\r\n //PreorderWalk((GANode<int> *)rt, PrintNodeType, 0);\r\n PostoderWalk((GANode<int> *)rt, PrintNodeType, 0);\r\n cout << endl;\r\n return os.fail() ? 1 : 0;\r\n}\r\n\r\n\r\n\r\n// force instantiations for compilers that do not do auto instantiation\r\n// for some compilers (e.g. metrowerks) this must come after any\r\n// specializations or you will get \'multiply-defined errors when you compile.\r\n#if !defined(GALIB_USE_AUTO_INST)\r\n#include <ga/GATree.C>\r\n#include <ga/GATreeGenome.C>\r\nGALIB_INSTANTIATION_PREFIX GATreeGenome<int>;\r\nGALIB_INSTANTIATION_PREFIX GATree<int>;\r\n#endif\r\n','cpp',0),(66,'2014-05-13 15:17:11','127.0.0.1','http://www.narodnikvalifikace.cz/kvalifikace-571-Administrator_projektu/revize-619/kvalifikacni-standard','csharp',0),(67,'2014-06-19 08:07:01','199.64.72.254','using System;\r\nusing System.Collections.Generic;\r\nusing System.Data;\r\nusing System.Linq;\r\nusing Honeywell.MBEMEA.Common;\r\nusing Honeywell.MBEMEA.Common.Data;\r\nusing Honeywell.MBEMEA.Common.EventArgs;\r\nusing Honeywell.MBEMEA.Common.Interfaces;\r\nusing Honeywell.MBEMEA.CommServer.Contract;\r\n\r\nnamespace Honeywell.MBEMEA.CommServer.WCF.Services\r\n{\r\n /// <summary>\r\n /// Class used for reading PanelEventLogData rows\r\n /// </summary>\r\n public class EventLogDataReader\r\n {\r\n private readonly IEnumerable<DataRow> _selectedRows;\r\n private int _position;\r\n private readonly bool _isInitialized;\r\n private readonly DataTable _table;\r\n private DateTime _lastAccess = DateTime.Now;\r\n private readonly int _maxLen = int.MaxValue;\r\n private readonly CommServerDataSet _dataSet;\r\n\r\n public bool IsInitialized\r\n {\r\n get\r\n {\r\n return _isInitialized;\r\n }\r\n }\r\n\r\n public DateTime LastAccess\r\n {\r\n get\r\n {\r\n return _lastAccess;\r\n }\r\n }\r\n\r\n private static string GetStandardDateTimeString(DateTime value)\r\n {\r\n return String.Format(\"{0:0000}-{1:00}-{2:00} 00:00:00\", value.Year, value.Month, value.Day);\r\n }\r\n\r\n /// <summary>\r\n /// Constructor for initializing reader with data set instance and required panel GUID\r\n /// </summary>\r\n /// <param name=\"dataService\">Instance of DataService class to perform eventlog reading on</param>\r\n /// <param name=\"panelId\">GUID of panel for which to read events</param>\r\n /// <param name=\"args\">Arguments of eventlog retrieval</param>\r\n public EventLogDataReader(IDataService dataService, Guid panelId, GetLogDataEventArgs args)\r\n {\r\n // Get the CommServerDataSet instance reference\r\n var dataManager = ServiceLocator.GetService<IDataAccess>();\r\n if(dataManager != null)\r\n {\r\n _dataSet = dataManager.DataSet;\r\n }\r\n\r\n if(args == null)\r\n {\r\n args = new GetLogDataEventArgs(0, 0); // Unlimited args\r\n }\r\n\r\n Guid panelEventLogId = Guid.Empty;\r\n var panelRow = _dataSet.Panel.FindByID(panelId);\r\n if(panelRow != null)\r\n {\r\n CommServerDataSet.PanelEventLogRow[] eventLogRows = panelRow.GetPanelEventLogRows();\r\n if(eventLogRows != null && eventLogRows.Length > 0)\r\n {\r\n panelEventLogId = eventLogRows[0].ID;\r\n }\r\n \r\n }\r\n if(panelEventLogId != Guid.Empty)\r\n {\r\n _position = 0;\r\n string filter = \"\";\r\n if(args.EntryCnt != 0 || args.StartPosition != 0)\r\n {\r\n _position = args.StartPosition;\r\n _maxLen = args.EntryCnt != 0 ? args.EntryCnt : 1000; // If entryCnt is zero, assume thousand\r\n _maxLen += _position;\r\n }\r\n if(args.StartTime != args.StopTime)\r\n {\r\n filter = String.Format(\" AND EventTimestamp >= \'{0}\' AND EventTimestamp <= \'{1}\'\", GetStandardDateTimeString(args.StartTime), GetStandardDateTimeString(args.StopTime));\r\n }\r\n _table = dataService.GetDataTableWithFilter(_dataSet.PanelEventLogData.TableName, String.Format(\"PanelEventLogID=\'{0}\'{1}\", panelEventLogId, filter));\r\n _selectedRows = from p in _table.AsEnumerable() orderby p[\"EventUID\"] descending select p;\r\n _isInitialized = true;\r\n }\r\n }\r\n\r\n /// <summary>\r\n /// Method for reading specified number of rows from reader\r\n /// </summary>\r\n /// <param name=\"numRows\">Number of rows to get</param>\r\n /// <returns>Specified number of rows or null if none left</returns>\r\n public DataRow[] GetDataRows(int numRows)\r\n {\r\n _lastAccess = DateTime.Now;\r\n if (_position < _maxLen)\r\n {\r\n if(numRows > _maxLen - _position)\r\n {\r\n numRows = _maxLen - _position;\r\n }\r\n var retValue = _selectedRows.Skip(_position).Take(numRows);\r\n DataRow[] materialized = retValue.ToArray();\r\n if (materialized.Length > 0)\r\n {\r\n _position += materialized.Length;\r\n return materialized;\r\n }\r\n }\r\n return null;\r\n }\r\n }\r\n}\r\n','csharp',0),(68,'2014-06-19 08:09:08','199.64.72.254','using System;\r\nusing System.Collections;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Diagnostics;\r\nusing System.Threading;\r\nusing DevExpress.XtraEditors;\r\nusing DevExpress.XtraGrid.Views.Grid;\r\nusing Honeywell.MBEMEA.CommServer.Contract;\r\nusing Honeywell.MBEMEA.ConfigApp.CustomControls;\r\nusing Honeywell.MBEMEA.ConfigApp.Data;\r\nusing Honeywell.MBEMEA.ConfigApp.Logic;\r\nusing Honeywell.MBEMEA.ConfigApp.RelationEditors;\r\nusing Honeywell.MBEMEA.ConfigApp.Wizards;\r\n\r\n\r\nnamespace Honeywell.MBEMEA.ConfigApp.Views.Hardware.HardwareTreeDetails.HardwareDevices.Assignments\r\n{\r\n [ToolboxItem(true)]\r\n public partial class RFMasterAssignDevices : XtraUserControl, ICustomEditor\r\n {\r\n private List<long> configuredMSBs = new List<long>();\r\n private Dictionary<uint, string> controllers = new Dictionary<uint, string>();\r\n private Dictionary<uint, InternalDataSet.HWBus2WirelessMasterRow> controllerRows = new Dictionary<uint, InternalDataSet.HWBus2WirelessMasterRow>();\r\n private Queue<ResultRFScanResults> installationModeResultQueue = new Queue<ResultRFScanResults>(128);\r\n private BackgroundWorker bwProcessDevices = new BackgroundWorker();\r\n\r\n public RFMasterAssignDevices()\r\n {\r\n InitializeComponent();\r\n gridMasters.CellValueChanging += gridMasters_CellValueChanging;\r\n InstallationMode.OnRFScanResult += InstallationMode_OnRFScanResult;\r\n bwProcessDevices.DoWork += bwProcessDevices_DoWork;\r\n }\r\n\r\n void bwProcessDevices_DoWork(object sender, DoWorkEventArgs e)\r\n {\r\n while (InstallationMode.Active || installationModeResultQueue.Count > 0)\r\n {\r\n // Retrieve one result from queue and process it\r\n if (installationModeResultQueue.Count > 0)\r\n {\r\n ResultRFScanResults result;\r\n lock (installationModeResultQueue)\r\n {\r\n result = installationModeResultQueue.Dequeue();\r\n }\r\n if (InvokeRequired)\r\n {\r\n Invoke(new Action(() => FillDetectedDevice(result)));\r\n }\r\n else\r\n {\r\n FillDetectedDevice(result);\r\n }\r\n }\r\n else\r\n {\r\n Thread.Sleep(100);\r\n }\r\n }\r\n }\r\n\r\n void InstallationMode_OnRFScanResult(object sender, ServiceReferences.CommServiceClient.RFScanEventArgs e)\r\n {\r\n lock (installationModeResultQueue)\r\n {\r\n installationModeResultQueue.Enqueue(e.CmdArgs);\r\n }\r\n // If background worker is not running, start it\r\n if (!bwProcessDevices.IsBusy)\r\n {\r\n bwProcessDevices.RunWorkerAsync();\r\n }\r\n }\r\n\r\n /// <summary>\r\n /// Fills all detected devices into grid. Devices which had been added are displayed on the right side.\r\n /// </summary>\r\n /// <param name=\"device\">Device to be inserted into detected grid</param>\r\n private void FillDetectedDevice(ResultRFScanResults device)\r\n {\r\n // Find all configured devices\r\n List<InternalDataSet.HardwareDeviceRow> hwRowList = CreateHWRowList();\r\n\r\n // TODO: Can I expect that the event data is always consistent?\r\n\r\n // Ignore panic buttons\r\n if (device.HWType == \"ccBus2WirelessPanicButton\") return;\r\n long MSB = Convert.ToInt64(device.Msb, 16);\r\n PanelDataType dataType;\r\n try\r\n {\r\n dataType = (PanelDataType) Enum.Parse(typeof (PanelDataType), device.HWType);\r\n }\r\n catch\r\n {\r\n return;\r\n }\r\n\r\n //finds device type in catalogue (to display correct device type name)\r\n string filter = String.Format(\"{0} = \'{1}\'\",\r\n InternalDataStore.DataSet.CatalogueData.GCPTypeColumn.ColumnName,\r\n dataType);\r\n InternalDataSet.CatalogueDataRow catalogueRow = null;\r\n DataRow[] rows = InternalDataStore.DataSet.CatalogueData.Select(filter);\r\n if (rows.Length > 0)\r\n {\r\n catalogueRow = rows[0] as InternalDataSet.CatalogueDataRow;\r\n }\r\n else\r\n {\r\n //unknown device can not be added into configuration\r\n Debug.Fail(String.Format(\"Unknown device type \'{0}\' found!\", device.HWType));\r\n return;\r\n }\r\n //dataRow.Valid = true;\r\n\r\n // Try to get the device row and apropriate RF master row\r\n AssignmentHelperDataSet.WirelessDevicesRow deviceRow = assignHelperDataSet.WirelessDevices.FindByMSB(MSB);\r\n AssignmentHelperDataSet.WirelessDeviceMastersRow masterRow =\r\n assignHelperDataSet.WirelessDeviceMasters.FindByMasterUIDDeviceMSB(device.ControllerID, MSB);\r\n\r\n // Create new device if doesn\'t exist else just set existing device to detected\r\n if (deviceRow == null)\r\n {\r\n deviceRow = assignHelperDataSet.WirelessDevices.NewWirelessDevicesRow();\r\n deviceRow.Detected = true;\r\n deviceRow.MSB = MSB;\r\n deviceRow.UID = 0;\r\n deviceRow.InternalDataType = catalogueRow.GCPType;\r\n deviceRow.Name = catalogueRow.CatalogName;\r\n assignHelperDataSet.WirelessDevices.AddWirelessDevicesRow(deviceRow);\r\n }\r\n else\r\n {\r\n deviceRow.Detected = true;\r\n }\r\n\r\n // Create new RF master row is doesn\'t exist\r\n if (masterRow == null)\r\n {\r\n masterRow = assignHelperDataSet.WirelessDeviceMasters.NewWirelessDeviceMastersRow();\r\n masterRow.DeviceMSB = MSB;\r\n masterRow.MasterName = controllers[device.ControllerID];\r\n masterRow.MasterUID = device.ControllerID;\r\n masterRow.Selected = false;\r\n assignHelperDataSet.WirelessDeviceMasters.AddWirelessDeviceMastersRow(masterRow);\r\n }\r\n // Set assigned master name\r\n else\r\n {\r\n if (masterRow.IsConfigured == true)\r\n {\r\n deviceRow.AssignedMasterName = masterRow.MasterName;\r\n }\r\n else if (deviceRow.IsAssignedMasterNameNull())\r\n {\r\n string devFilter = String.Format(\"DeviceMSB=\'{0}\' AND IsConfigured=True\", MSB);\r\n DataRow[] masters = assignHelperDataSet.WirelessDeviceMasters.Select(devFilter);\r\n if (masters != null && masters.Length > 0)\r\n {\r\n var confMasterRow = masters[0] as AssignmentHelperDataSet.WirelessDeviceMastersRow;\r\n deviceRow.AssignedMasterName = confMasterRow.MasterName;\r\n }\r\n }\r\n }\r\n\r\n //finds device with the same MSB and controller\r\n InternalDataSet.HardwareDeviceRow hwRow = FindHWDevice(hwRowList, dataType, MSB);\r\n if (hwRow != null)\r\n {\r\n //device is already contained in configuration (user probably has added it into configuration)\r\n deviceRow.UID = hwRow.UID;\r\n deviceRow.Name = hwRow.Name;\r\n\r\n hwRowList.Remove(hwRow);\r\n configuredMSBs.Add(MSB);\r\n foreach (var rfMasterRow in controllerRows)\r\n {\r\n if (rfMasterRow.Value.UID == hwRow.ParentDeviceUID)\r\n {\r\n AssignmentHelperDataSet.WirelessDeviceMastersRow currentMasterRow =\r\n assignHelperDataSet.WirelessDeviceMasters.FindByMasterUIDDeviceMSB(rfMasterRow.Key, MSB);\r\n // If actual master isn\'t detected yet, add it with default (no) signal strength\r\n if (currentMasterRow == null)\r\n {\r\n currentMasterRow = assignHelperDataSet.WirelessDeviceMasters.NewWirelessDeviceMastersRow();\r\n currentMasterRow.MasterUID = rfMasterRow.Key;\r\n currentMasterRow.DeviceMSB = MSB;\r\n assignHelperDataSet.WirelessDeviceMasters.AddWirelessDeviceMastersRow(currentMasterRow);\r\n }\r\n currentMasterRow.MasterName = rfMasterRow.Value.HardwareDeviceRow.Name;\r\n currentMasterRow.Selected = true;\r\n currentMasterRow.IsConfigured = true;\r\n deviceRow.IsConfigured = true;\r\n }\r\n }\r\n }\r\n\r\n if (device.WaveBand == 0)\r\n {\r\n masterRow.Signal0 = GetRSSILevel(device.RSSI, device.RSSIActual);\r\n }\r\n if (device.WaveBand == 1)\r\n {\r\n masterRow.Signal1 = GetRSSILevel(device.RSSI, device.RSSIActual);\r\n }\r\n }\r\n\r\n void gridMasters_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)\r\n {\r\n if(e.Column.FieldName == \"Selected\")\r\n {\r\n var nSender = sender as DevExpress.XtraGrid.Views.Grid.GridView;\r\n nSender.UpdateCurrentRow();\r\n \r\n AssignmentHelperDataSet.WirelessDeviceMastersRow dr = nSender.GetDataRow(e.RowHandle) as AssignmentHelperDataSet.WirelessDeviceMastersRow;\r\n if (dr != null)\r\n {\r\n if ((bool)e.Value == true)\r\n {\r\n // If selected one master, deselect the others\r\n var otherMasters = assignHelperDataSet.WirelessDeviceMasters.Where(p => p.DeviceMSB == dr.DeviceMSB);\r\n foreach (var otherMaster in otherMasters)\r\n {\r\n if (otherMaster.MasterUID != dr.MasterUID)\r\n {\r\n otherMaster.Selected = false;\r\n }\r\n else\r\n {\r\n otherMaster.Selected = true;\r\n otherMaster.WirelessDevicesRow.AssignedMasterName = otherMaster.MasterName;\r\n }\r\n }\r\n gridControl1.RefreshDataSource();\r\n gridMasters.RefreshData();\r\n }\r\n else\r\n {\r\n var allMasters = assignHelperDataSet.WirelessDeviceMasters.Where(p => p.DeviceMSB == dr.DeviceMSB);\r\n dr.WirelessDevicesRow.AssignedMasterName = \"\";\r\n foreach (var otherMaster in allMasters)\r\n {\r\n otherMaster.Selected = false;\r\n }\r\n }\r\n }\r\n nSender.CloseEditor();\r\n }\r\n }\r\n\r\n /// <summary>\r\n /// Empty method, required by ICustomEditor interface\r\n /// </summary>\r\n public void Initialize()\r\n {\r\n }\r\n\r\n public void BuildAdditionalData(DataRow row)\r\n {\r\n }\r\n\r\n public void SaveAdditionalData(DataRow row)\r\n {\r\n ConfigureSelectedDevices();\r\n }\r\n\r\n /// <summary>\r\n /// Checks if user did any change\r\n /// </summary>\r\n public bool AdditionalDataChanged\r\n {\r\n get\r\n {\r\n bool dataChanged = false;\r\n foreach (var row in assignHelperDataSet.WirelessDeviceMasters)\r\n {\r\n // Selected but not detected device\r\n if (row.Selected && !row.WirelessDevicesRow.Detected)\r\n continue;\r\n // Selected and not configured devices\r\n if (row.Selected != row.IsConfigured)\r\n {\r\n dataChanged = true;\r\n // Selected but not sufficient signal strength\r\n if (row.Selected && (row.IsSignal0Null() || row.IsSignal1Null() || row.Signal0 == 0 || row.Signal1 == 0))\r\n continue;\r\n }\r\n }\r\n return dataChanged;\r\n }\r\n }\r\n\r\n /// <summary>\r\n /// Helper method for reading bus address\r\n /// </summary>\r\n /// <param name=\"row\">hardware device</param>\r\n /// <returns>device bus address</returns>\r\n public string GetMSB(DataRow row)\r\n {\r\n DataRow childRow = GenericTableOperations.FindChildRow(row, \"MSB\");\r\n if (childRow != null)\r\n {\r\n if (childRow[\"MSB\"] is string)\r\n {\r\n return childRow[\"MSB\"].ToString().Trim();\r\n }\r\n }\r\n return \"\";\r\n }\r\n\r\n /// <summary>\r\n /// Finds hwdevice with defined type, bus address and parent\r\n /// </summary>\r\n /// <param name=\"deviceType\"></param>\r\n /// <param name=\"deviceAddress\"></param>\r\n /// <param name=\"parentUID\"></param>\r\n /// <returns></returns>\r\n public InternalDataSet.HardwareDeviceRow FindHWDevice(PanelDataType deviceType, string deviceAddress, uint parentUID)\r\n {\r\n string filter = String.Format(\"{0} = \'{1}\' AND {2} = \'{3}\'\",\r\n \"MSB\", parentUID.ToString(),\r\n InternalDataStore.DataSet.HardwareDevice.TypeColumn.ColumnName, deviceType, deviceType.ToString());\r\n\r\n foreach (InternalDataSet.HardwareDeviceRow hwRow in InternalDataStore.DataSet.HardwareDevice.Select(filter))\r\n {\r\n string ad = GetMSB(hwRow);\r\n if (ad == deviceAddress)\r\n {\r\n return hwRow;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n /// <summary>\r\n /// Finds hwdevices on parent\r\n /// </summary>\r\n /// <param name=\"parentUID\"></param>\r\n /// <returns></returns>\r\n public InternalDataSet.HardwareDeviceRow[] FindHWDevices(uint parentUID)\r\n {\r\n string filter = String.Format(\"{0} = \'{1}\'\",\r\n InternalDataStore.DataSet.HardwareDevice.ParentDeviceUIDColumn.ColumnName, parentUID.ToString());\r\n\r\n return InternalDataStore.DataSet.HardwareDevice.Select(filter) as InternalDataSet.HardwareDeviceRow[];\r\n }\r\n\r\n /// <summary>\r\n /// Adds Wireless Controller row into helper dictionary\r\n /// </summary>\r\n /// <param name=\"UID\">LDUID of controller</param>\r\n /// <param name=\"row\">Hardware device row of controller</param>\r\n public void AddController(uint UID, InternalDataSet.HWBus2WirelessMasterRow row)\r\n {\r\n if (!controllers.ContainsKey(UID))\r\n {\r\n controllers.Add(UID, row.HardwareDeviceRow.Name);\r\n controllerRows.Add(UID, row);\r\n }\r\n else \r\n { \r\n // Update name if changed\r\n controllers[UID] = row.HardwareDeviceRow.Name;\r\n }\r\n }\r\n\r\n public void ClearControllers()\r\n {\r\n controllers.Clear();\r\n controllerRows.Clear();\r\n }\r\n\r\n /// <summary>\r\n /// Clears all data from prevoius detections\r\n /// </summary>\r\n public void ClearDevices()\r\n {\r\n // Clear the internal data\r\n assignHelperDataSet.Clear();\r\n configuredMSBs.Clear();\r\n // And fill in the configured devices\r\n FillUndetectedDevices();\r\n }\r\n\r\n /// <summary>\r\n /// Converts RSSI levels from panel values to displayable signal strength\r\n /// </summary>\r\n /// <param name=\"calValue\">Calibration value of signal</param>\r\n /// <param name=\"actValue\">Actual value of signal</param>\r\n /// <returns>Integer from 0 to 3 according to signal strength</returns>\r\n private int GetRSSILevel(int calValue, int actValue)\r\n {\r\n int maxValue = 63;\r\n if (calValue >= actValue) return 0;\r\n if (actValue >= calValue + (maxValue - calValue) * 0.8) return 3;\r\n if (actValue >= calValue + (maxValue - calValue) * 0.4) return 2;\r\n return 1;\r\n }\r\n\r\n /// <summary>\r\n /// Creates a list of all devices assigned to wireless masters\r\n /// </summary>\r\n /// <returns>List of all wireless devices</returns>\r\n private List<InternalDataSet.HardwareDeviceRow> CreateHWRowList()\r\n {\r\n List<InternalDataSet.HardwareDeviceRow> hwRowList = new List<InternalDataSet.HardwareDeviceRow>();\r\n foreach (DataRow ctrlUID in controllerRows.Values)\r\n {\r\n InternalDataSet.HWBus2WirelessMasterRow ctrlRow = ctrlUID as InternalDataSet.HWBus2WirelessMasterRow;\r\n if (ctrlRow != null)\r\n {\r\n InternalDataSet.HardwareDeviceRow[] hwRows = FindHWDevices(ctrlRow.UID);\r\n foreach (InternalDataSet.HardwareDeviceRow hr in hwRows)\r\n {\r\n if (!configuredMSBs.Contains(Int64.Parse(GetMSB(hr).Trim())))\r\n {\r\n hwRowList.Add(hr);\r\n }\r\n }\r\n }\r\n }\r\n return hwRowList;\r\n }\r\n\r\n /// <summary>\r\n /// Fills the internal dataset with configured devices\r\n /// </summary>\r\n public void FillUndetectedDevices()\r\n {\r\n // Find all configured devices\r\n List<InternalDataSet.HardwareDeviceRow> hwRowList = CreateHWRowList();\r\n foreach (InternalDataSet.HardwareDeviceRow item in hwRowList)\r\n {\r\n //creates new datarow in helper table\r\n string helpFilter = String.Format(\"UID = {0}\", item.UID);\r\n if (assignHelperDataSet.WirelessDevices.Select(helpFilter).Length > 0) continue;\r\n\r\n AssignmentHelperDataSet.WirelessDevicesRow dataRow = assignHelperDataSet.WirelessDevices.NewWirelessDevicesRow();\r\n // Only add them if they have a valid(not 0) msb\r\n Int64 msbVal;\r\n Int64.TryParse(GetMSB(item), out msbVal);\r\n if (msbVal != 0)\r\n {\r\n dataRow.UID = item.UID;\r\n dataRow.Detected = false;\r\n dataRow.Name = item.Name;\r\n dataRow.MSB = msbVal;\r\n dataRow.InternalDataType = item.Type;\r\n dataRow.IsConfigured = true;\r\n\r\n AssignmentHelperDataSet.WirelessDeviceMastersRow masterRow = assignHelperDataSet.WirelessDeviceMasters.NewWirelessDeviceMastersRow();\r\n foreach (var control in controllerRows)\r\n {\r\n if (control.Value.UID == item.ParentDeviceUID)\r\n {\r\n masterRow.MasterUID = control.Key;\r\n masterRow.MasterName = control.Value.HardwareDeviceRow.Name;\r\n }\r\n }\r\n masterRow.DeviceMSB = dataRow.MSB;\r\n masterRow.IsConfigured = true;\r\n masterRow.Selected = true;\r\n dataRow.AssignedMasterName = masterRow.MasterName;\r\n\r\n assignHelperDataSet.WirelessDevices.AddWirelessDevicesRow(dataRow);\r\n assignHelperDataSet.WirelessDeviceMasters.AddWirelessDeviceMastersRow(masterRow);\r\n }\r\n }\r\n }\r\n\r\n private InternalDataSet.HardwareDeviceRow FindHWDevice(List<InternalDataSet.HardwareDeviceRow> hwRowList, PanelDataType dataType, long MSB)\r\n {\r\n foreach (InternalDataSet.HardwareDeviceRow item in hwRowList)\r\n {\r\n if (GetMSB(item) == MSB.ToString() && item.Type == dataType.ToString())\r\n {\r\n return item;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private InternalDataSet.HardwareDeviceRow FindHWRow(uint deviceUID)\r\n {\r\n InternalDataSet.HardwareDeviceRow deviceRow = InternalDataStore.DataSet.HardwareDevice.FindByUID(deviceUID);\r\n return deviceRow;\r\n }\r\n\r\n protected void ConfigureSelectedDevices()\r\n {\r\n List<long> deletedDataList = new List<long>();\r\n\r\n // prepare free adresses\r\n Dictionary<uint, List<int>> availableAdresses = new Dictionary<uint, List<int>>();\r\n //Set start address and max address count from device catalogue\r\n int startAddress = 1;\r\n int addressCount = 16;\r\n // Check for valid address range for given wireless master\r\n var busMasterCat = InternalDataStore.DataSet.CatalogueData.FindByGCPType(\"ccBus2WirelessMaster\");\r\n if(busMasterCat != null)\r\n {\r\n startAddress = busMasterCat.StartAddress;\r\n addressCount = busMasterCat.MaxPeripherals;\r\n }\r\n // Fill the free address lists\r\n foreach (var mr in controllerRows.Values)\r\n {\r\n var detected = FindHWDevices(mr.UID);\r\n availableAdresses.Add(mr.UID, new List<int>());\r\n for (int i = startAddress; i <= addressCount + startAddress; i++)\r\n {\r\n availableAdresses[mr.UID].Add(i);\r\n }\r\n foreach (var dev in detected)\r\n {\r\n availableAdresses[mr.UID].Remove(dev.Address);\r\n }\r\n }\r\n\r\n foreach (var processedDevice in assignHelperDataSet.WirelessDevices)\r\n {\r\n var mastersToProcess = assignHelperDataSet.WirelessDeviceMasters.Where(p => p.DeviceMSB == processedDevice.MSB);\r\n foreach (var processedMaster in mastersToProcess)\r\n {\r\n if (processedMaster.Selected && processedMaster.IsConfigured == false)\r\n {\r\n var controller = controllerRows[processedMaster.MasterUID];\r\n InternalDataSet.HardwareDeviceRow hwRow = FindHWRow(processedDevice.UID);\r\n if (hwRow == null || processedDevice.UID == 0)\r\n {\r\n List<int> busAddress = new List<int>();\r\n // Check, if there is empty address for the device\r\n if (availableAdresses[controller.UID].Count > 0)\r\n {\r\n // If there is, use first available\r\n int currAddr = availableAdresses[controller.UID][0];\r\n availableAdresses[controller.UID].RemoveAt(0);\r\n busAddress.Add(currAddr);\r\n }\r\n else\r\n {\r\n // else show error message that device cannot be inserted\r\n XtraMessageBox.Show(\r\n String.Format(Properties.Resources.CannotAddMoreWirelessDevices,\r\n processedMaster.MasterName), Properties.Resources.CannotAddMoreWirelessDevicesCaption);\r\n break;\r\n }\r\n try\r\n {\r\n int numDevices = AddDeviceWizard.InsertDevices(controller.HardwareDeviceRow, processedDevice.InternalDataType, busAddress.Count, busAddress);\r\n if (AddDeviceWizard.LastCreatedDevice != null)\r\n {\r\n processedDevice.Name = AddDeviceWizard.LastCreatedDevice.Name;\r\n DataRow deviceRow = null;\r\n DataRow[] tmp = AddDeviceWizard.LastCreatedDevice.GetHWBus2Wireless4IOModuleRows();\r\n if (tmp.Length > 0)\r\n deviceRow = tmp[0];\r\n tmp = AddDeviceWizard.LastCreatedDevice.GetHWBus2WirelessSmokeDetectorRows();\r\n if (tmp.Length > 0)\r\n deviceRow = tmp[0];\r\n tmp = AddDeviceWizard.LastCreatedDevice.GetHWBus2WirelessViewguardRows();\r\n if (tmp.Length > 0)\r\n deviceRow = tmp[0];\r\n tmp = AddDeviceWizard.LastCreatedDevice.GetHWBus2WirelessPanicButtonRows();\r\n if (tmp.Length > 0)\r\n deviceRow = tmp[0];\r\n tmp = AddDeviceWizard.LastCreatedDevice.GetHWBus2WirelessContactRows();\r\n if (tmp.Length > 0)\r\n deviceRow = tmp[0];\r\n if (deviceRow != null)\r\n deviceRow[\"MSB\"] = processedDevice.MSB;\r\n else\r\n continue;\r\n if (processedDevice.UID == 0)\r\n {\r\n processedDevice.UID = AddDeviceWizard.LastCreatedDevice.UID;\r\n }\r\n }\r\n if (numDevices > 0)\r\n {\r\n processedMaster.IsConfigured = true;\r\n processedDevice.IsConfigured = true;\r\n processedDevice.AssignedMasterName = processedMaster.MasterName;\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n Debug.Fail(String.Format(\"AddDeviceWizard.InsertDevices method raised exception {0}: {1}\", e.GetType(), e.Message));\r\n }\r\n }\r\n else\r\n {\r\n Debug.Fail(String.Format(\"Device {0}:{1} can not be added into configuration because UID is already occupied\", processedDevice.UID, processedDevice.InternalDataType));\r\n }\r\n }\r\n else if (processedMaster.Selected == false && processedMaster.IsConfigured == true)\r\n {\r\n\r\n try\r\n {\r\n GenericDataOperations.RemoveData(InternalDataType.HardwareDevice, new uint[1] { processedDevice.UID });\r\n deletedDataList.Add(processedDevice.MSB);\r\n }\r\n catch (Exception e)\r\n {\r\n Debug.Fail(String.Format(\"GenericDataOperations.RemoveData method raised exception {0}: {1}\", e.GetType(), e.Message));\r\n }\r\n }\r\n }\r\n }\r\n foreach (long msb in deletedDataList)\r\n {\r\n var deletedRow = assignHelperDataSet.WirelessDevices.FindByMSB(msb);\r\n if(deletedRow != null)\r\n {\r\n deletedRow.Delete();\r\n }\r\n }\r\n assignHelperDataSet.AcceptChanges();\r\n }\r\n\r\n public void RevertChanges()\r\n {\r\n var rowsToProcess = assignHelperDataSet.WirelessDeviceMasters.Where(p => p.Selected != p.IsConfigured);\r\n foreach (var row in rowsToProcess)\r\n {\r\n row.Selected = row.IsConfigured;\r\n }\r\n }\r\n\r\n #region auto expand detail\r\n private void OnGridViewInitNewRow(object sender, InitNewRowEventArgs e)\r\n {\r\n }\r\n\r\n private void OnGridViewRowCountChanged(object sender, EventArgs e)\r\n {\r\n BeginInvoke(new ExpandNewRowDelegate(ExpandNewRow), new object[] { sender });\r\n }\r\n\r\n private void ExpandNewRow(GridView view)\r\n {\r\n view.MasterRowExpanded += new CustomMasterRowEventHandler(OnGridViewMasterRowExpanded);\r\n view.SetMasterRowExpanded(view.GetRowHandle(((IList)view.DataSource).Count - 1), true);\r\n }\r\n\r\n private delegate void ExpandNewRowDelegate(GridView view);\r\n\r\n private void OnGridViewMasterRowExpanded(object sender, CustomMasterRowEventArgs e)\r\n {\r\n GridView view = (GridView)sender;\r\n view.MasterRowExpanded -= OnGridViewMasterRowExpanded;\r\n GridView childView = (GridView)view.GetDetailView(e.RowHandle, e.RelationIndex);\r\n //childView.AddNewRow();\r\n BeginInvoke(new FocusNewRowDelegate(FocusNewRow), new object[] { childView });\r\n }\r\n\r\n private void FocusNewRow(GridView childView)\r\n {\r\n gridControl1.FocusedView = childView;\r\n childView.ShowEditor();\r\n }\r\n\r\n private delegate void FocusNewRowDelegate(GridView view);\r\n #endregion\r\n\r\n\r\n }\r\n}\r\n','csharp',0),(69,'2014-06-24 09:28:01','199.64.72.254','using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Configuration;\r\nusing System.ServiceModel;\r\nusing System.ServiceModel.Description;\r\n\r\nnamespace ServerWcfHost\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n Uri address = new Uri(ConfigurationManager.AppSettings[\"address\"]);\r\n\r\n try\r\n {\r\n // Create the ServiceHost.\r\n using(ServiceHost host = new ServiceHost(typeof(ChatService), address))\r\n {\r\n // Close the ServiceHost.\r\n host.Open();\r\n\r\n Console.WriteLine(\"The service is ready at {0}\", address);\r\n Console.WriteLine(\"Press <Enter> to stop the service.\");\r\n Console.ReadLine();\r\n\r\n // Close the ServiceHost.\r\n host.Close();\r\n }\r\n }\r\n catch (Exception ex)\r\n { \r\n Console.WriteLine(\"Error: {0}\", ex.Message);\r\n }\r\n }\r\n }\r\n}\r\n','csharp',0),(70,'2014-09-01 17:22:50','194.228.13.12','using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace question1\r\n{\r\n class Program\r\n {\r\n /// <summary>\r\n /// Removes duplicate entries from sorted array of integers\r\n /// </summary>\r\n /// <param name=\"values\">Input sorted array of integers</param>\r\n /// <returns>Sorted array of integers without duplicate entries</returns>\r\n public int[] removeDuplicates(int[] values)\r\n {\r\n // First, check, if there is valid array and contains at least one member\r\n if (values == null || values.Length < 1) return null;\r\n\r\n int nullVal = values[0] - 1; // set this to be smaller than first member of array\r\n int lastVal = nullVal; // Initialize lastVal with invalid value\r\n int uniqueCount = 0;\r\n\r\n // Simply just go over the array and since it is sorted, just ommit the members, that are equal to previous one\r\n for(int i = 0; i < values.Length; i++)\r\n {\r\n if (values[i] != lastVal)\r\n {\r\n uniqueCount++;\r\n }\r\n else\r\n {\r\n values[i] = nullVal;\r\n }\r\n lastVal = values[i];\r\n }\r\n\r\n // Create output array in needed length\r\n int[] retValue = new int[uniqueCount];\r\n\r\n // Copy the unique ( != nullValue) elements to output array\r\n int outIdx = 0;\r\n for (int i = 0; i < values.Length; i++)\r\n {\r\n if (values[i] != nullVal)\r\n {\r\n retValue[outIdx] = values[i];\r\n outIdx++; // I could write retValue[idx++] ... but this is easier read\r\n }\r\n }\r\n return retValue;\r\n }\r\n // Answers to questions:\r\n // 1) Yes, the code is written as production, if needed to respect the limitations (no dynamic structures such as List<int>)\r\n // 2) No assumptions beyond C# typechecking, if given parameter is either null or empty array, I return back null value\r\n // 3) Number of unique items in array\r\n // 4) I think yes, since the array is already sorted, i can just go over it and compare current element with previous one\r\n // 5) It has linear complexity (O(n)) since I traverse the array fixed number of times (2x)\r\n\r\n\r\n\r\n\r\n /// <summary>\r\n /// Approximates square root of a number with given precision\r\n /// </summary>\r\n /// <param name=\"a\">Number to approximate square root from</param>\r\n /// <param name=\"epsilon\">How precisely to approximate (absolute value of retVal^2-a must be less than epsilon)</param>\r\n /// <returns>Approximated square root of a</returns>\r\n public double square_root(double a, double epsilon)\r\n {\r\n double x = a/3; // Divide number with quite random value to get the approximation started\r\n double lastX;\r\n\r\n // Approximation loop\r\n while (Math.Abs(x*x - a) > epsilon)\r\n {\r\n lastX = x;\r\n x = ((a/x) + lastX) / 2;\r\n }\r\n return x;\r\n }\r\n // Answers to questions:\r\n // 1) \r\n // 2) It will return zero, as abs(0-0) == 0\r\n // 3) 1.4142137800472\r\n }\r\n}\r\n','csharp',0),(71,'2014-09-02 18:25:54','194.228.13.12','if (oSession.PathAndQuery == \"/rpc/gameplay/collectItemsOrGlyphsFromPortal\" || oSession.PathAndQuery == \"/rpc/gameplay/collectItemsFromPortalWithGlyphResponse\") {\r\n oSession.utilDecodeResponse();\r\n FiddlerIngressHackForward.Forward.ForwardBytes(oSession.responseBodyBytes);\r\n FiddlerIngressHackForward.Forward.ForwardUrl(oSession.responseBodyBytes, \"https://hackhistory.varak.net/hack\");\r\n }\r\n if (oSession.PathAndQuery == \"/rpc/playerUndecorated/getPaginatedPlexts\") {\r\n oSession.utilDecodeResponse();\r\n FiddlerIngressHackForward.Forward.ForwardPlext(oSession.responseBodyBytes);\r\n }\r\n if (oSession.PathAndQuery == \"/handshake\") {\r\n oSession.utilDecodeResponse();\r\n FiddlerIngressHackForward.Forward.ForwardUrl(oSession.responseBodyBytes, \"https://broot.varak.net/handshake.php\");\r\n }\r\n if(oSession.host == \"m-dot-betaspike.appspot.com\")\r\n {\r\n FiddlerIngressHackForward.DataCounter.AddRequest(oSession.responseBodyBytes.Length + oSession.requestBodyBytes.Length);\r\n }','javascript',0),(73,'2014-10-10 07:08:03','80.188.29.62','package com.netledger.app.accounting.transactions.time;\r\n\r\nimport com.netledger.app.accounting.transactions.timeentryapproval;\r\nimport com.netledger.app.common.records.SSEmployee;\r\nimport com.netledger.app.common.records.SSInvoice;\r\nimport com.netledger.app.common.records.SSServiceItem;\r\nimport com.netledger.app.common.records.SSTimesheet;\r\nimport com.netledger.common.exceptions.NLUserError;\r\nimport com.netledger.common.passport.NLRoleConstants;\r\nimport com.netledger.common.translation.NLTranslationContext;\r\nimport com.netledger.common.translation.context.NLErrormessageContext;\r\nimport com.netledger.core.record.NLRecordObject;\r\nimport com.netledger.core.session.NLPermission;\r\nimport com.netledger.core.session.NLRole;\r\nimport com.netledger.core.session.NLSession;\r\nimport com.netledger.test.TestDataParameters;\r\nimport com.netledger.test.properties.NLProductArea;\r\nimport com.netledger.test.properties.NLTestClassProperties;\r\nimport com.netledger.test.properties.NLTestReleaseRequirement;\r\nimport com.netledger.util.lang.NLStringUtil;\r\nimport org.junit.Test;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.HashMap;\r\nimport java.util.LinkedList;\r\nimport java.util.List;\r\nimport java.util.Map;\r\n\r\n/**\r\n * Description: Various tests approving TimeEntries and downstream actions on approved timeentries\r\n *\r\n * <p>Copyright © 2000-2009, NetSuite, Inc.</p>\r\n *\r\n * @author pkandula\r\n * @version 2012.2\r\n * @since 4/8/13\r\n */\r\n@NLTestClassProperties(productArea = NLProductArea.ERP_PSA, ownerEmail = \"Scrum-NSPSA@netsuite.com\", release = NLTestReleaseRequirement.MAJOR)\r\npublic class NLTimeentryApprovalTest extends NLTimesheetTestUtils\r\n{\r\n public NLTimeentryApprovalTest()\r\n {\r\n }\r\n\r\n @Test\r\n public void testStatusWithoutTimeentries() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createBlankTimesheet(timeSheetParameters);\r\n log(\"timesheet created: \" + timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.OPEN);\r\n nlapiDeleteRecord(SSTimesheet.TYPE, timeSheetKey);\r\n }\r\n\r\n //should expect exceptions.NLUserError: Invalid timesheet date range\r\n @Test\r\n public void testNoStartDate() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n timeSheetParameters.remove(SSTimesheet.enddate);\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n\r\n try\r\n {\r\n createBlankTimesheet(timeSheetParameters);\r\n fail(\"No exception has been thrown\");\r\n }\r\n catch (Exception e)\r\n {\r\n if (!e.getMessage().equals(\"Invalid timesheet date range: Timesheets must be seven days long.\"))\r\n {\r\n fail(\"Unexpected exception has been thrown: \" + e.getMessage());\r\n }\r\n }\r\n }\r\n\r\n //enddate will be filled and timesheet created\r\n @Test\r\n public void testNoEndDate() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createBlankTimesheet(timeSheetParameters);\r\n log(\"timesheet created: \" + timeSheetKey);\r\n\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n assertEquals(timeSheetParameters.get(SSTimesheet.startdate), timeSheet.getFieldValue(SSTimesheet.startdate));\r\n nlapiDeleteRecord(SSTimesheet.TYPE, timeSheetKey);\r\n }\r\n\r\n //should expect exceptions.NLUserError: Invalid timesheet date range\r\n @Test\r\n public void testMidWeekStartDate() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n timeSheetParameters.put(SSTimesheet.startdate, \"4/9/2013\");\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n\r\n try\r\n {\r\n createBlankTimesheet(timeSheetParameters);\r\n fail(\"No exception has been thrown\");\r\n }\r\n catch (Exception e)\r\n {\r\n if (!e.getMessage().equals(\"Invalid timesheet date range: Timesheets must be seven days long.\"))\r\n {\r\n fail(\"Unexpected exception has been thrown: \" + e.getMessage());\r\n }\r\n }\r\n }\r\n\r\n @Test\r\n //submit timesheet with seven time entries.\r\n //verify timesheet status is pending.\r\n //verify that we see seven time entries in time entry approval page.\r\n //reject all time entries\r\n //verify that we see zero time entries in the time entry approval page.\r\n //verify timesheet status is rejected.\r\n //verify timeenties status is rejected.\r\n public void testTimesheetAllRejected() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n updateTimeentryIds(nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true), timeEntries);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n rejectTimeentries(tea, timeEntries);\r\n\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, new LinkedList<TimeEntryData>());\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n\r\n //Verify the Approval Status for Timesheet after submission is Pending approval\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.REJECTED);\r\n verifyTimeentries(timeSheet, timeEntries, NLTimelineApprovalStatusEnum.REJECTED);\r\n }\r\n\r\n @Test\r\n //delete timeentry and verify that deletion is persisted by reloading timesheet and checking for the timeentry.\r\n public void testRemoveTimeentry() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n System.out.println(\"TS Key: \" + timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.OPEN);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n String id = timeEntries.get(0).id;\r\n //delete the first time entry from timesheet.\r\n deleteTimeEntry(timeSheetKey, id);\r\n\r\n //submit the timesheet so that we can verify number of time entries for this timesheet.\r\n submitTimesheet(timeSheetKey);\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n //delete the first time entry from the list of time entries\r\n timeEntries.remove(0);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n }\r\n\r\n private void deleteTimeEntry(String timeSheetKey, String timeEntryKey) throws Exception\r\n {\r\n NLSession nl = getNLSession();\r\n NLRecordObject timeSheetRecord = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n NLRecordObject timeEntryRecord = null;\r\n int numLines = timeSheetRecord.getLineItemCount(SSTimesheet.TimeGrid.LIST);\r\n for (int line = 1; (line <= numLines) && (timeEntryRecord == null); line++)\r\n {\r\n timeSheetRecord.selectLineItem(SSTimesheet.TimeGrid.LIST, line);\r\n for (int day = 0; day < 7; day++)\r\n {\r\n String timeEntryField = NLDayOfWeek.getDayOfWeek(nl, day).getFieldName();\r\n timeEntryRecord = timeSheetRecord.editCurrentLineItemSubrecord(SSTimesheet.TimeGrid.LIST, timeEntryField);\r\n if ((timeEntryRecord != null) && (timeEntryKey.equals(timeEntryRecord.getFieldValue(\"id\"))))\r\n {\r\n timeSheetRecord.removeCurrentLineItemSubrecord(SSTimesheet.TimeGrid.LIST, timeEntryField);\r\n break;\r\n }\r\n else\r\n {\r\n timeEntryRecord = null;\r\n }\r\n }\r\n }\r\n\r\n timeSheetRecord.commitLineItem(SSTimesheet.TimeGrid.LIST);\r\n nlapiSubmitRecord(timeSheetRecord);\r\n }\r\n\r\n @Test\r\n //approve timeentry using suitescript instead of asyc request.\r\n public void testApproveTimeentry() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n System.out.println(\"TS Key: \" + timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n TimeEntryData timeEntryToApprove = findTimeEntry(timeEntries, timeEntries.get(0).id);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, Arrays.asList(new TimeEntryData[]{timeEntryToApprove}));\r\n\r\n //submit the timesheet so that we can verify number of time entries for this timesheet.\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n //delete the first time entry from the list of time entries\r\n timeEntries.remove(0);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n }\r\n\r\n private TimeEntryData findTimeEntry(List<TimeEntryData> timeEntries, String id)\r\n {\r\n for (TimeEntryData timeEntryData : timeEntries)\r\n {\r\n if (timeEntryData.id == id)\r\n {\r\n return timeEntryData;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n @Test\r\n //BUS-688\r\n //edit timeentry and verify that the values are persisted by reloading timesheet and checking the new values.\r\n public void testEditTimeentry() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.OPEN);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n String id = timeEntries.get(0).id;\r\n Map<String, String> newValues = new HashMap<String, String>();\r\n newValues.put(\"hours\", \"9:00\");\r\n newValues.put(\"memo\", \"PK test memo\");\r\n testTimesheetEdit(timeSheetKey, id, newValues, true, null);\r\n }\r\n @Test\r\n //BUS-688\r\n //Submit timeentry and try to edit it. Get NLUserError because timeentry status is pending.\r\n public void testEditSubmittedTimeentry() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n String id = timeEntries.get(0).id;\r\n Map<String, String> newValues = new HashMap<String, String>();\r\n newValues.put(\"hours\", \"9:00\");\r\n newValues.put(\"memo\", \"PK test memo\");\r\n\r\n testTimesheetEdit(timeSheetKey, id, newValues, false, \"Time entry is pending approval and cannot be edited.\");\r\n\r\n // But should be able to edit the timesheet as Administrator\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRole.ADMINISTRATOR);\r\n testTimesheetEdit(timeSheetKey, id, newValues, true, null);\r\n // Or as user with Full Track Time permission and not in Employee Center\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRole.CFO);\r\n newValues = new HashMap<String, String>();\r\n newValues.put(\"hours\", \"5:00\");\r\n newValues.put(\"memo\", \"Non-Employee Center Memo\");\r\n testTimesheetEdit(timeSheetKey, id, newValues, true, null);\r\n }\r\n\r\n @Test\r\n //BUS-688\r\n //Submit timeentry and try to edit it. Get NLUserError because timeentry status is approved\r\n public void testEditApprovedTimeentry() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n updateTimeentryIds(nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true), timeEntries);\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, timeEntries);\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.APPROVED);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n String id = timeEntries.get(0).id;\r\n Map<String, String> newValues = new HashMap<String, String>();\r\n newValues.put(\"hours\", \"9:00\");\r\n newValues.put(\"memo\", \"PK test memo\");\r\n\r\n // Test edit from Employee Center\r\n testTimesheetEdit(timeSheetKey, id, newValues, false, \"You cannot edit a time entry that was approved by a supervisor\");\r\n // Test edit from user with Full permission on Track Time\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRole.CFO);\r\n testTimesheetEdit(timeSheetKey, id, newValues, false, \"You cannot edit a time entry that was approved by a supervisor\");\r\n // Test edit from Administrator\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRole.ADMINISTRATOR);\r\n testTimesheetEdit(timeSheetKey, id, newValues, true, null);\r\n }\r\n\r\n private void verifyTimeentryValues(String timeSheetKey, String timeEntryKey, Map<String, String> newValuesForTimeEntry) throws Exception\r\n {\r\n NLSession nl = getNLSession();\r\n NLRecordObject timeSheetRecord = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n NLRecordObject timeEntryRecord = null;\r\n int numLines = timeSheetRecord.getLineItemCount(SSTimesheet.TimeGrid.LIST);\r\n for (int line = 1; (line <= numLines) && (timeEntryRecord == null); line++)\r\n {\r\n timeSheetRecord.selectLineItem(SSTimesheet.TimeGrid.LIST, line);\r\n for (int day = 0; day < 7; day++)\r\n {\r\n timeEntryRecord = timeSheetRecord.viewCurrentLineItemSubrecord(SSTimesheet.TimeGrid.LIST, NLDayOfWeek.getDayOfWeek(nl, day).getFieldName());\r\n if ((timeEntryRecord != null) && (timeEntryKey.equals(timeEntryRecord.getFieldValue(\"id\"))))\r\n {\r\n break;\r\n }\r\n else\r\n {\r\n timeEntryRecord = null;\r\n }\r\n }\r\n }\r\n assertNotNull(timeEntryRecord);\r\n for (Map.Entry<String, String> entry : newValuesForTimeEntry.entrySet())\r\n {\r\n assertEquals(\"Incorrect value for field: \" + entry.getKey(), entry.getValue(), timeEntryRecord.getFieldValue(entry.getKey()));\r\n }\r\n }\r\n\r\n @Test\r\n //submit timesheet with seven time entries.\r\n //verify timesheet status is pending.\r\n //verify that we see seven time entries in time entry approval page.\r\n //approve all time entries\r\n //verify that we see zero time entries in the time entry approval page.\r\n //verify timesheet status is approved.\r\n //verify timeenties status is approved.\r\n public void testTimesheetAllApproved() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRoleConstants.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, timeEntries);\r\n\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, new LinkedList<TimeEntryData>());\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRoleConstants.EMPLOYEE);\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n\r\n //Verify the Approval Status for Timesheet after submission is approved\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.APPROVED);\r\n verifyTimeentries(timeSheet, timeEntries, NLTimelineApprovalStatusEnum.APPROVED);\r\n }\r\n\r\n @Test\r\n //Submit timesheet with few time entries\r\n //Hit approve button without selecting any timeentries on the timeentry approval page.\r\n //UI throws error Please select a time record before submitting.\r\n public void testNoneSelectedToApprove() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n\r\n List<TimeEntryData> toApprove = new LinkedList<TimeEntryData>();\r\n\r\n try\r\n {\r\n approveTimeentries(tea, toApprove);\r\n fail(\"No exception has been thrown\");\r\n }\r\n catch (Exception e)\r\n {\r\n if (!e.getMessage().equals(\"Please select a time record before submitting.\"))\r\n {\r\n fail(\"Unexpected exception has been thrown: \" + e.getMessage());\r\n }\r\n }\r\n }\r\n\r\n @Test\r\n //Submit timesheet with few time entries\r\n //Hit reject button without selecting any timeentries on the timeentry approval page.\r\n //UI throws error Please select a time record before submitting.\r\n public void testNoneSelectedToReject() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n\r\n List<TimeEntryData> toApprove = new LinkedList<TimeEntryData>();\r\n\r\n try\r\n {\r\n rejectTimeentries(tea, toApprove);\r\n fail(\"No exception has been thrown\");\r\n }\r\n catch (Exception e)\r\n {\r\n if (!e.getMessage().equals(\"Please select a time record before submitting.\"))\r\n {\r\n fail(\"Unexpected exception has been thrown: \" + e.getMessage());\r\n }\r\n }\r\n }\r\n\r\n @Test\r\n //submit timesheet with seven time entries.\r\n //verify that we see seven time entries in time entry approval page.\r\n public void testTimesheetVerifyTimeentryApprovalPage() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n }\r\n\r\n @Test\r\n //we submit timesheet with seven time entries.\r\n //verify timesheet status is pending.\r\n //verify that we see seven time entries in time entry approval page.\r\n //approve one time entry\r\n //verify that we see remaining six time entries in the time entry approval page.\r\n //verify timesheet status is pending.\r\n public void testTimesheetApproveSomeTimeentries() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n\r\n List<TimeEntryData> remaining = timeEntries;\r\n List<TimeEntryData> toApprove = new LinkedList<TimeEntryData>();\r\n toApprove.add(remaining.remove(0));\r\n\r\n approveTimeentries(tea, toApprove);\r\n //load time entry approval page again and verify that only the reamining entries are present.\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, remaining);\r\n //load the timesheet record again to see updated status.\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n }\r\n\r\n @Test\r\n //we submit timesheet with seven time entries.\r\n //verify timesheet status is pending.\r\n //verify that we see seven time entries in time entry approval page.\r\n //reject one time entry\r\n //verify that we see remainingsix time entries in the time entry approval page.\r\n //verify timesheet status is rejected.\r\n public void testTimesheetRejectSomeTimeentries() throws Exception\r\n {\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n\r\n List<TimeEntryData> remaining = timeEntries;\r\n List<TimeEntryData> toReject = new LinkedList<TimeEntryData>();\r\n toReject.add(remaining.remove(0));\r\n\r\n rejectTimeentries(tea, toReject);\r\n //load time entry approval page again and verify that only the remaining entries are present.\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, remaining);\r\n //load the timesheet record again to see updated status.\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.REJECTED);\r\n }\r\n\r\n @Test\r\n //(expected = NLException.class)\r\n //The remove of the timeEntry does not throw a UserError.\r\n // it simply does not even attempt to delete it. This will be added to the backlog.\r\n //Attempt to delete timeEntry *should* Get NLUserError because timeentry status is approved\r\n public void testNoDeleteLockedTimeentry() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, timeEntries);\r\n\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, new LinkedList<TimeEntryData>());\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n\r\n //Verify the Approval Status for Timesheet after submission is approved\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.APPROVED);\r\n verifyTimeentries(timeSheet, timeEntries, NLTimelineApprovalStatusEnum.APPROVED);\r\n\r\n deleteTimeEntry(timeSheetKey, timeEntries.get(0).id);\r\n // The remainder of the test can be deleted when NLUserError is implemented for attempt to delete approved\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n\r\n //Verify the Approval Status for Timesheet after submission is approved\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.APPROVED);\r\n verifyTimeentries(timeSheet, timeEntries, NLTimelineApprovalStatusEnum.APPROVED);\r\n }\r\n\r\n @Test\r\n //Regular user (cannot) delete TimeSheet with approved entries\r\n public void testUserCannotDeleteTimeSheetWithAnApprovedTimeentry() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n System.out.println(\"TS Key: \" + timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n List<TimeEntryData> toApprove = new LinkedList<TimeEntryData>();\r\n toApprove.add(timeEntries.remove(0));\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, toApprove);\r\n\r\n //submit the timesheet so that we can verify number of time entries for this timesheet.\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n\r\n // Reload the Timesheet as regular user and try to delete it\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n assertUserErrorOnDelete(\"As EMPLOYEE role, Did not receive expected NLUserError THIS_TIMESHEET_CANNOT_BE_DELETED_BECAUSE_IT_HAS_APPROVED_TIME_ENTRIES\", SSTimesheet.TYPE, timeSheetKey, NLErrormessageContext.THIS_TIMESHEET_CANNOT_BE_DELETED_BECAUSE_IT_HAS_APPROVED_TIME_ENTRIES);\r\n }\r\n\r\n @Test\r\n public void addTimeToInvoiceAndAttemptDeleteTS() throws Exception\r\n {\r\n String customer = getTestData().getCustomerWithSalesRepKey();\r\n //create timesheet with one week of time\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n\r\n NLSession nl = getNLSession();\r\n NLRecordObject timeSheet = getNewTimesheetRecord(getDefaultTimesheetParameters());\r\n timeSheet.selectNewLineItem(SSTimesheet.TimeGrid.LIST, true);\r\n NLRecordObject timeEntry;\r\n String serviceItem = getTestData().getItemKey(SSServiceItem.TYPE);\r\n for (int day = 0; day < 7; day++)\r\n {\r\n timeEntry = timeSheet.createCurrentLineItemSubrecord(SSTimesheet.TimeGrid.LIST, NLTimesheetGridEditMachine.getSummaryFieldName(nl, day));\r\n timeEntry.setFieldValue(SSTimesheet.TimeEntry.customer, customer);\r\n timeEntry.setFieldValue(SSTimesheet.TimeEntry.item, serviceItem);\r\n timeEntry.setFieldValue(SSTimesheet.TimeEntry.hours, 8);\r\n timeEntry.setFieldValue(SSTimesheet.TimeEntry.isbillable, \"T\");\r\n timeEntry.commit();\r\n }\r\n\r\n timeSheet.commitLineItem(SSTimesheet.TimeGrid.LIST);\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = nlapiSubmitRecord(timeSheet);\r\n submitTimesheet(timeSheetKey);\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n List<TimeEntryData> timeEntries = getTimeentryIds(timeSheetKey);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, timeEntries);\r\n\r\n //create invoice\r\n NLRecordObject invoice = nlapiCreateRecord(SSInvoice.TYPE, true);\r\n invoice.setFieldValue(SSInvoice.entity, customer);\r\n for (int i = 1; i <= invoice.getLineItemCount(SSInvoice.Time.TYPE); i++)\r\n {\r\n invoice.selectLineItem(SSInvoice.Time.TYPE, i);\r\n invoice.setCurrentLineItemValue(SSInvoice.Time.TYPE, SSInvoice.Time.apply, \"T\");\r\n invoice.commitLineItem(SSInvoice.Time.TYPE);\r\n }\r\n\r\n nlapiSubmitRecord(invoice);\r\n\r\n assertUserErrorOnDelete(\"As ADMINISTRATOR role, Did not receive expected NLUserError THIS_TIMESHEET_CANNOT_BE_DELETED_BECAUSE_IT_HAS_BILLED_TIME_ENTRIES\", SSTimesheet.TYPE, timeSheetKey, NLErrormessageContext.THIS_TIMESHEET_CANNOT_BE_DELETED_BECAUSE_IT_HAS_BILLED_TIME_ENTRIES);\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n assertUserErrorOnDelete(\"As EMPLOYEE role, Did not receive expected NLUserError THIS_TIMESHEET_CANNOT_BE_DELETED_BECAUSE_IT_HAS_APPROVED_TIME_ENTRIES\", SSTimesheet.TYPE, timeSheetKey, NLErrormessageContext.THIS_TIMESHEET_CANNOT_BE_DELETED_BECAUSE_IT_HAS_APPROVED_TIME_ENTRIES);\r\n }\r\n\r\n\r\n\r\n @Test\r\n //FULL ACCESS user (CAN) delete TimeSheet with approved entries\r\n public void testFullAccessUserDeleteTimeSheetApprovedTimeentry() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n String id = timeEntries.get(0).id;\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, timeEntries);\r\n\r\n // Reload the Timesheet as FullAccess user and delete the timesheet\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.FULLACCESS);\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n\r\n // We Expect no error to be thrown\r\n boolean gotExpectedError = true;\r\n try\r\n {\r\n nlapiDeleteRecord(SSTimesheet.TYPE, timeSheetKey);\r\n }\r\n catch (NLUserError e) {\r\n log(e.toString());\r\n gotExpectedError = false;\r\n }\r\n finally {\r\n assertTrue(\"FullAccess user was not able to delete TimeSheet with approved timeentries\", gotExpectedError);\r\n }\r\n }\r\n\r\n @Test\r\n // ADMINISTRATOR user (CAN) delete TimeSheet with approved entries\r\n public void testAdministratorDeleteTimeSheetApprovedTimeentry() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n List<TimeEntryData> toApprove = new LinkedList<TimeEntryData>();\r\n toApprove.add(timeEntries.remove(0));\r\n\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeentryapproval tea = loadTimeentryApproval(timeSheetKey);\r\n approveTimeentries(tea, toApprove);\r\n\r\n //submit the timesheet so that we can verify number of time entries for this timesheet.\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n tea = loadTimeentryApproval(timeSheetKey);\r\n verifyTimeentryApprovalPage(tea, timeEntries);\r\n\r\n // Reload the Timesheet as Administrator user and delete the timesheet\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRoleConstants.ADMINISTRATOR);\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n // We expect no error to be thrown\r\n boolean gotExpectedError = true;\r\n try\r\n {\r\n nlapiDeleteRecord(SSTimesheet.TYPE, timeSheetKey);\r\n }\r\n catch (NLUserError e) {\r\n log(e.toString());\r\n gotExpectedError = false;\r\n }\r\n finally {\r\n assertTrue(\"Administrator user was not able to delete TimeSheet with approved timeentries\", gotExpectedError);\r\n }\r\n }\r\n\r\n @Test\r\n // Employee1 cannot load Employee2 TimeSheet\r\n public void testEmp1CannotLoadEmp2TimeSheet() throws Exception\r\n {\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n // as another Employee, attempt to load the timesheet\r\n switchSession(Edition.US, NLRoleConstants.CREATORENTITY, NLRole.EMPLOYEE);\r\n\r\n boolean gotExpectedError = true;\r\n try\r\n {\r\n timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n }\r\n catch (NLPermission.NLPermissionUserError e) {\r\n log(e.toString());\r\n gotExpectedError = (\"Permission Violation: You need a higher level of the \'Transactions -> Track Time\' permission to access this page. Please contact your account administrator.\").equals(e.getMessage());\r\n }\r\n finally {\r\n assertTrue(\"Did not receive expected NLPermissionUserError => Permission Violation: You need a higher level of the \'Transactions -> Track Time\' permission to access this page. Please contact your account administrator.\", gotExpectedError);\r\n }\r\n }\r\n\r\n @Test\r\n // Employee2 (accountant role) cannot delete Employee1 TimeSheet\r\n // Note: Currently, there is no business logic to prevent role with TRAN_TIMEBILL fullaccess from deleting another persons timesheet (future story)\r\n //\r\n public void testEmp1CannotDeleteEmp2TimeSheet() throws Exception\r\n {\r\n switchSession(Edition.US);\r\n TestDataParameters.CachedTestDataValues emp2Params = getDefaultEmployeeParameters();\r\n emp2Params.REQUIRED.put( SSEmployee.email, \"emp2@netsuite.com\");\r\n emp2Params.REQUIRED.put(\"roles.selectedrole.1\", NLStringUtil.toString(NLRoleConstants.ACCOUNTANT));\r\n\r\n String employee2Key = getTestData().getEmployeeKey(emp2Params);\r\n\r\n Map<String, String> timeSheetParameters = getDefaultTimesheetParameters();\r\n List<TimeEntryData> timeEntries = getDefaultTimeEntries();\r\n\r\n switchSession(Edition.US, parseInt(timeSheetParameters.get(SSTimesheet.employee)), NLRole.EMPLOYEE);\r\n String timeSheetKey = createTimesheet(timeSheetParameters, timeEntries);\r\n submitTimesheet(timeSheetKey);\r\n System.out.println(\"TS Key: \" + timeSheetKey);\r\n NLRecordObject timeSheet = nlapiLoadRecord(SSTimesheet.TYPE, timeSheetKey, true);\r\n verifyTimesheetApprovalStatus(timeSheet, NLTimelineApprovalStatusEnum.PENDING);\r\n updateTimeentryIds(timeSheet, timeEntries);\r\n\r\n // as another Employee, attempt to delete the timesheet\r\n switchSession(Edition.US, parseInt(employee2Key), NLRoleConstants.ACCOUNTANT);\r\n\r\n assertPermissionUserErrorOnDelete(\"Did not received expected NLPermissionUserError attempting to delete another user\'s timesheet\", SSTimesheet.TYPE, timeSheetKey,\r\n NLErrormessageContext._1_YOU_NEED_A_HIGHER_LEVEL_OF_THE_2_PERMISSION_TO_ACCESS_THIS_PAGE_PLEASE_CONTACT_YOUR_ACCOUNT_ADMINISTRATOR);\r\n }\r\n\r\n protected void assertPermissionUserErrorOnDelete(String message, String recordType, String recordId, NLTranslationContext ctxt) throws Exception\r\n {\r\n try\r\n {\r\n nlapiDeleteRecord(recordType, recordId);\r\n assertEquals(message, ctxt != null ? getNLSession().getString(ctxt) : \"Error Message\", \"\");\r\n }\r\n catch (NLPermission.NLPermissionUserError e)\r\n { // error correctly thrown\r\n log(e.getMessage());\r\n if (ctxt != null)\r\n assertEquals(\"Incorrect error thrown\", ctxt, e.getTranslationContext());\r\n }\r\n }\r\n\r\n private void testTimesheetEdit(String timeSheetKey, String id, Map<String, String> newValues, boolean shouldSucceed, String assertedErrorMessage) throws Exception\r\n {\r\n if(shouldSucceed)\r\n {\r\n // If edit should succeed, either return on successful validation or pass the exception\r\n updateTimeentryValues(timeSheetKey, id, newValues);\r\n verifyTimeentryValues(timeSheetKey, id, newValues);\r\n return;\r\n }\r\n\r\n // In case that edit should fail, check for appropriate exception message\r\n try\r\n {\r\n updateTimeentryValues(timeSheetKey, id, newValues);\r\n fail(\"No exception has been thrown\");\r\n }\r\n catch (Exception e)\r\n {\r\n if (!e.getMessage().equals(assertedErrorMessage))\r\n {\r\n fail(\"Unexpected exception has been thrown: \" + e.getMessage());\r\n }\r\n }\r\n }\r\n\r\n}\r\n','java',0),(74,'2014-11-20 11:19:47','80.188.29.62','SELECT event.nkey KEY,\r\n CASE \r\n WHEN event.stype = \'PROJECTTASK\'\r\n THEN event.stitle || \' (\' || \'Project Task\' || \')\'\r\n WHEN event.stype = \'TASK\'\r\n THEN event.stitle || \' (\' || \'Task\' || \')\'\r\n WHEN event.stype = \'EVENT\'\r\n THEN event.stitle || \' (\' || \'Event\' || \')\'\r\n WHEN event.stype = \'CASE\'\r\n THEN \'Case # \' || event.snumber\r\n WHEN event.stype = \'CALL\'\r\n THEN event.stitle || \' (\' || \'Phone Call\' || \')\'\r\n WHEN event.stype = \'ISSUE\'\r\n THEN event.stitle || \' (\' || \'Requirement\' || \')\'\r\n END selname\r\nFROM event,\r\n projecttaskassignmentufd projecttaskassignment,\r\n projecttask\r\nWHERE event.nkey = projecttaskassignment.kparenttask(+)\r\n AND ProjectTask.nKey(+) = Event.nKey\r\n AND event.binactive = \'F\'\r\n AND Event.sType IN (\r\n \'PROJECTTASK\',\r\n \'CASE\',\r\n \'TASK\',\r\n \'EVENT\',\r\n \'CALL\'\r\n )\r\n AND Event.bIsJobSummaryTask = \'F\'\r\n AND Event.kStatus != \'COMPLETE\'\r\n AND nvl(decode(event.stype, \'PROJECTTASK\', projecttaskassignment.kentity, 115565), - 1) = nvl(115565, - 1)\r\n AND (\r\n Event.sType NOT IN (\r\n \'TASK\',\r\n \'CALL\',\r\n \'EVENT\'\r\n )\r\n OR Event.sAccessLevel != \'PRIVATE\'\r\n OR Event.kOwner = 115565\r\n OR Event.kAssigned = 115565\r\n OR EXISTS (\r\n SELECT 1\r\n FROM EntityEventMap eem\r\n WHERE eem.kEvent = Event.nKey\r\n AND eem.kEntity = 115565\r\n )\r\n )\r\n AND Event.kCompany = 167031\r\n AND upper(CASE \r\n WHEN event.stype = \'PROJECTTASK\'\r\n THEN event.stitle || \' (\' || \'Project Task\' || \')\'\r\n WHEN event.stype = \'TASK\'\r\n THEN event.stitle || \' (\' || \'Task\' || \')\'\r\n WHEN event.stype = \'EVENT\'\r\n THEN event.stitle || \' (\' || \'Event\' || \')\'\r\n WHEN event.stype = \'CASE\'\r\n THEN \'Case # \' || event.snumber\r\n WHEN event.stype = \'CALL\'\r\n THEN event.stitle || \' (\' || \'Phone Call\' || \')\'\r\n WHEN event.stype = \'ISSUE\'\r\n THEN event.stitle || \' (\' || \'Requirement\' || \')\'\r\n END) LIKE \'BUDGET%\'\r\n','sql',0); /*!40000 ALTER TABLE `pastebin` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2018-11-09 4:28:37