code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <title>KChangeLogger: KChangeLogger.Project_Change Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">KChangeLogger &#160;<span id="projectnumber">0.6</span> </div> <div id="projectbrief">A simple utility for keeping track of changes</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.2 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Packages</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('class_k_change_logger_1_1_project___change.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#pro-methods">Protected Member Functions</a> &#124; <a href="#properties">Properties</a> &#124; <a href="#events">Events</a> &#124; <a href="#pri-methods">Private Member Functions</a> &#124; <a href="#pri-attribs">Private Attributes</a> &#124; <a href="#pri-static-attribs">Static Private Attributes</a> &#124; <a href="class_k_change_logger_1_1_project___change-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">KChangeLogger.Project_Change Class Reference</div> </div> </div><!--header--> <div class="contents"> <div class="dynheader"> Inheritance diagram for KChangeLogger.Project_Change:</div> <div class="dyncontent"> <div class="center"> <img src="class_k_change_logger_1_1_project___change.png" usemap="#KChangeLogger.Project_Change_map" alt=""/> <map id="KChangeLogger.Project_Change_map" name="KChangeLogger.Project_Change_map"> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a> Protected Member Functions</h2></td></tr> <tr class="memitem:afa4900f6c7b0ee114781a09892e35854"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afa4900f6c7b0ee114781a09892e35854"></a> virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>SendPropertyChanging</b> ()</td></tr> <tr class="separator:afa4900f6c7b0ee114781a09892e35854"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abf1f004197ce366446c1cbf2f25aebf3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abf1f004197ce366446c1cbf2f25aebf3"></a> virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>SendPropertyChanged</b> (String propertyName)</td></tr> <tr class="separator:abf1f004197ce366446c1cbf2f25aebf3"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a> Properties</h2></td></tr> <tr class="memitem:a8fed8b92579c7b8120ffb8610ed5c193"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8fed8b92579c7b8120ffb8610ed5c193"></a> int&#160;</td><td class="memItemRight" valign="bottom"><b>Project_ID</b><code> [get, set]</code></td></tr> <tr class="separator:a8fed8b92579c7b8120ffb8610ed5c193"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ae469b52c97a080dd273967144e151791"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae469b52c97a080dd273967144e151791"></a> int&#160;</td><td class="memItemRight" valign="bottom"><b>ID_Change</b><code> [get, set]</code></td></tr> <tr class="separator:ae469b52c97a080dd273967144e151791"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4e6aaf818f7fc6ca463da37cdcca244f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4e6aaf818f7fc6ca463da37cdcca244f"></a> System.Nullable&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>File_ID</b><code> [get, set]</code></td></tr> <tr class="separator:a4e6aaf818f7fc6ca463da37cdcca244f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:adcf3ca74a5a54500f0d6991716e7ba73"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adcf3ca74a5a54500f0d6991716e7ba73"></a> int&#160;</td><td class="memItemRight" valign="bottom"><b>ChangeType</b><code> [get, set]</code></td></tr> <tr class="separator:adcf3ca74a5a54500f0d6991716e7ba73"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4164ef4254a44d71f9b54235ba537e7d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4164ef4254a44d71f9b54235ba537e7d"></a> string&#160;</td><td class="memItemRight" valign="bottom"><b>ChangeDescription</b><code> [get, set]</code></td></tr> <tr class="separator:a4164ef4254a44d71f9b54235ba537e7d"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8705bef8dcabe7aa5f7346f91aea217e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8705bef8dcabe7aa5f7346f91aea217e"></a> string&#160;</td><td class="memItemRight" valign="bottom"><b>ChangedBy</b><code> [get, set]</code></td></tr> <tr class="separator:a8705bef8dcabe7aa5f7346f91aea217e"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab97c8a4b413c800ba3eddd650fd732c6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab97c8a4b413c800ba3eddd650fd732c6"></a> System.DateTime&#160;</td><td class="memItemRight" valign="bottom"><b>ChangeDate</b><code> [get, set]</code></td></tr> <tr class="separator:ab97c8a4b413c800ba3eddd650fd732c6"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a7b45da2b701ada3eaa770805b640a6a8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7b45da2b701ada3eaa770805b640a6a8"></a> <a class="el" href="class_k_change_logger_1_1_change___type.html">Change_Type</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Change_Type</b><code> [get, set]</code></td></tr> <tr class="separator:a7b45da2b701ada3eaa770805b640a6a8"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:abb78ee98bbba895799df42d2629fa808"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abb78ee98bbba895799df42d2629fa808"></a> <a class="el" href="class_k_change_logger_1_1_project.html">Project</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Project</b><code> [get, set]</code></td></tr> <tr class="separator:abb78ee98bbba895799df42d2629fa808"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a427442f7080c7464800dc476e048d7c7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a427442f7080c7464800dc476e048d7c7"></a> <a class="el" href="class_k_change_logger_1_1_project___file.html">Project_File</a>&#160;</td><td class="memItemRight" valign="bottom"><b>Project_File</b><code> [get, set]</code></td></tr> <tr class="separator:a427442f7080c7464800dc476e048d7c7"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="events"></a> Events</h2></td></tr> <tr class="memitem:ac03c2fd63445b6c82ff8d0fb85707e0f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac03c2fd63445b6c82ff8d0fb85707e0f"></a> PropertyChangingEventHandler&#160;</td><td class="memItemRight" valign="bottom"><b>PropertyChanging</b></td></tr> <tr class="separator:ac03c2fd63445b6c82ff8d0fb85707e0f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa82bc027b4f1815007bde9601384dae4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa82bc027b4f1815007bde9601384dae4"></a> PropertyChangedEventHandler&#160;</td><td class="memItemRight" valign="bottom"><b>PropertyChanged</b></td></tr> <tr class="separator:aa82bc027b4f1815007bde9601384dae4"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-methods"></a> Private Member Functions</h2></td></tr> <tr class="memitem:abd0fe598900b775c1e0ac966fff56d94"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abd0fe598900b775c1e0ac966fff56d94"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnLoaded</b> ()</td></tr> <tr class="separator:abd0fe598900b775c1e0ac966fff56d94"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3a955088ea605ba87991b29078343608"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3a955088ea605ba87991b29078343608"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnValidate</b> (System.Data.Linq.ChangeAction action)</td></tr> <tr class="separator:a3a955088ea605ba87991b29078343608"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af62abce24296bf9caa91c102dd116707"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af62abce24296bf9caa91c102dd116707"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnCreated</b> ()</td></tr> <tr class="separator:af62abce24296bf9caa91c102dd116707"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a1cd3da0622dc03142f6db885c01f2c81"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1cd3da0622dc03142f6db885c01f2c81"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnProject_IDChanging</b> (int value)</td></tr> <tr class="separator:a1cd3da0622dc03142f6db885c01f2c81"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a286608e164e8675186b52b172a02a63e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a286608e164e8675186b52b172a02a63e"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnProject_IDChanged</b> ()</td></tr> <tr class="separator:a286608e164e8675186b52b172a02a63e"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a70dccd5f079d762ef626cff693c77909"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a70dccd5f079d762ef626cff693c77909"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnID_ChangeChanging</b> (int value)</td></tr> <tr class="separator:a70dccd5f079d762ef626cff693c77909"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac4fc68fa0ecc9642b8a64edd4c5c03fd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac4fc68fa0ecc9642b8a64edd4c5c03fd"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnID_ChangeChanged</b> ()</td></tr> <tr class="separator:ac4fc68fa0ecc9642b8a64edd4c5c03fd"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ab6ce841fa65ed59a7b663deaffb76bd6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab6ce841fa65ed59a7b663deaffb76bd6"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnFile_IDChanging</b> (System.Nullable&lt; int &gt; value)</td></tr> <tr class="separator:ab6ce841fa65ed59a7b663deaffb76bd6"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:af9f82504b1c309e407e2d096bb32c512"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af9f82504b1c309e407e2d096bb32c512"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnFile_IDChanged</b> ()</td></tr> <tr class="separator:af9f82504b1c309e407e2d096bb32c512"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ad305052485f5af16e2983c41405c4347"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad305052485f5af16e2983c41405c4347"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangeTypeChanging</b> (int value)</td></tr> <tr class="separator:ad305052485f5af16e2983c41405c4347"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8d39658d20effc897bcca6bb24269d81"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8d39658d20effc897bcca6bb24269d81"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangeTypeChanged</b> ()</td></tr> <tr class="separator:a8d39658d20effc897bcca6bb24269d81"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4b3ca0fd4f4642cd92f3070d2772bfed"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4b3ca0fd4f4642cd92f3070d2772bfed"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangeDescriptionChanging</b> (string value)</td></tr> <tr class="separator:a4b3ca0fd4f4642cd92f3070d2772bfed"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a37dddb3f6336958f19f318b388e9843d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a37dddb3f6336958f19f318b388e9843d"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangeDescriptionChanged</b> ()</td></tr> <tr class="separator:a37dddb3f6336958f19f318b388e9843d"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3044336155aecbc742d7a09725b10387"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3044336155aecbc742d7a09725b10387"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangedByChanging</b> (string value)</td></tr> <tr class="separator:a3044336155aecbc742d7a09725b10387"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4fb3ef0cbd81e76e11d1a7beaba68ddb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4fb3ef0cbd81e76e11d1a7beaba68ddb"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangedByChanged</b> ()</td></tr> <tr class="separator:a4fb3ef0cbd81e76e11d1a7beaba68ddb"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:ac9a540d50abb5ea936b7609cf28c74b6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac9a540d50abb5ea936b7609cf28c74b6"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangeDateChanging</b> (System.DateTime value)</td></tr> <tr class="separator:ac9a540d50abb5ea936b7609cf28c74b6"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a204fa4777932aac743cf1e54508b2faf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a204fa4777932aac743cf1e54508b2faf"></a> partial void&#160;</td><td class="memItemRight" valign="bottom"><b>OnChangeDateChanged</b> ()</td></tr> <tr class="separator:a204fa4777932aac743cf1e54508b2faf"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-attribs"></a> Private Attributes</h2></td></tr> <tr class="memitem:a56a09b3b84503173880c53f085ee802b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a56a09b3b84503173880c53f085ee802b"></a> int&#160;</td><td class="memItemRight" valign="bottom"><b>_Project_ID</b></td></tr> <tr class="separator:a56a09b3b84503173880c53f085ee802b"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a20eb0ce7047672cf256227e87c37729e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a20eb0ce7047672cf256227e87c37729e"></a> int&#160;</td><td class="memItemRight" valign="bottom"><b>_ID_Change</b></td></tr> <tr class="separator:a20eb0ce7047672cf256227e87c37729e"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8aa5783cb37c237bccab1475e24a14ab"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8aa5783cb37c237bccab1475e24a14ab"></a> System.Nullable&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>_File_ID</b></td></tr> <tr class="separator:a8aa5783cb37c237bccab1475e24a14ab"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aec9b890e0f149554331a26f2daf6f93e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aec9b890e0f149554331a26f2daf6f93e"></a> int&#160;</td><td class="memItemRight" valign="bottom"><b>_ChangeType</b></td></tr> <tr class="separator:aec9b890e0f149554331a26f2daf6f93e"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3dada32563f222ebcd81c90a68fec69d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3dada32563f222ebcd81c90a68fec69d"></a> string&#160;</td><td class="memItemRight" valign="bottom"><b>_ChangeDescription</b></td></tr> <tr class="separator:a3dada32563f222ebcd81c90a68fec69d"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a0e7f41ae9e1b2f818ab539a9b930108a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0e7f41ae9e1b2f818ab539a9b930108a"></a> string&#160;</td><td class="memItemRight" valign="bottom"><b>_ChangedBy</b></td></tr> <tr class="separator:a0e7f41ae9e1b2f818ab539a9b930108a"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a85e509b4710bc9ed41f627fe1737f6e6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a85e509b4710bc9ed41f627fe1737f6e6"></a> System.DateTime&#160;</td><td class="memItemRight" valign="bottom"><b>_ChangeDate</b></td></tr> <tr class="separator:a85e509b4710bc9ed41f627fe1737f6e6"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a4640406a09a65311c14537e8e26b41cb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4640406a09a65311c14537e8e26b41cb"></a> EntityRef&lt; <a class="el" href="class_k_change_logger_1_1_change___type.html">Change_Type</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>_Change_Type</b></td></tr> <tr class="separator:a4640406a09a65311c14537e8e26b41cb"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aa4ebd619a1ea6c56b07bb0e43adf91e2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa4ebd619a1ea6c56b07bb0e43adf91e2"></a> EntityRef&lt; <a class="el" href="class_k_change_logger_1_1_project.html">Project</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>_Project</b></td></tr> <tr class="separator:aa4ebd619a1ea6c56b07bb0e43adf91e2"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a3bbf3baa12f42d79a823c44c82da2f24"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3bbf3baa12f42d79a823c44c82da2f24"></a> EntityRef&lt; <a class="el" href="class_k_change_logger_1_1_project___file.html">Project_File</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>_Project_File</b></td></tr> <tr class="separator:a3bbf3baa12f42d79a823c44c82da2f24"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pri-static-attribs"></a> Static Private Attributes</h2></td></tr> <tr class="memitem:a65c84bd8f918404d4da16431f47d82d9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a65c84bd8f918404d4da16431f47d82d9"></a> static PropertyChangingEventArgs&#160;</td><td class="memItemRight" valign="bottom"><b>emptyChangingEventArgs</b> = new PropertyChangingEventArgs(String.Empty)</td></tr> <tr class="separator:a65c84bd8f918404d4da16431f47d82d9"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"> <p>Definition at line <a class="el" href="_k_change_data_context_8designer_8cs_source.html#l00651">651</a> of file <a class="el" href="_k_change_data_context_8designer_8cs_source.html">KChangeDataContext.designer.cs</a>.</p> </div><hr/>The documentation for this class was generated from the following file:<ul> <li>KChangeLogger/<a class="el" href="_k_change_data_context_8designer_8cs_source.html">KChangeDataContext.designer.cs</a></li> </ul> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="namespace_k_change_logger.html">KChangeLogger</a></li><li class="navelem"><a class="el" href="class_k_change_logger_1_1_project___change.html">Project_Change</a></li> <li class="footer">Generated on Wed Dec 19 2012 16:24:45 for KChangeLogger by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.2 </li> </ul> </div> </body> </html>
dineshkummarc/KChange
Docs/html/class_k_change_logger_1_1_project___change.html
HTML
gpl-3.0
24,595
package db.input; import java.util.Calendar; import java.util.Date; import com.healthmarketscience.jackcess.Row; import db.DbHandle; import db.Flat; import db.Meter; import gui.ErrorHandle; public class MeterInput implements db.DbNames { /** * adds a value for an existing meter * * @param meter * @param date * @param value * @return false if adding failed or there is a newer entry */ public static boolean addValue(Meter meter, Date date, double value) { Date lastEntry = meter.getLastEntryDate(); boolean isNewest = true; if (lastEntry.after(date)) { if (!ErrorHandle.askYesNo("Es existiert schon ein aktuellerer Eintrag\ntrotzdem einfügen?")) return false; } else if (value < meter.getLastEntryValue()) { ErrorHandle.popUp("Der angegebene Wert ist kleiner als der letzte!"); return false; } Row r; if (meter.getLastEntryValue() == 0.1) { r = meter.getLastEntry(); DbInput.removeRow(METER_VALUES_TABLE, r); } r = meter.getEntryFor(date); if (r != null) { if (ErrorHandle.askYesNo("Es existiert bereits ein Eintrag für dieses Datum\nÜberschreiben?")) DbInput.removeRow(METER_VALUES_TABLE, r); else { return false; } } DbInput.addRow(METER_VALUES_TABLE, new String[] { METER_VALUES_METER_ID, METER_VALUES_DATE, METER_VALUES_VALUE }, meter.getId(), date, value); return isNewest; } /** * Add a meter that is <b>NOT</b> a mainMeter to the db * * @param id * @param flat * @param kind * @return new Meter */ public static Meter addMeter(String id, Flat flat, int kind) { return addMeter(id, flat, kind, false); } /** * Adds a meter to the db * * @param id * @param flat * @param kind * @param mainMeter * @return new Meter */ public static Meter addMeter(String id, Flat flat, int kind, boolean mainMeter) { if (hasDouble(id)) { ErrorHandle.popUp("The Serialnumber is already used"); return null; } DbInput.addRow(METER_TABLE, new String[] { METER_ID, METER_FLAT, METER_KIND, METER_MAINCOUNTER }, id, flat.getId(), kind, mainMeter); Meter m = new Meter(id, flat); addValue(m, Calendar.getInstance().getTime(), 0.1); return m; } private static boolean hasDouble(String id) { return (DbHandle.search(METER_TABLE, METER_ID, id) != null); } }
otting/NebenkostenAssistent
src/db/input/MeterInput.java
Java
gpl-3.0
2,480
/* * This file is a part of TiledArray. * Copyright (C) 2013 Virginia Tech * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ #include "TiledArray/tiled_range.h" #include "range_fixture.h" #include "tiledarray.h" #include "unit_test_config.h" using namespace TiledArray; BOOST_FIXTURE_TEST_SUITE(tiled_range_suite, TiledRangeFixture, TA_UT_LABEL_SERIAL) BOOST_AUTO_TEST_CASE(accessor) { BOOST_CHECK_EQUAL(tr.tiles_range(), tiles_range); BOOST_CHECK_EQUAL(tr.elements_range(), elements_range); } BOOST_AUTO_TEST_CASE(constructor) { // check default constructor { BOOST_REQUIRE_NO_THROW(TiledRange r0); TiledRange r0; std::vector<std::size_t> s0(3, 0); BOOST_CHECK(!r0.tiles_range()); BOOST_CHECK(!r0.elements_range()); } // check ranges constructor { BOOST_REQUIRE_NO_THROW(TiledRange r1(dims.begin(), dims.end())); TiledRange r1(dims.begin(), dims.end()); BOOST_CHECK_EQUAL(r1.tiles_range(), tiles_range); BOOST_CHECK_EQUAL(r1.elements_range(), elements_range); } // construct with empty ranges { BOOST_REQUIRE_NO_THROW(TiledRange r1({dims[0], TiledRange1{}})); TiledRange r1{dims[0], TiledRange1{}}; BOOST_CHECK_EQUAL(r1.tiles_range().area(), 0); BOOST_CHECK_EQUAL(r1.elements_range().area(), 0); } // check initializer list of initializer list constructor { TiledRange r1{ {0, 2, 5, 10, 17, 28}, {0, 2, 5, 10, 17, 28}, {0, 2, 5, 10, 17, 28}}; BOOST_CHECK_EQUAL(r1.tiles_range(), tiles_range); BOOST_CHECK_EQUAL(r1.elements_range(), elements_range); } // check range of trange1s constructor { std::vector trange1s(3, TiledRange1{0, 2, 5, 10, 17, 28}); BOOST_REQUIRE_NO_THROW(TiledRange r1(trange1s)); TiledRange r1(trange1s); BOOST_CHECK_EQUAL(r1.tiles_range(), tiles_range); BOOST_CHECK_EQUAL(r1.elements_range(), elements_range); } // check negative index range #ifdef TA_SIGNED_1INDEX_TYPE { TiledRange r1{{-1, 0, 2, 5, 10, 17, 28}, {-1, 0, 2, 5, 10, 17, 28}, {-5, 0, 2, 5, 10, 17, 28}}; BOOST_CHECK_EQUAL(r1.tiles_range(), Range({6, 6, 6})); BOOST_CHECK_EQUAL(r1.elements_range(), Range({-1, -1, -5}, {28, 28, 28})); } #endif // TA_SIGNED_1INDEX_TYPE // check copy constructor { BOOST_REQUIRE_NO_THROW(TiledRange r4(tr)); TiledRange r4(tr); BOOST_CHECK_EQUAL(r4.tiles_range(), tr.tiles_range()); BOOST_CHECK_EQUAL(r4.elements_range(), tr.elements_range()); } } BOOST_AUTO_TEST_CASE(ostream) { std::stringstream stm; stm << "( tiles = " << tr.tiles_range() << ", elements = " << tr.elements_range() << " )"; boost::test_tools::output_test_stream output; output << tr; BOOST_CHECK(!output.is_empty(false)); BOOST_CHECK(output.check_length(stm.str().size(), false)); BOOST_CHECK(output.is_equal(stm.str().c_str())); } BOOST_AUTO_TEST_CASE(comparison) { TiledRange r1{{0, 2, 4, 6, 8, 10}, {0, 2, 4, 6, 8, 10}}; TiledRange r2{{0, 2, 4, 6, 8, 10}, {0, 2, 4, 6, 8, 10}}; TiledRange r3{{0, 3, 6, 9, 12, 15}, {0, 3, 6, 9, 12, 15}}; BOOST_CHECK(r1 == r2); // check equality operator BOOST_CHECK(!(r1 != r2)); // check not-equal operator BOOST_CHECK( !(r1 == r3)); // check for inequality with different number of tiles. BOOST_CHECK(r1 != r3); } BOOST_AUTO_TEST_CASE(assignment) { TiledRange r1; // verify they are not equal before assignment. BOOST_CHECK_NE(r1, tr); // check that assignment returns itself. BOOST_CHECK_EQUAL((r1 = tr), tr); // check that assignment is valid. BOOST_CHECK_EQUAL(r1, tr); } BOOST_AUTO_TEST_CASE(permutation) { Permutation p({2, 0, 1}); TiledRange r1 = p * tr; BOOST_CHECK_EQUAL( r1.tiles_range(), p * tr.tiles_range()); // check that tile data was permuted properly. BOOST_CHECK_EQUAL(r1.elements_range(), p * tr.elements_range()); // check that element data was // permuted properly. TiledRange r2(tr); BOOST_CHECK_EQUAL((r2 *= p), r1); // check that permutation returns itself. BOOST_CHECK_EQUAL(r2, r1); // check that the permutation was assigned correctly. } BOOST_AUTO_TEST_CASE(make_tiles_range) { tile_index start(GlobalFixture::dim); tile_index finish(GlobalFixture::dim); // iterate over all the tile indexes in the tiled range. TiledRange::ordinal_type i = 0; for (Range::const_iterator it = tr.tiles_range().begin(); it != tr.tiles_range().end(); ++it, ++i) { // get the start and finish indexes of the current range. for (unsigned int d = 0; d < GlobalFixture::dim; ++d) { start[d] = a[(*it)[d]]; finish[d] = a[(*it)[d] + 1]; } // construct a range object that should match the range constructed by // TiledRange. TiledRange::range_type range(start, finish); // Get the two ranges to be tested. TiledRange::range_type range_index = tr.make_tile_range(*it); TiledRange::range_type range_ordinal = tr.make_tile_range(i); BOOST_CHECK_EQUAL(range_index, range); BOOST_CHECK_EQUAL(range_ordinal, range); } } BOOST_AUTO_TEST_SUITE_END()
ValeevGroup/tiledarray
tests/tiled_range.cpp
C++
gpl-3.0
5,796
/******************************************************************************* * This file is part of Arionide. * * Arionide is an IDE used to conceive applications and algorithms in a three-dimensional environment. * It is the work of Arion Zimmermann for his final high-school project at Calvin College (Geneva, Switzerland). * Copyright (C) 2016-2020 Innovazion. All rights reserved. * * Arionide is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Arionide is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Arionide. If not, see <http://www.gnu.org/licenses/>. * * The copy of the GNU General Public License can be found in the 'LICENSE.txt' file inside the src directory or inside the JAR archive. *******************************************************************************/ package ch.innovazion.arionide.ui.core.gl; public interface Renderable { public void render(); }
thedreamer979/Arionide
src/ch/innovazion/arionide/ui/core/gl/Renderable.java
Java
gpl-3.0
1,350
/* * AirBlock - Framework for Multi-Platform Minecraft-Plugins. * Copyright (C) 2014 stux! * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.stuxcrystal.airblock.canary; import java.util.UUID; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; /** * Bridge for JUL to Log4j */ public class JULToLog4jBridge { /** * The handler for Log4j */ private static class Log4jHandler extends Handler { final org.apache.logging.log4j.Logger logger; Log4jHandler(org.apache.logging.log4j.Logger logger) { this.logger = logger; } @Override public void publish(LogRecord record) { int level = record.getLevel().intValue(); org.apache.logging.log4j.Level newLevel; if (level <= Level.FINER.intValue()) { newLevel = org.apache.logging.log4j.Level.TRACE; } else if (level <= Level.FINE.intValue()) { newLevel = org.apache.logging.log4j.Level.DEBUG; } else if (level <= Level.INFO.intValue()) { newLevel = org.apache.logging.log4j.Level.INFO; } else if (level <= Level.WARNING.intValue()) { newLevel = org.apache.logging.log4j.Level.WARN; } else if (level <= Level.SEVERE.intValue()) { newLevel = org.apache.logging.log4j.Level.ERROR; } else { newLevel = org.apache.logging.log4j.Level.FATAL; } this.logger.log(newLevel, record.getMessage(), record.getThrown()); } @Override public void flush() { } @Override public void close() throws SecurityException { } } /** * Create a wrapper for a log4j bridge. * @param logger The logger to bridge. * @return The wrapped logger. */ public static Logger bridge(org.apache.logging.log4j.Logger logger) { Logger result = Logger.getLogger(UUID.randomUUID().toString() + "_log4j_" + logger.getName()); result.setUseParentHandlers(false); result.addHandler(new Log4jHandler(logger)); result.setLevel(Level.ALL); return result; } }
StuxSoftware/AirBlock
canary/src/main/java/net/stuxcrystal/airblock/canary/JULToLog4jBridge.java
Java
gpl-3.0
2,868
/* * Copyright (c) 2017. James Lean * This file is part of cassette-nibbler. * * cassette-nibbler is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * cassette-nibbler is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with cassette-nibbler. If not, see <http://www.gnu.org/licenses/>. */ package com.eightbitjim.cassettenibbler.Platforms.Automatic; import com.eightbitjim.cassettenibbler.PlatformProvider; import com.eightbitjim.cassettenibbler.Platforms.Automatic.Platforms.C64TurboLoadExtractionPlatform; import com.eightbitjim.cassettenibbler.Platforms.Automatic.Platforms.AutomaticExtractionPlatform; public class AutomaticPlatformProvider extends PlatformProvider { public AutomaticPlatformProvider() { add(new AutomaticExtractionPlatform()); add(new C64TurboLoadExtractionPlatform()); } }
eightbitjim/cassette-nibbler
src/main/java/com/eightbitjim/cassettenibbler/Platforms/Automatic/AutomaticPlatformProvider.java
Java
gpl-3.0
1,278
package com.fuav.android.fragments; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.fuav.android.R; import com.fuav.android.fragments.helpers.ApiListenerFragment; import com.fuav.android.graphic.map.GraphicDrone; import com.fuav.android.graphic.map.GraphicGuided; import com.fuav.android.graphic.map.GraphicHome; import com.fuav.android.maps.DPMap; import com.fuav.android.maps.MarkerInfo; import com.fuav.android.maps.providers.DPMapProvider; import com.fuav.android.proxy.mission.MissionProxy; import com.fuav.android.utils.Utils; import com.fuav.android.utils.prefs.AutoPanMode; import com.fuav.android.utils.prefs.DroidPlannerPrefs; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil; import com.o3dr.android.client.Drone; import com.o3dr.services.android.lib.coordinate.LatLong; import com.o3dr.services.android.lib.drone.attribute.AttributeEvent; import com.o3dr.services.android.lib.drone.attribute.AttributeType; import com.o3dr.services.android.lib.drone.property.CameraProxy; import com.o3dr.services.android.lib.drone.property.Gps; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentLinkedQueue; public abstract class DroneMap extends ApiListenerFragment { public static final String ACTION_UPDATE_MAP = Utils.PACKAGE_NAME + ".action.UPDATE_MAP"; private static final IntentFilter eventFilter = new IntentFilter(); static { eventFilter.addAction(MissionProxy.ACTION_MISSION_PROXY_UPDATE); eventFilter.addAction(AttributeEvent.GPS_POSITION); eventFilter.addAction(AttributeEvent.GUIDED_POINT_UPDATED); eventFilter.addAction(AttributeEvent.HEARTBEAT_FIRST); eventFilter.addAction(AttributeEvent.HEARTBEAT_RESTORED); eventFilter.addAction(AttributeEvent.HEARTBEAT_TIMEOUT); eventFilter.addAction(AttributeEvent.STATE_CONNECTED); eventFilter.addAction(AttributeEvent.STATE_DISCONNECTED); eventFilter.addAction(AttributeEvent.CAMERA_FOOTPRINTS_UPDATED); eventFilter.addAction(AttributeEvent.ATTITUDE_UPDATED); eventFilter.addAction(AttributeEvent.HOME_UPDATED); eventFilter.addAction(ACTION_UPDATE_MAP); } private static final List<MarkerInfo> NO_EXTERNAL_MARKERS = Collections.emptyList(); private final BroadcastReceiver eventReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (!isResumed()) return; final String action = intent.getAction(); switch (action) { case ACTION_UPDATE_MAP: case AttributeEvent.HOME_UPDATED: case MissionProxy.ACTION_MISSION_PROXY_UPDATE: postUpdate(); break; case AttributeEvent.GPS_POSITION: { if(!getMapName().equals("GOOGLE_MAP")||(isSupportGooglePlay())){ mMapFragment.updateMarker(graphicDrone); mMapFragment.updateDroneLeashPath(guided); final Gps droneGps = drone.getAttribute(AttributeType.GPS); if (droneGps != null && droneGps.isValid()) { mMapFragment.addFlightPathPoint(droneGps.getPosition()); } } break; } case AttributeEvent.GUIDED_POINT_UPDATED: mMapFragment.updateMarker(guided); mMapFragment.updateDroneLeashPath(guided); break; case AttributeEvent.HEARTBEAT_FIRST: case AttributeEvent.HEARTBEAT_RESTORED: case AttributeEvent.STATE_CONNECTED: mMapFragment.updateMarker(graphicDrone); break; case AttributeEvent.STATE_DISCONNECTED: case AttributeEvent.HEARTBEAT_TIMEOUT: mMapFragment.updateMarker(graphicDrone); break; case AttributeEvent.CAMERA_FOOTPRINTS_UPDATED: { if(mAppPrefs.isRealtimeFootprintsEnabled()) { CameraProxy camera = drone.getAttribute(AttributeType.CAMERA); if (camera != null && camera.getLastFootPrint() != null) mMapFragment.addCameraFootprint(camera.getLastFootPrint()); } break; } case AttributeEvent.ATTITUDE_UPDATED: { if (mAppPrefs.isRealtimeFootprintsEnabled()) { final Gps droneGps = drone.getAttribute(AttributeType.GPS); if (droneGps.isValid()) { CameraProxy camera = drone.getAttribute(AttributeType.CAMERA); if (camera != null && camera.getCurrentFieldOfView() != null) mMapFragment.updateRealTimeFootprint(camera.getCurrentFieldOfView()); } } else{ mMapFragment.updateRealTimeFootprint(null); } break; } } } }; private final Handler mHandler = new Handler(); private final Runnable mUpdateMap = new Runnable() { @Override public void run() { if (getActivity() == null && mMapFragment == null) return; final List<MarkerInfo> missionMarkerInfos = missionProxy.getMarkersInfos(); final List<MarkerInfo> externalMarkers = collectMarkersFromProviders(); final boolean isThereMissionMarkers = !missionMarkerInfos.isEmpty(); final boolean isThereExternalMarkers = !externalMarkers.isEmpty(); final boolean isHomeValid = home.isValid(); final boolean isGuidedVisible = guided.isVisible(); // Get the list of markers currently on the map. final Set<MarkerInfo> markersOnTheMap = mMapFragment.getMarkerInfoList(); if (!markersOnTheMap.isEmpty()) { if (isHomeValid) { markersOnTheMap.remove(home); } if (isGuidedVisible) { markersOnTheMap.remove(guided); } if (isThereMissionMarkers) { markersOnTheMap.removeAll(missionMarkerInfos); } if(isThereExternalMarkers) markersOnTheMap.removeAll(externalMarkers); mMapFragment.removeMarkers(markersOnTheMap); } if (isHomeValid) { mMapFragment.updateMarker(home); } if (isGuidedVisible) { mMapFragment.updateMarker(guided); } if (isThereMissionMarkers) { mMapFragment.updateMarkers(missionMarkerInfos, isMissionDraggable()); } if(isThereExternalMarkers) mMapFragment.updateMarkers(externalMarkers, false); mMapFragment.updateMissionPath(missionProxy); mMapFragment.updatePolygonsPaths(missionProxy.getPolygonsPath()); mHandler.removeCallbacks(this); } }; private final ConcurrentLinkedQueue<MapMarkerProvider> markerProviders = new ConcurrentLinkedQueue<>(); protected DPMap mMapFragment; protected DroidPlannerPrefs mAppPrefs; private GraphicHome home; public GraphicDrone graphicDrone; public GraphicGuided guided; protected MissionProxy missionProxy; public Drone drone; protected Context context; protected abstract boolean isMissionDraggable(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) { final View view = inflater.inflate(R.layout.fragment_drone_map, viewGroup, false); updateMapFragment(); return view; } @Override public void onDetach() { super.onDetach(); mHandler.removeCallbacksAndMessages(null); } @Override public void onApiConnected() { if (mMapFragment != null) mMapFragment.clearMarkers(); getBroadcastManager().registerReceiver(eventReceiver, eventFilter); drone = getDrone(); missionProxy = getMissionProxy(); home = new GraphicHome(drone, getContext()); graphicDrone = new GraphicDrone(drone); guided = new GraphicGuided(drone); postUpdate(); } public boolean isSupportGooglePlay(){ final int playStatus = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context); final boolean isValid = playStatus == ConnectionResult.SUCCESS; return isValid; } public String getMapName(){ DroidPlannerPrefs pre = new DroidPlannerPrefs(context); return pre.getMapProviderName(); } @Override public void onApiDisconnected() { getBroadcastManager().unregisterReceiver(eventReceiver); } private void updateMapFragment() { // Add the map fragment instance (based on user preference) final DPMapProvider mapProvider = mAppPrefs.getMapProvider(); final FragmentManager fm = getChildFragmentManager(); mMapFragment = (DPMap) fm.findFragmentById(R.id.map_fragment_container); if (mMapFragment == null || mMapFragment.getProvider() != mapProvider) { final Bundle mapArgs = new Bundle(); mapArgs.putInt(DPMap.EXTRA_MAX_FLIGHT_PATH_SIZE, getMaxFlightPathSize()); mMapFragment = mapProvider.getMapFragment(); ((Fragment) mMapFragment).setArguments(mapArgs); fm.beginTransaction().replace(R.id.map_fragment_container, (Fragment) mMapFragment) .commit(); } } @Override public void onPause() { super.onPause(); mMapFragment.saveCameraPosition(); } @Override public void onResume() { super.onResume(); mMapFragment.loadCameraPosition(); } @Override public void onStart() { super.onStart(); updateMapFragment(); } @Override public void onStop() { super.onStop(); mHandler.removeCallbacksAndMessages(null); } @Override public void onAttach(Activity activity) { super.onAttach(activity); context = activity.getApplicationContext(); mAppPrefs = new DroidPlannerPrefs(context); } public final void postUpdate() { mHandler.post(mUpdateMap); } protected int getMaxFlightPathSize() { return 0; } /** * Adds padding around the edges of the map. * * @param left * the number of pixels of padding to be added on the left of the * map. * @param top * the number of pixels of padding to be added on the top of the * map. * @param right * the number of pixels of padding to be added on the right of * the map. * @param bottom * the number of pixels of padding to be added on the bottom of * the map. */ public void setMapPadding(int left, int top, int right, int bottom) { mMapFragment.setMapPadding(left, top, right, bottom); } public void saveCameraPosition() { mMapFragment.saveCameraPosition(); } public List<LatLong> projectPathIntoMap(List<LatLong> path) { return mMapFragment.projectPathIntoMap(path); } /** * Set map panning mode on the specified target. * * @param target */ public abstract boolean setAutoPanMode(AutoPanMode target); /** * Move the map to the user location. */ public void goToMyLocation() { mMapFragment.goToMyLocation(); } /** * Move the map to the drone location. */ public void goToDroneLocation() { mMapFragment.goToDroneLocation(); } /** * Update the map rotation. * * @param bearing */ public void updateMapBearing(float bearing) { mMapFragment.updateCameraBearing(bearing); } /** * Ignore marker clicks on the map and instead report the event as a * mapClick * * @param skip * if it should skip further events */ public void skipMarkerClickEvents(boolean skip) { mMapFragment.skipMarkerClickEvents(skip); } public void addMapMarkerProvider(MapMarkerProvider provider){ if(provider != null) { markerProviders.add(provider); postUpdate(); } } public void removeMapMarkerProvider(MapMarkerProvider provider){ if(provider != null) { markerProviders.remove(provider); postUpdate(); } } public interface MapMarkerProvider { MarkerInfo[] getMapMarkers(); } private List<MarkerInfo> collectMarkersFromProviders(){ if(markerProviders.isEmpty()) return NO_EXTERNAL_MARKERS; List<MarkerInfo> markers = new ArrayList<>(); for(MapMarkerProvider provider : markerProviders){ MarkerInfo[] externalMarkers = provider.getMapMarkers(); Collections.addAll(markers, externalMarkers); } if(markers.isEmpty()) return NO_EXTERNAL_MARKERS; return markers; } public DPMap.VisibleMapArea getVisibleMapArea(){ return mMapFragment == null ? null : mMapFragment.getVisibleMapArea(); } }
forgodsake/TowerPlus
Android/src/com/fuav/android/fragments/DroneMap.java
Java
gpl-3.0
13,181
/** * Mars Simulation Project * Interpolation.java * @version 3.2.0 2021-06-20 * @author Manny Kung */ package org.mars_sim.msp.core.tool; import java.awt.Color; import java.util.Arrays; import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; import org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction; import org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolator; import org.apache.commons.math3.analysis.interpolation.SplineInterpolator; import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction; public class Interpolation { // x and y for AkimaSplineInterpolator public static void main(String[] args) { // testTri(); // test0(); findHSB(); } // public void test3() { // double[] x = { 0, 50, 100 }; // double[] y = { 0, 50, 200 }; // double[] z = { 0, 5, 10 }; // // TricubicSplineInterpolator tsi = new TricubicSplineInterpolator(); // PolynomialSplineFunction f = tsi.interpolate(x, y, z); // // System.out.println("Piecewise functions:"); // Arrays.stream(f.getPolynomials()).forEach(System.out::println); // // double value = f.value(70); // System.out.println("y for xi = 70: " + value); // // // } public double[] linearInterp(double[] x, double[] y, double[] xi) { LinearInterpolator li = new LinearInterpolator(); // or other interpolator PolynomialSplineFunction psf = li.interpolate(x, y); double[] yi = new double[xi.length]; for (int i = 0; i < xi.length; i++) { yi[i] = psf.value(xi[i]); } return yi; } public static void findHSB() { int[] b = new int[] {103, 152, 199, 211, 223, 235, 170, 38, 38, 38, 63, 67, 69, 72, 91, 105, 116, 128, 141, 155, 170, 185, 201, 218, 236, 239, 243, 249, 255, 255, 254}; int[] g = new int[] {38, 38, 38, 38, 62, 134, 230, 225, 239, 254, 188, 147, 111, 81, 107, 119, 130, 141, 153, 166, 179, 193, 208, 223, 238, 241, 244, 249, 255, 253, 251}; int[] r = new int[] {104, 129, 130, 76, 38, 38, 38, 66, 148, 243, 254, 240, 226, 212, 190, 168, 177, 186, 194, 203, 211, 221, 229, 238, 246, 248, 249, 252, 255, 218, 181}; int[] e = new int[] {-9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000, 21000}; // List<Double> eList = Arrays.asList(e); int size = e.length; float[] hue = new float[size]; float[] saturation = new float[size]; float[] brightness = new float[size]; String s0 = String.format("%6s %4s %4s %4s %6s %6s %6s", "Elev", "R", "G", "B", "H", "S", "B"); System.out.println(s0); System.out.println(" -------------------------------------------- "); for (int i=0; i < size; i++) { float[] hsb = Color.RGBtoHSB(r[i], g[i], b[i], null); hue[i] = hsb[0]; saturation[i] = hsb[1]; brightness[i] = hsb[2]; String s = String.format("%6d %4d %4d %4d %7.4f %7.4f %7.4f", e[i], r[i], g[i], b[i], hue[i], saturation[i], brightness[i]); System.out.println(s); } // Arrays.stream(hue.toString()).map((x) -> Float.parseFloat(x)).forEach(System.out::println); } public static void test0() { // double[] x = { 0, 50, 100 }; // double[] y = { 0, 50, 200 }; // double[] x = new double[] {103, 152, 199, 211, 223, 235, 170, 38, 38, // 38, 63, 67, 69, 72, 91, 105, 116, 128, 141, // 155, 170, 185, 201, 218, 236, 239, 243, 249, 255, 255, 254}; // double[] x = new double[] {38, 38, 38, 38, 62, 134, 230, 225, 239, // 254, 188, 147, 111, 81, 107, 119, 130, 141, 153, // 166, 179, 193, 208, 223, 238, 241, 244, 249, 255, 253, 251}; double[] x = new double[] {104, 129, 130, 76, 38, 38, 38, 66, 148, 243, 254, 240, 226, 212, 190, 168, 177, 186, 194, 203, 211, 221, 229, 238, 246, 248, 249, 252, 255, 218, 181}; double[] y = new double[] {-9000, -8000, -7000, -6000, -5000, -4000, -3000, -2000, -1000, 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 20000, 21000}; // LinearInterpolator interp = new LinearInterpolator(); SplineInterpolator si = new SplineInterpolator(); PolynomialSplineFunction f = si.interpolate(x, y); // System.out.println("Piecewise functions:"); Arrays.stream(f.getPolynomials()).forEach(System.out::println); double value = f.value(250); System.out.println("Elevation when x = 250: " + value); } public void test1() { double[] xValues = new double[] {36, 36.001, 36.002}; double[] yValues = new double[] {-108.00, -107.999, -107.998}; double[][] fValues = new double[][] {{1915, 1906, 1931}, {1877, 1889, 1894}, {1878, 1873, 1888}}; // BicubicSplineInterpolator interpolator = new BicubicSplineInterpolator(); PiecewiseBicubicSplineInterpolator interpolator = new PiecewiseBicubicSplineInterpolator(); // BicubicSplineInterpolatingFunction interpolatorFunction = interpolator.interpolate(xValues, yValues, fValues); PiecewiseBicubicSplineInterpolatingFunction interpolatorFunction = interpolator.interpolate(xValues, yValues, fValues); double[][] results = new double[9][9]; double x = 36; int arrayIndexX = 0; int arrayIndexY = 0; while(x <= 36.002) { double y = -108; arrayIndexY = 0; while (y <= -107.998) { results[arrayIndexX][arrayIndexY] = interpolatorFunction.value(x, y); System.out.println(results[arrayIndexX][arrayIndexY]); y = y + 0.00025; arrayIndexY++; } x = x + 0.00025; arrayIndexX++; } } }
mars-sim/mars-sim
mars-sim-core/src/main/java/org/mars_sim/msp/core/tool/Interpolation.java
Java
gpl-3.0
6,531
/* Theme Name: Theme URI: Author: Description: Child theme of Flint. <description>. Version: 0.0.0 License: GPLv3 License URI: LICENSE.md Tags: Template: flint Template Version: <x.x.x> Copyright <year> <company> (email : <email address>) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ @import url(../flint/style.css); /* =Global ----------------------------------------------- */ body, button, input, select, textarea { } html, body { } article { } b, strong { } h1 { } h2 { } h3 { } h4 { } img, video { } hr { } .label { } #page { } /* Alignment */ .alignleft { } .alignright { } .aligncenter { } .alignnone { } /* =Header ----------------------------------------------- */ #top-pad { } /* =Content ----------------------------------------------- */ .bypostauthor { } .entry-title { } .btn-edit { } .sticky { } .byline { } .more-link { } .page-links { } #primary { } .page-header { } .pw { } /* =Media ----------------------------------------------- */ /* =Navigation ----------------------------------------------- */ .navbar-brand { } /* =Comments ----------------------------------------------- */ #comments { } /* =Widgets ----------------------------------------------- */ .widget { } /* =Footer ----------------------------------------------- */ #colophon { } .site-info { } #credits { }
starverte/flint-child
style.css
CSS
gpl-3.0
1,943
/* * Copyright (C) 2006 * Thomas van Dijk * Jan-Pieter van den Heuvel * Wouter Slob * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package nl.uu.cs.treewidth.ngraph; import java.util.HashMap; import nl.uu.cs.treewidth.graph.Edge; import nl.uu.cs.treewidth.graph.Graph; import nl.uu.cs.treewidth.graph.Vertex; public class Utility { public static <D> NGraph<D> newify( Graph<D> g ) { NGraph<D> newG = new ListGraph<D>(); HashMap<Vertex<D>, NVertex<D>> oldToNew = new HashMap<Vertex<D>, NVertex<D>>(); for( Vertex<D> v : g.vertices ) { NVertex<D> nv = new ListVertex<D>( v.data ); newG.addVertex( nv ); oldToNew.put( v, nv ); } for( Edge<D> e : g.getEdges() ) { newG.ensureEdge( oldToNew.get(e.a), oldToNew.get(e.b) ); } return newG; } }
yannponty/RNARedPrint
lib/treewidth-java/nl/uu/cs/treewidth/ngraph/Utility.java
Java
gpl-3.0
1,530
/* HHKfun.h - Auxiliary function definitions for H-H K channels. */ /* S. Engblom 2019-12-03 */ #ifndef HHKFUN_H #define HHKFUN_H /* forward declarations */ double HHK_alpha1(const double v); double HHK_beta1(const double v); #endif /* HHKFUN_H */
URDME/urdme
workflows/neuron/channel/lib/HHKfun.h
C
gpl-3.0
252
package com.quaap.bookymcbookface.book; import java.util.LinkedHashMap; import java.util.Map; /** * Copyright (C) 2017 Tom Kliethermes * * This file is part of BookyMcBookface and is is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 3 of the License, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. */ public class BookMetadata { private String title; private String author; private String filename; private Map<String,String> alldata = new LinkedHashMap<>(); public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public Map<String, String> getAlldata() { return alldata; } public void setAlldata(Map<String, String> alldata) { this.alldata = alldata; } }
quaap/BookyMcBookface
app/src/main/java/com/quaap/bookymcbookface/book/BookMetadata.java
Java
gpl-3.0
1,459
/** * This file is part of veraPDF Parser, a module of the veraPDF project. * Copyright (c) 2015, veraPDF Consortium <info@verapdf.org> * All rights reserved. * * veraPDF Parser is free software: you can redistribute it and/or modify * it under the terms of either: * * The GNU General public license GPLv3+. * You should have received a copy of the GNU General Public License * along with veraPDF Parser as the LICENSE.GPL file in the root of the source * tree. If not, see http://www.gnu.org/licenses/ or * https://www.gnu.org/licenses/gpl-3.0.en.html. * * The Mozilla Public License MPLv2+. * You should have received a copy of the Mozilla Public License along with * veraPDF Parser as the LICENSE.MPL file in the root of the source tree. * If a copy of the MPL was not distributed with this file, you can obtain one at * http://mozilla.org/MPL/2.0/. */ package org.verapdf.pd.font.cff; /** * Class contains predefined charsets, encodings and strings for CFF files. * * @author Sergey Shemyakov */ public class CFFPredefined { public static final String[] EXPERT_CHARSET = { ".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall" }; public static final int[] EXPERT_ENCODING = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 229, 230, 0, 231, 232, 233, 234, 235, 236, 237, 238, 13, 14, 15, 99, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 27, 28, 249, 250, 251, 252, 0, 253, 254, 255, 256, 257, 0, 0, 0, 258, 0, 0, 259, 260, 261, 262, 0, 0, 263, 264, 265, 0, 266, 109, 110, 267, 268, 269, 0, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 304, 305, 306, 0, 0, 307, 308, 309, 310, 311, 0, 312, 0, 0, 313, 0, 0, 314, 315, 0, 0, 316, 317, 318, 0, 0, 0, 158, 155, 163, 319, 320, 321, 322, 323, 324, 325, 0, 0, 326, 150, 164, 169, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378 }; public static final String[] EXPERT_SUBSET_CHARSET = { ".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior" }; public static final String[] ISO_ADOBE_CHARSET = { ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron" }; public static final int[] STANDARD_ENCODING = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 0, 111, 112, 113, 114, 0, 115, 116, 117, 118, 119, 120, 121, 122, 0, 123, 0, 124, 125, 126, 127, 128, 129, 130, 131, 0, 132, 133, 0, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 139, 0, 0, 0, 0, 140, 141, 142, 143, 0, 0, 0, 0, 0, 144, 0, 0, 0, 145, 0, 0, 146, 147, 148, 149, 0, 0, 0, 0 }; public static final String[] STANDARD_STRINGS = { ".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold", }; public static final int N_STD_STRINGS = STANDARD_STRINGS.length; public static final int SPACE_SID_EXPERT = 1; public static final int EXPERT_ENCODING_LAST_SID = 378; }
shem-sergey/veraPDF-pdflib
src/main/java/org/verapdf/pd/font/cff/CFFPredefined.java
Java
gpl-3.0
30,851
# AirsoftPointsCounter
zBritva/AirsoftPointsCounter
README.md
Markdown
gpl-3.0
22
DROP TABLE IF EXISTS `castle_functions`; CREATE TABLE IF NOT EXISTS `castle_functions` ( `castle_id` int(2) NOT NULL DEFAULT '0', `type` int(1) NOT NULL DEFAULT '0', `lvl` int(3) NOT NULL DEFAULT '0', `lease` int(10) NOT NULL DEFAULT '0', `rate` decimal(20,0) NOT NULL DEFAULT '0', `endTime` bigint(13) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`castle_id`,`type`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
rubenswagner/L2J-Global
dist/db_installer/sql/game/castle_functions.sql
SQL
gpl-3.0
418
/* Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'quicktable', 'cy', { more: 'Mwy...' } );
Copona/copona
admin/view/javascript/ckeditor/plugins/quicktable/lang/cy.js
JavaScript
gpl-3.0
222
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("UsingDelegates")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("UsingDelegates")] [assembly: AssemblyCopyright("Copyright © 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6413db1b-6832-4a75-9242-8f202ae39ef6")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
gil00pita/Csharp-Basic-Samples
Csharp_Samples/08Delegates/Properties/AssemblyInfo.cs
C#
gpl-3.0
1,404
<form method="post"> <input type="hidden" name="csrf" value="<?= $csrf ?>"> <label for="title">Titre</label> <input type="text" name="title" id="title" minlength="3" placeholder="Les meilleurs titres sont les plus courts"> <label for="content">Contenu</label> <textarea name="content" id="content" cols="30" rows="10" placeholder="Contenu"></textarea> <select name="user_id" id="user_id"> <?php foreach ($users as $user): ?> <option value="<?= $user->id ?>"><?= $user->email ?></option> <?php endforeach; ?> </select> <input type="submit" value="Creer"> </form> <script> $(document).ready(function () { $("#user_id").select2( ajaxBuilder( '<?=WEB_ROOT?>/ajax/admin/users', function (params) { return { csrf_ajax: Cookies.get('csrf_ajax'), search: params.term, // search term page: params.page }; }, function (user) { return user.username; }, function (user) { return user.title || user.text; }) ); }) </script>
stardisblue/TechnicalNotes
app/view/admintechnotes/create.php
PHP
gpl-3.0
1,272
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete work. # # Copyright (c) 2015 Peter Sprygada, <psprygada@ansible.com> # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import traceback import json from ansible.module_utils._text import to_text, to_native from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import env_fallback from ansible.module_utils.connection import Connection, ConnectionError from ansible.module_utils.network.common.netconf import NetconfConnection from ansible.module_utils.network.common.parsing import Cli from ansible.module_utils.six import iteritems NET_TRANSPORT_ARGS = dict( host=dict(required=True), port=dict(type='int'), username=dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])), password=dict(no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD'])), ssh_keyfile=dict(fallback=(env_fallback, ['ANSIBLE_NET_SSH_KEYFILE']), type='path'), authorize=dict(default=False, fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'), auth_pass=dict(no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS'])), provider=dict(type='dict', no_log=True), transport=dict(choices=list()), timeout=dict(default=10, type='int') ) NET_CONNECTION_ARGS = dict() NET_CONNECTIONS = dict() def _transitional_argument_spec(): argument_spec = {} for key, value in iteritems(NET_TRANSPORT_ARGS): value['required'] = False argument_spec[key] = value return argument_spec def to_list(val): if isinstance(val, (list, tuple)): return list(val) elif val is not None: return [val] else: return list() class ModuleStub(object): def __init__(self, argument_spec, fail_json): self.params = dict() for key, value in argument_spec.items(): self.params[key] = value.get('default') self.fail_json = fail_json class NetworkError(Exception): def __init__(self, msg, **kwargs): super(NetworkError, self).__init__(msg) self.kwargs = kwargs class Config(object): def __init__(self, connection): self.connection = connection def __call__(self, commands, **kwargs): lines = to_list(commands) return self.connection.configure(lines, **kwargs) def load_config(self, commands, **kwargs): commands = to_list(commands) return self.connection.load_config(commands, **kwargs) def get_config(self, **kwargs): return self.connection.get_config(**kwargs) def save_config(self): return self.connection.save_config() class NetworkModule(AnsibleModule): def __init__(self, *args, **kwargs): connect_on_load = kwargs.pop('connect_on_load', True) argument_spec = NET_TRANSPORT_ARGS.copy() argument_spec['transport']['choices'] = NET_CONNECTIONS.keys() argument_spec.update(NET_CONNECTION_ARGS.copy()) if kwargs.get('argument_spec'): argument_spec.update(kwargs['argument_spec']) kwargs['argument_spec'] = argument_spec super(NetworkModule, self).__init__(*args, **kwargs) self.connection = None self._cli = None self._config = None try: transport = self.params['transport'] or '__default__' cls = NET_CONNECTIONS[transport] self.connection = cls() except KeyError: self.fail_json(msg='Unknown transport or no default transport specified') except (TypeError, NetworkError) as exc: self.fail_json(msg=to_native(exc), exception=traceback.format_exc()) if connect_on_load: self.connect() @property def cli(self): if not self.connected: self.connect() if self._cli: return self._cli self._cli = Cli(self.connection) return self._cli @property def config(self): if not self.connected: self.connect() if self._config: return self._config self._config = Config(self.connection) return self._config @property def connected(self): return self.connection._connected def _load_params(self): super(NetworkModule, self)._load_params() provider = self.params.get('provider') or dict() for key, value in provider.items(): for args in [NET_TRANSPORT_ARGS, NET_CONNECTION_ARGS]: if key in args: if self.params.get(key) is None and value is not None: self.params[key] = value def connect(self): try: if not self.connected: self.connection.connect(self.params) if self.params['authorize']: self.connection.authorize(self.params) self.log('connected to %s:%s using %s' % (self.params['host'], self.params['port'], self.params['transport'])) except NetworkError as exc: self.fail_json(msg=to_native(exc), exception=traceback.format_exc()) def disconnect(self): try: if self.connected: self.connection.disconnect() self.log('disconnected from %s' % self.params['host']) except NetworkError as exc: self.fail_json(msg=to_native(exc), exception=traceback.format_exc()) def register_transport(transport, default=False): def register(cls): NET_CONNECTIONS[transport] = cls if default: NET_CONNECTIONS['__default__'] = cls return cls return register def add_argument(key, value): NET_CONNECTION_ARGS[key] = value def get_resource_connection(module): if hasattr(module, '_connection'): return module._connection capabilities = get_capabilities(module) network_api = capabilities.get('network_api') if network_api == 'cliconf': module._connection = Connection(module._socket_path) elif network_api == 'netconf': module._connection = NetconfConnection(module._socket_path) else: module.fail_json(msg='Invalid connection type {0!s}'.format(network_api)) return module._connection def get_capabilities(module): if hasattr(module, 'capabilities'): return module._capabilities try: capabilities = Connection(module._socket_path).get_capabilities() except ConnectionError as exc: module.fail_json(msg=to_text(exc, errors='surrogate_then_replace')) module._capabilities = json.loads(capabilities) return module._capabilities
pgmillon/ansible
lib/ansible/module_utils/network/common/network.py
Python
gpl-3.0
8,128
/* * SSLsplit - transparent and scalable SSL/TLS interception * Copyright (c) 2009-2014, Daniel Roethlisberger <daniel@roe.ch> * All rights reserved. * http://www.roe.ch/SSLsplit * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "sys.h" #include "log.h" #include <sys/types.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/file.h> #include <netinet/in.h> #include <netdb.h> #include <fcntl.h> #include <pwd.h> #include <grp.h> #include <fts.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #ifndef _SC_NPROCESSORS_ONLN #include <sys/sysctl.h> #endif /* !_SC_NPROCESSORS_ONLN */ #include <event2/util.h> /* * Permanently drop from root privileges to an unprivileged user account. * Sets the real, effective and stored user and group ID and the list of * ancillary groups. This is only safe if the effective user ID is 0. * If username is unset and the effective uid != uid, drop privs to uid. * This is to support setuid bit configurations. * If jaildir is set, also chroot to jaildir after reading system files * but before dropping privileges. * Returns 0 on success, -1 on failure. */ int sys_privdrop(const char *username, const char *jaildir) { struct passwd *pw = NULL; int ret = -1; if (username) { if (!(pw = getpwnam(username))) { log_err_printf("Failed to getpwnam user '%s': %s\n", username, strerror(errno)); goto error; } if (initgroups(username, pw->pw_gid) == -1) { log_err_printf("Failed to initgroups user '%s': %s\n", username, strerror(errno)); goto error; } } if (jaildir) { if (chroot(jaildir) == -1) { log_err_printf("Failed to chroot to '%s': %s\n", jaildir, strerror(errno)); goto error; } if (chdir("/") == -1) { log_err_printf("Failed to chdir to '/': %s\n", strerror(errno)); goto error; } } if (username) { if (setgid(pw->pw_gid) == -1) { log_err_printf("Failed to setgid to %i: %s\n", pw->pw_gid, strerror(errno)); goto error; } if (setuid(pw->pw_uid) == -1) { log_err_printf("Failed to setuid to %i: %s\n", pw->pw_uid, strerror(errno)); goto error; } } else if (getuid() != geteuid()) { if (setuid(getuid()) == -1) { log_err_printf("Failed to setuid(getuid()): %s\n", strerror(errno)); goto error; } } ret = 0; error: if (pw) { endpwent(); } return ret; } /* * Open and lock process ID file fn. * Returns open file descriptor on success or -1 on errors. */ int sys_pidf_open(const char *fn) { int fd; if ((fd = open(fn, O_RDWR|O_CREAT, 0640)) == -1) { log_err_printf("Failed to open '%s': %s\n", fn, strerror(errno)); return -1; } if (flock(fd, LOCK_EX|LOCK_NB) == -1) { log_err_printf("Failed to lock '%s': %s\n", fn, strerror(errno)); close(fd); return -1; } return fd; } /* * Write process ID to open process ID file descriptor fd. * Returns 0 on success, -1 on errors. */ int sys_pidf_write(int fd) { char pidbuf[4*sizeof(pid_t)]; int rv; rv = snprintf(pidbuf, sizeof(pidbuf), "%d\n", getpid()); if (rv == -1 || rv >= (int)sizeof(pidbuf)) return -1; write(fd, pidbuf, strlen(pidbuf)); fsync(fd); fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); return 0; } /* * Close and remove open process ID file before quitting. */ void sys_pidf_close(int fd, const char *fn) { unlink(fn); close(fd); } /* * Parse an ascii host/IP and port tuple into a sockaddr_storage. * On success, returns address family and fills in addr, addrlen. * Returns -1 on error. */ int sys_sockaddr_parse(struct sockaddr_storage *addr, socklen_t *addrlen, char *naddr, char *nport, int af, int flags) { struct evutil_addrinfo hints; struct evutil_addrinfo *ai; int rv; memset(&hints, 0, sizeof(hints)); hints.ai_family = af; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = EVUTIL_AI_ADDRCONFIG | flags; rv = evutil_getaddrinfo(naddr, nport, &hints, &ai); if (rv != 0) { log_err_printf("Cannot resolve address '%s' port '%s': %s\n", naddr, nport, gai_strerror(rv)); return -1; } memcpy(addr, ai->ai_addr, ai->ai_addrlen); *addrlen = ai->ai_addrlen; af = ai->ai_family; freeaddrinfo(ai); return af; } /* * Converts an IPv4/IPv6 sockaddr into a printable string representation. * Returns an allocated buffer which must be freed by caller, or NULL on error. */ char * sys_sockaddr_str(struct sockaddr *addr, socklen_t addrlen) { char host[INET6_ADDRSTRLEN], serv[6]; char *buf; int rv; size_t bufsz; bufsz = sizeof(host) + sizeof(serv) + 3; buf = malloc(bufsz); if (!buf) { log_err_printf("Cannot allocate memory\n"); return NULL; } rv = getnameinfo(addr, addrlen, host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV); if (rv != 0) { log_err_printf("Cannot get nameinfo for socket address: %s\n", gai_strerror(rv)); free(buf); return NULL; } snprintf(buf, bufsz, "[%s]:%s", host, serv); return buf; } /* * Returns 1 if path points to an existing directory node in the filesystem. * Returns 0 if path is NULL, does not exist, or points to a file of some kind. */ int sys_isdir(const char *path) { struct stat s; if (stat(path, &s) == -1) return 0; if (s.st_mode & S_IFDIR) return 1; return 0; } /* * Iterate over all files in a directory hierarchy, calling the callback * cb for each file, passing the filename and arg as arguments. Files and * directories beginning with a dot are skipped, symlinks are followed. */ int sys_dir_eachfile(const char *dirname, sys_dir_eachfile_cb_t cb, void *arg) { FTS *tree; FTSENT *node; char * paths[2]; paths[1] = NULL; paths[0] = strdup(dirname); if (!paths[0]) return -1; tree = fts_open(paths, FTS_NOCHDIR | FTS_LOGICAL, NULL); if (!tree) { log_err_printf("Cannot open directory '%s': %s\n", dirname, strerror(errno)); return -1; } while ((node = fts_read(tree))) { if (node->fts_level > 0 && node->fts_name[0] == '.') fts_set(tree, node, FTS_SKIP); else if (node->fts_info & FTS_F) { cb(node->fts_path, arg); } } if (errno) { log_err_printf("Error reading directory entry: %s\n", strerror(errno)); return -1; } fts_close(tree); free(paths[0]); return 0; } /* * Portably get the number of CPU cores online in the system. */ uint32_t sys_get_cpu_cores(void) { #ifdef _SC_NPROCESSORS_ONLN return sysconf(_SC_NPROCESSORS_ONLN); #else /* !_SC_NPROCESSORS_ONLN */ int mib[2]; uint32_t n; size_t len = sizeof(n); mib[0] = CTL_HW; mib[1] = HW_AVAILCPU; sysctl(mib, sizeof(mib)/sizeof(int), &n, &len, NULL, 0); if (n < 1) { mib[1] = HW_NCPU; sysctl(mib, sizeof(mib)/sizeof(int), &n, &len, NULL, 0); if (n < 1) { n = 1; } } return n; #endif /* !_SC_NPROCESSORS_ONLN */ } /* vim: set noet ft=c: */
ShaPOC/ProjectGhost
software/sslsplit/src/sys.c
C
gpl-3.0
8,241
# Be sure to restart your server when you modify this file. # Your secret key is used for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. # You can use `rake secret` to generate a secure secret key. # Make sure your secret_key_base is kept private # if you're sharing your code publicly. Initiapp::Application.config.secret_key_base = 'db26af56e3a4eaa59ef5af7f97e387d63f83b9bfb20f8ab178348815df422e347f14fb427e9eb434e138f291b1cf005639371c493e54ac46d688759bfd756364'
robwa/initiapp
config/initializers/secret_token.rb
Ruby
gpl-3.0
662
/******************************************************************************* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ package org.worldgrower.profession; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.worldgrower.Constants; import org.worldgrower.generator.Item; import org.worldgrower.goal.Goal; import org.worldgrower.goal.Goals; public class UTestArenaFighterProfession { ArenaFighterProfession profession; List<Profession> professions; @Before public void setUp() { professions = new ArrayList<Profession>(); profession = new ArenaFighterProfession(professions); } @Test public void testGetDescription() { assertEquals(profession.getDescription(), "arena fighter"); } @Test public void testGetProfessionGoals() { List<Goal> goals = profession.getProfessionGoals(); assertEquals(goals.get(0), Goals.ARENA_FIGHT_GOAL); assertEquals(goals.get(1), Goals.COLLECT_ARENA_REWARD_GOAL); assertEquals(goals.get(2), Goals.EQUIPMENT_GOAL); } @Test public void testGetSkillProperty() { assertEquals(profession.getSkillProperty(), Constants.DIPLOMACY_SKILL); } //@Test //public void testReadResolve() throws ObjectStreamException { // ArenaFighterProfession profession2 = new ArenaFighterProfession(professions); // assertEquals(profession.readResolveImpl(), profession2); //} @Test public void testIsPaidByVillagerLeader() { assertFalse(profession.isPaidByVillagerLeader()); } @Test public void testAvoidEnemies() { assertFalse(profession.avoidEnemies()); } @Test public void testGetSellItems() { List<Item> item = new ArrayList<Item>(); assertEquals(profession.getSellItems(), item); } }
WorldGrower/WorldGrower
test/org/worldgrower/profession/UTestArenaFighterProfession.java
Java
gpl-3.0
2,531
#!/usr/bin/python3 import sqlite3 import os, sys, time, datetime, random, string import urllib.request, urllib.error import configparser from flask import Flask, request, session, redirect from flask import render_template, g, flash, url_for from contextlib import closing from .modules import Pagi from pxeat import app from config import * def prt_help(): print("To start the service:\n\n\t" + sys.argv[0] + " server\n") print("Listen to \"localhost:5000\" by default, \nDeploy on production (Apache, Nginx...) with \"pxeat.wsgi\"") def chk_args(): if len(sys.argv) == 2: if sys.argv[1] == 'server': if not os.path.isfile(DATABASE): print("Database is not available!\nCreate with --initdb") sys.exit() if not os.path.isfile(PXE_FILE): print("PXE file is not available!\nPlease check the configuration") sys.exit() if not os.path.isfile("./config.py"): print("PXEAT Config file is missing!") sys.exit() elif sys.argv[1] == '--initdb': init_db() else: prt_help() sys.exit() else: prt_help() sys.exit() # Defaults items_num = int(ITEMS_NUM) form_default = ["", \ "http://", \ REPO_KERNEL_DEFAULT, \ REPO_INITRD_DEFAULT, \ "def", \ ""] loader_dir = TFTP_ROOT + LOADER_PATH postfix_kernelfn = '-0' postfix_initrdfn = '-1' items = {} def chk_input(chk_string, chk_type): if chk_type == 'pxe_title': if chk_string == '': raise ValueError("The title can not be empty!") return elif chk_type == 'file_path': if chk_string[0] != '/' or chk_string[-1] == '/': raise ValueError("Path format is invalid!") return elif chk_type == 'repo_url': chk_elements = chk_string.split('//') if chk_elements[1] == '': raise ValueError("The repository can not be empty!") return elif chk_elements[0] not in ['http:','https:']: raise ValueError("Invalid format!"+\ " (Only support http:// or https://)") return else: sys.exit("chk_type error!") def grab_file(base_url, file_path, saved_file): errmsg0 = "<br />Something wrong, please contact the administrator." errmsg1 = "<br />Something wrong, please check the repository link \ and kernel/initrd file path." dbginfo_local = "Debug info: Configuration error! \ Failed to open/write local kernel&initrd file. \ Check your \'LOADER_PATH\' setting in config file. \ Make sure the path exist and you have permission to write.\n\ Current path: " + saved_file file_url = base_url + file_path try: f = urllib.request.urlopen(file_url) except urllib.error.HTTPError as e: return str(e.code) + " " + str(e.reason) + str(errmsg1) except: return str(errmsg0) try: local_file = open(saved_file, "wb") local_file.write(f.read()) except: print(dbginfo_local) return str(errmsg0) local_file.close() def boot_opts_gen(opt_flag): if opt_flag == "vnc": return(DEFAULT_BOOT_OPTS + \ " console=ttyS0 vnc=1 vncpassword=" + \ VNC_PASSWD) elif opt_flag == "ssh": return(DEFAULT_BOOT_OPTS + \ " console=ttyS0 usessh=1 sshpassword=" + \ SSH_PASSWD) else: return(DEFAULT_BOOT_OPTS) def connect_db(): return sqlite3.connect(DATABASE) def init_db(): with closing(connect_db()) as db: with app.open_resource('schema.sql', mode='r') as f: db.cursor().executescript(f.read()) db.commit() @app.before_request def before_request(): g.db = connect_db() @app.teardown_request def teardown_request(exception): db = getattr(g, 'db', None) if db is not None: db.close() @app.route('/') def form(): default_val = {} for i,k in enumerate(['title', \ 'repo_url', \ 'repo_kernel', \ 'repo_initrd', \ 'inst_method', \ 'comment']): default_val[k] = form_default[i] return render_template('form.html', default_val=default_val) @app.route('/history/', defaults={'page': 1}) @app.route('/history/page/<int:page>') def history(page): count = g.db.execute('select count(*) from pxeitems').fetchone()[0] per_page = 10 pagination = Pagi(page, per_page, count) try: cur = g.db.execute('select id,\ pxe_title,\ repo_url,\ repo_kernel,\ repo_initrd,\ pxe_comment,\ unix_time,\ inst_flag from pxeitems order by id desc') except sqlite3.Error as e: return render_template('failed.html', \ failed_msg = "Database error: "+str(e)) history_entries = [ dict(pxe_id=row[0], \ pxe_title=row[1], \ repo_url=row[2], \ repo_kernel=row[3], \ repo_initrd=row[4], \ pxe_comment=row[5], \ unix_time=datetime.datetime.fromtimestamp(int(row[6])), \ inst_flag=row[7]) \ for row in cur.fetchall()[(page-1)*per_page:page*per_page]\ ] if not history_entries and page != 1: #Shoud do something here other than pass or abort(404) pass return render_template('history.html',\ pagination=pagination,\ history_entries=history_entries) @app.route('/clone/<int:clone_id>') def clone(clone_id): row = g.db.execute('select pxe_title,\ repo_url,\ repo_kernel,\ repo_initrd,\ inst_flag,\ pxe_comment from pxeitems where id=?',[clone_id]).fetchone() default_val = {} for i,k in enumerate(['title', \ 'repo_url', \ 'repo_kernel', \ 'repo_initrd', \ 'inst_method', \ 'comment']): default_val[k] = row[i] flash(u'Cloned Entry!','green') return render_template('form.html', default_val=default_val) @app.route('/about') @app.route('/about/') def about(): return render_template('about.html') # For the pagination def url_for_other_page(page): args = request.view_args.copy() args['page'] = page return url_for(request.endpoint, **args) app.jinja_env.globals['url_for_other_page'] = url_for_other_page @app.route('/confirm', methods=['POST']) def confirm_entry(): #Input checking try: for x,y in [[request.form['pxe_title'],'pxe_title'], \ [request.form['repo_url'], 'repo_url'], \ [request.form['repo_kernel'], 'file_path'], \ [request.form['repo_initrd'], 'file_path']]: chk_input(x,y) except ValueError as e: flash(e.args[0],'error') return redirect(url_for('form')) # Assign to the dictionary items['repo_kernel'] = request.form['repo_kernel'] items['repo_url'] = request.form['repo_url'] items['repo_initrd'] = request.form['repo_initrd'] items['pxe_title'] = request.form['pxe_title'] items['pxe_comment'] = request.form['pxe_comment'] items['inst_flag'] = request.form['inst_method'] # Generate a random string items['random_str'] = ''.join(random.choice(string.ascii_lowercase) for _ in range(4)) items['unix_time'] = '' # Show the entry which will be generated on the confirm page gen_format = ["menu label ^a - " + items['pxe_title'], \ "kernel " + LOADER_PATH + "[random]" + postfix_kernelfn, \ "append initrd=" + LOADER_PATH + "[random]" + postfix_initrdfn + " " + \ boot_opts_gen(items['inst_flag']) + " " + \ "install=" + items['repo_url']] return render_template('confirm.html', cfm_entries=items, cfm_fmt=gen_format) @app.route('/add', methods=['POST']) def add_entry(): items['unix_time'] = str(int(time.time())) id_random = items['unix_time'] + items['random_str'] # Get kernel and initrd file for f_name,i in [[items['repo_kernel'], postfix_kernelfn],\ [items['repo_initrd'], postfix_initrdfn]]: ret = grab_file(items['repo_url'],\ f_name,\ loader_dir + id_random + i) if ret: return render_template('failed.html',\ failed_msg = f_name + ": " + str(ret)) else: pass # Add new entry to database try: g.db.execute('INSERT INTO pxeitems (\ pxe_title, \ repo_url, \ repo_kernel, \ repo_initrd, \ pxe_comment, \ unix_time, \ random_str, \ inst_flag) values (?, ?, ?, ?, ?, ?, ?, ?)', \ [items['pxe_title'], \ items['repo_url'], \ items['repo_kernel'], \ items['repo_initrd'], \ items['pxe_comment'], \ items['unix_time'], \ items['random_str'], \ items['inst_flag']\ ]) except sqlite3.Error as e: #Remove downloaded files here for i in (postfix_kernelfn, postfix_initrdfn): os.remove(TFTP_ROOT + LOADER_PATH + id_random + i) return render_template('failed.html', \ failed_msg = "Database error: " + str(e)) g.db.commit() # Fetch first items_num of entires from the database cur = g.db.execute('SELECT pxe_title,\ repo_url,\ repo_kernel,\ repo_initrd,\ inst_flag FROM pxeitems order by id desc') pxe_entries = [ dict(pxe_title=row[0], \ repo_url=row[1], \ repo_kernel=row[2], \ repo_initrd=row[3], \ inst_flag=row[4]) for row in cur.fetchall()[:items_num]\ ] # Write the entries to PXE configure file try: fpxe = open(PXE_FILE,'w') except IOError as e: for i in ("0","1"): os.remove(TFTP_ROOT + LOADER_PATH + id_random + "-" + i) g.db.execute('DELETE FROM pxeitems WHERE id = (SELECT max(id) FROM pxeitems)') return render_template('failed.html', failed_msg = e) fpxe.write(PXE_HEADER + '\n') pxe_index = 'a' for pxe_entry in pxe_entries: fpxe.write('label {0}\n menu label ^{0} - {1}\n menu indent 2\n kernel {2}\n append initrd={3} {4} install={5}\n\n'.format(\ pxe_index,\ pxe_entry['pxe_title'],\ LOADER_PATH + items['unix_time'] + items['random_str'] + postfix_kernelfn, \ LOADER_PATH + items['unix_time'] + items['random_str'] + postfix_initrdfn, \ boot_opts_gen(pxe_entry['inst_flag']),items['repo_url'])) pxe_index = chr(ord(pxe_index)+1) fpxe.write(PXE_FOOTER + '\n') fpxe.close # Remove the out of service kernel&initrd files for root, dirs, files in os.walk(loader_dir, topdown=False): names=sorted(files,reverse=True) for i in names[items_num*2:]: os.remove(os.path.join(root,i)) flash(u'New entry was successfully posted','green') return redirect(url_for('form'))
wnereiz/pxeat
pxeat/views.py
Python
gpl-3.0
12,105
<?php /** * @package WPSEO\Admin|Google_Search_Console */ // Admin header. Yoast_Form::get_instance()->admin_header( false, 'wpseo-gsc', false, 'yoast_wpseo_gsc_options' ); if ( defined( 'WP_DEBUG' ) && WP_DEBUG && WPSEO_GSC_Settings::get_profile() !== '' ) { ?> <form action="" method="post" class="wpseo-gsc-reload-crawl-issues-form"> <input type='hidden' name='reload-crawl-issues-nonce' value='<?php echo wp_create_nonce( 'reload-crawl-issues' ); ?>' /> <input type="submit" name="reload-crawl-issues" id="reload-crawl-issue" class="button button-primary alignright" value="<?php _e( 'Reload crawl issues', 'wordpress-seo' ); ?>"> </form> <?php } ?> <h2 class="nav-tab-wrapper" id="wpseo-tabs"> <?php echo $platform_tabs = new WPSEO_GSC_Platform_Tabs; ?> </h2> <?php // Video explains about the options when connected only. if ( null !== $this->service->get_client()->getAccessToken() ) { $video_url = WPSEO_Shortlinker::get( 'https://yoa.st/screencast-search-console' ); } else { $video_url = WPSEO_Shortlinker::get( 'https://yoa.st/screencast-connect-search-console' ); } $tab = new WPSEO_Option_Tab( 'GSC', __( 'Google Search Console', 'wordpress-seo' ), array( 'video_url' => $video_url ) ); $gsc_help_center = new WPSEO_Help_Center( 'google-search-console', $tab ); $gsc_help_center->localize_data(); $gsc_help_center->mount(); switch ( $platform_tabs->current_tab() ) { case 'settings' : // Check if there is an access token. if ( null === $this->service->get_client()->getAccessToken() ) { // Print auth screen. echo '<p>'; /* Translators: %1$s: expands to Yoast SEO, %2$s expands to Google Search Console. */ echo sprintf( __( 'To allow %1$s to fetch your %2$s information, please enter your Google Authorization Code. Clicking the button below will open a new window.', 'wordpress-seo' ), 'Yoast SEO', 'Google Search Console' ); echo "</p>\n"; echo '<input type="hidden" id="gsc_auth_url" value="', $this->service->get_client()->createAuthUrl() , '" />'; echo "<button type='button' id='gsc_auth_code' class='button'>" , __( 'Get Google Authorization Code', 'wordpress-seo' ) ,"</button>\n"; echo '<p id="gsc-enter-code-label">' . __( 'Enter your Google Authorization Code and press the Authenticate button.', 'wordpress-seo' ) . "</p>\n"; echo "<form action='" . admin_url( 'admin.php?page=wpseo_search_console&tab=settings' ) . "' method='post'>\n"; echo "<input type='text' name='gsc[authorization_code]' value='' class='textinput' aria-labelledby='gsc-enter-code-label' />"; echo "<input type='hidden' name='gsc[gsc_nonce]' value='" . wp_create_nonce( 'wpseo-gsc_nonce' ) . "' />"; echo "<input type='submit' name='gsc[Submit]' value='" . __( 'Authenticate', 'wordpress-seo' ) . "' class='button button-primary' />"; echo "</form>\n"; } else { $reset_button = '<a class="button" href="' . add_query_arg( 'gsc_reset', 1 ) . '">' . __( 'Reauthenticate with Google ', 'wordpress-seo' ) . '</a>'; echo '<h3>', __( 'Current profile', 'wordpress-seo' ), '</h3>'; if ( ($profile = WPSEO_GSC_Settings::get_profile() ) !== '' ) { echo '<p>'; echo $profile; echo '</p>'; echo '<p>'; echo $reset_button; echo '</p>'; } else { echo "<form action='" . admin_url( 'options.php' ) . "' method='post'>"; settings_fields( 'yoast_wpseo_gsc_options' ); Yoast_Form::get_instance()->set_option( 'wpseo-gsc' ); echo '<p>'; if ( $profiles = $this->service->get_sites() ) { $show_save = true; echo Yoast_Form::get_instance()->select( 'profile', __( 'Profile', 'wordpress-seo' ), $profiles ); } else { $show_save = false; echo __( 'There were no profiles found', 'wordpress-seo' ); } echo '</p>'; echo '<p>'; if ( $show_save ) { echo '<input type="submit" name="submit" id="submit" class="button button-primary wpseo-gsc-save-profile" value="' . __( 'Save Profile', 'wordpress-seo' ) . '" /> ' . __( 'or', 'wordpress-seo' ) , ' '; } echo $reset_button; echo '</p>'; echo '</form>'; } } break; default : $form_action_url = add_query_arg( 'page', esc_attr( filter_input( INPUT_GET, 'page' ) ) ); get_current_screen()->set_screen_reader_content( array( // There are no views links in this screen, so no need for the views heading. 'heading_views' => null, 'heading_pagination' => __( 'Crawl issues list navigation', 'wordpress-seo' ), 'heading_list' => __( 'Crawl issues list', 'wordpress-seo' ), ) ); // Open <form>. echo "<form id='wpseo-crawl-issues-table-form' action='" . $form_action_url . "' method='post'>\n"; // AJAX nonce. echo "<input type='hidden' class='wpseo-gsc-ajax-security' value='" . wp_create_nonce( 'wpseo-gsc-ajax-security' ) . "' />\n"; $this->display_table(); // Close <form>. echo "</form>\n"; break; } ?> <?php // Add link to Knowledge Base article about crawl issues. echo '<p>'; printf( /* translators: %1$s expands anchor to knowledge base article, %2$s expands to </a> */ __( 'Please refer to %1$sour article about how to connect your website to Google Search Console%2$s if you need assistance.', 'wordpress-seo' ), '<a href="https://kb.yoast.com/kb/how-to-connect-and-retrieve-crawl-issues/" target="_blank">', '</a>' ); echo '</p>'; ?> <br class="clear" /> <?php // Admin footer. Yoast_Form::get_instance()->admin_footer( false );
multi-webguru/website2018
wp-content/plugins/wordpress-seo/admin/google_search_console/views/gsc-display.php
PHP
gpl-3.0
5,431
/* * Auditing VFS module for samba. Log selected file operations to syslog * facility. * * Copyright (C) Tim Potter 1999-2000 * Copyright (C) Alexander Bokovoy 2002 * Copyright (C) Stefan (metze) Metzmacher 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "includes.h" #include "system/filesys.h" #include "system/syslog.h" #include "smbd/smbd.h" #include "lib/param/loadparm.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_VFS static int audit_syslog_facility(vfs_handle_struct *handle) { static const struct enum_list enum_log_facilities[] = { { LOG_USER, "USER" }, { LOG_LOCAL0, "LOCAL0" }, { LOG_LOCAL1, "LOCAL1" }, { LOG_LOCAL2, "LOCAL2" }, { LOG_LOCAL3, "LOCAL3" }, { LOG_LOCAL4, "LOCAL4" }, { LOG_LOCAL5, "LOCAL5" }, { LOG_LOCAL6, "LOCAL6" }, { LOG_LOCAL7, "LOCAL7" }, { -1, NULL} }; int facility; facility = lp_parm_enum(SNUM(handle->conn), "audit", "facility", enum_log_facilities, LOG_USER); return facility; } static int audit_syslog_priority(vfs_handle_struct *handle) { static const struct enum_list enum_log_priorities[] = { { LOG_EMERG, "EMERG" }, { LOG_ALERT, "ALERT" }, { LOG_CRIT, "CRIT" }, { LOG_ERR, "ERR" }, { LOG_WARNING, "WARNING" }, { LOG_NOTICE, "NOTICE" }, { LOG_INFO, "INFO" }, { LOG_DEBUG, "DEBUG" }, { -1, NULL} }; int priority; priority = lp_parm_enum(SNUM(handle->conn), "audit", "priority", enum_log_priorities, LOG_NOTICE); if (priority == -1) { priority = LOG_WARNING; } return priority; } /* Implementation of vfs_ops. Pass everything on to the default operation but log event first. */ static int audit_connect(vfs_handle_struct *handle, const char *svc, const char *user) { int result; result = SMB_VFS_NEXT_CONNECT(handle, svc, user); if (result < 0) { return result; } openlog("smbd_audit", LOG_PID, audit_syslog_facility(handle)); syslog(audit_syslog_priority(handle), "connect to service %s by user %s\n", svc, user); return 0; } static void audit_disconnect(vfs_handle_struct *handle) { syslog(audit_syslog_priority(handle), "disconnected\n"); SMB_VFS_NEXT_DISCONNECT(handle); return; } static SMB_STRUCT_DIR *audit_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) { SMB_STRUCT_DIR *result; result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr); syslog(audit_syslog_priority(handle), "opendir %s %s%s\n", fname, (result == NULL) ? "failed: " : "", (result == NULL) ? strerror(errno) : ""); return result; } static int audit_mkdir(vfs_handle_struct *handle, const char *path, mode_t mode) { int result; result = SMB_VFS_NEXT_MKDIR(handle, path, mode); syslog(audit_syslog_priority(handle), "mkdir %s %s%s\n", path, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_rmdir(vfs_handle_struct *handle, const char *path) { int result; result = SMB_VFS_NEXT_RMDIR(handle, path); syslog(audit_syslog_priority(handle), "rmdir %s %s%s\n", path, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_open(vfs_handle_struct *handle, struct smb_filename *smb_fname, files_struct *fsp, int flags, mode_t mode) { int result; result = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode); syslog(audit_syslog_priority(handle), "open %s (fd %d) %s%s%s\n", smb_fname->base_name, result, ((flags & O_WRONLY) || (flags & O_RDWR)) ? "for writing " : "", (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_close(vfs_handle_struct *handle, files_struct *fsp) { int result; result = SMB_VFS_NEXT_CLOSE(handle, fsp); syslog(audit_syslog_priority(handle), "close fd %d %s%s\n", fsp->fh->fd, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) { int result; result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst); syslog(audit_syslog_priority(handle), "rename %s -> %s %s%s\n", smb_fname_src->base_name, smb_fname_dst->base_name, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_unlink(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { int result; result = SMB_VFS_NEXT_UNLINK(handle, smb_fname); syslog(audit_syslog_priority(handle), "unlink %s %s%s\n", smb_fname->base_name, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) { int result; result = SMB_VFS_NEXT_CHMOD(handle, path, mode); syslog(audit_syslog_priority(handle), "chmod %s mode 0x%x %s%s\n", path, mode, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_chmod_acl(vfs_handle_struct *handle, const char *path, mode_t mode) { int result; result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode); syslog(audit_syslog_priority(handle), "chmod_acl %s mode 0x%x %s%s\n", path, mode, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; result = SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); syslog(audit_syslog_priority(handle), "fchmod %s mode 0x%x %s%s\n", fsp->fsp_name->base_name, mode, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static int audit_fchmod_acl(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { int result; result = SMB_VFS_NEXT_FCHMOD_ACL(handle, fsp, mode); syslog(audit_syslog_priority(handle), "fchmod_acl %s mode 0x%x %s%s\n", fsp->fsp_name->base_name, mode, (result < 0) ? "failed: " : "", (result < 0) ? strerror(errno) : ""); return result; } static struct vfs_fn_pointers vfs_audit_fns = { .connect_fn = audit_connect, .disconnect_fn = audit_disconnect, .opendir_fn = audit_opendir, .mkdir_fn = audit_mkdir, .rmdir_fn = audit_rmdir, .open_fn = audit_open, .close_fn = audit_close, .rename_fn = audit_rename, .unlink_fn = audit_unlink, .chmod_fn = audit_chmod, .fchmod_fn = audit_fchmod, .chmod_acl_fn = audit_chmod_acl, .fchmod_acl_fn = audit_fchmod_acl }; NTSTATUS vfs_audit_init(void) { return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "audit", &vfs_audit_fns); }
wimberosa/samba
source3/modules/vfs_audit.c
C
gpl-3.0
7,422
package org.esa.snap.core.gpf.ui.resample; import com.bc.ceres.binding.ConversionException; import com.bc.ceres.binding.Property; import com.bc.ceres.binding.PropertyDescriptor; import com.bc.ceres.binding.PropertySet; import com.bc.ceres.binding.ValidationException; import com.bc.ceres.binding.ValueRange; import com.bc.ceres.binding.ValueSet; import com.bc.ceres.swing.TableLayout; import com.bc.ceres.swing.binding.BindingContext; import com.bc.ceres.swing.binding.PropertyEditor; import com.bc.ceres.swing.binding.PropertyEditorRegistry; import com.bc.ceres.swing.selection.AbstractSelectionChangeListener; import com.bc.ceres.swing.selection.Selection; import com.bc.ceres.swing.selection.SelectionChangeEvent; import org.esa.snap.core.datamodel.Band; import org.esa.snap.core.datamodel.CrsGeoCoding; import org.esa.snap.core.datamodel.GeoCoding; import org.esa.snap.core.datamodel.Product; import org.esa.snap.core.datamodel.ProductNodeEvent; import org.esa.snap.core.datamodel.ProductNodeGroup; import org.esa.snap.core.datamodel.ProductNodeListener; import org.esa.snap.core.datamodel.RasterDataNode; import org.esa.snap.core.datamodel.TiePointGrid; import org.esa.snap.core.gpf.GPF; import org.esa.snap.core.gpf.OperatorSpi; import org.esa.snap.core.gpf.common.resample.BandResamplingPreset; import org.esa.snap.core.gpf.common.resample.ResampleUtils; import org.esa.snap.core.gpf.common.resample.ResamplingPreset; import org.esa.snap.core.gpf.descriptor.OperatorDescriptor; import org.esa.snap.core.gpf.ui.DefaultIOParametersPanel; import org.esa.snap.core.gpf.ui.OperatorMenu; import org.esa.snap.core.gpf.ui.OperatorParameterSupport; import org.esa.snap.core.gpf.ui.ParameterUpdater; import org.esa.snap.core.gpf.ui.SingleTargetProductDialog; import org.esa.snap.core.gpf.ui.SourceProductSelector; import org.esa.snap.core.gpf.ui.TargetProductSelectorModel; import org.esa.snap.core.util.SystemUtils; import org.esa.snap.core.util.io.SnapFileFilter; import org.esa.snap.tango.TangoIcons; import org.esa.snap.ui.AbstractDialog; import org.esa.snap.ui.AppContext; import org.esa.snap.ui.SnapFileChooser; import org.netbeans.swing.outline.DefaultOutlineModel; import org.netbeans.swing.outline.Outline; import org.netbeans.swing.outline.OutlineModel; import javax.swing.*; import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * @author Tonio Fincke */ class ResamplingDialog extends SingleTargetProductDialog { private final String operatorName; private final OperatorDescriptor operatorDescriptor; private final String REFERENCE_BAND_TOOLTIP_TEXT = "<html>Set the reference band.<br/>" + "All other bands will be resampled to match its size and resolution.</html>"; private final String TARGET_WIDTH_AND_HEIGHT_TOOLTIP_TEXT = "<html>Set explicitly the width and height of the resampled product.<br/>" + "This option is only available when all bands have the same offset.</html>"; private final String TARGET_RESOLUTION_TOOLTIP_TEXT = "<html>Define the target resolution of the resampled product.<br/>" + "This option is only available for products with a geocoding based on a cartographic map CRS.</html>"; private static final String REFERENCE_BAND_NAME_PROPERTY_NAME = "referenceBandName"; private static final String TARGET_WIDTH_PROPERTY_NAME = "targetWidth"; private static final String TARGET_HEIGHT_PROPERTY_NAME = "targetHeight"; private static final String TARGET_RESOLUTION_PROPERTY_NAME = "targetResolution"; private static final int REFERENCE_BAND_NAME_PANEL_INDEX = 0; private static final int TARGET_WIDTH_AND_HEIGHT_PANEL_INDEX = 1; private static final int TARGET_RESOLUTION_PANEL_INDEX = 2; private DefaultIOParametersPanel ioParametersPanel; private final OperatorParameterSupport parameterSupport; private final BindingContext bindingContext; private JTabbedPane form; private String targetProductNameSuffix; private ProductChangedHandler productChangedHandler; private Product targetProduct; private JRadioButton referenceBandButton; private JRadioButton widthAndHeightButton; private JRadioButton resolutionButton; private ReferenceBandNameBoxPanel referenceBandNameBoxPanel; private TargetWidthAndHeightPanel targetWidthAndHeightPanel; private TargetResolutionPanel targetResolutionPanel; private JPanel advancedMethodDefinitionPanel; private JPanel loadPresetPanel; JCheckBox advancedMethodCheckBox; JPanel upsamplingMethodPanel; JPanel downsamplingMethodPanel; JPanel flagDownsamplingMethodPanel; private BandResamplingPreset[] bandResamplingPresets; OutlineModel mdl = null; Outline outline1 = null; ResamplingRowModel resamplingRowModel; ResamplingDialog(AppContext appContext, Product product, boolean modal) { super(appContext, "Resampling", ID_APPLY_CLOSE, "resampleAction"); this.operatorName = "Resample"; targetProductNameSuffix = "_resampled"; getTargetProductSelector().getModel().setSaveToFileSelected(false); getJDialog().setModal(modal); OperatorSpi operatorSpi = GPF.getDefaultInstance().getOperatorSpiRegistry().getOperatorSpi(operatorName); if (operatorSpi == null) { throw new IllegalArgumentException("No SPI found for operator name '" + operatorName + "'"); } operatorDescriptor = operatorSpi.getOperatorDescriptor(); ioParametersPanel = new DefaultIOParametersPanel(getAppContext(), operatorDescriptor, getTargetProductSelector(), true); targetProduct = null; parameterSupport = new OperatorParameterSupport(operatorDescriptor, null, null, new ResamplingParameterUpdater()); final ArrayList<SourceProductSelector> sourceProductSelectorList = ioParametersPanel.getSourceProductSelectorList(); final PropertySet propertySet = parameterSupport.getPropertySet(); bindingContext = new BindingContext(propertySet); final Property referenceBandNameProperty = bindingContext.getPropertySet().getProperty(REFERENCE_BAND_NAME_PROPERTY_NAME); referenceBandNameProperty.getDescriptor().addAttributeChangeListener(evt -> { if (evt.getPropertyName().equals("valueSet")) { final Object[] valueSetItems = ((ValueSet) evt.getNewValue()).getItems(); if (valueSetItems.length > 0) { try { referenceBandNameProperty.setValue(valueSetItems[0].toString()); } catch (ValidationException e) { //don't set it then } } } }); final ValueRange valueRange = new ValueRange(0, Integer.MAX_VALUE); bindingContext.getPropertySet().getProperty(TARGET_WIDTH_PROPERTY_NAME).getDescriptor().setValueRange(valueRange); bindingContext.getPropertySet().getProperty(TARGET_HEIGHT_PROPERTY_NAME).getDescriptor().setValueRange(valueRange); bindingContext.getPropertySet().getProperty(TARGET_RESOLUTION_PROPERTY_NAME).getDescriptor().setValueRange(valueRange); productChangedHandler = new ProductChangedHandler(); sourceProductSelectorList.get(0).initProducts(); sourceProductSelectorList.get(0).setSelectedProduct(product); sourceProductSelectorList.get(0).addSelectionChangeListener(productChangedHandler); } @Override public int show() { if (form == null) { initForm(); if (getJDialog().getJMenuBar() == null) { final OperatorMenu operatorMenu = createDefaultMenuBar(); getJDialog().setJMenuBar(operatorMenu.createDefaultMenu()); } } ioParametersPanel.initSourceProductSelectors(); setContent(form); return super.show(); } @Override public void hide() { productChangedHandler.releaseProduct(); ioParametersPanel.releaseSourceProductSelectors(); super.hide(); } @Override protected void onApply() { super.onApply(); if (targetProduct != null && getJDialog().isModal()) { close(); } } @Override protected Product createTargetProduct() throws Exception { final HashMap<String, Product> sourceProducts = ioParametersPanel.createSourceProductsMap(); final HashMap<String, Object> resampParams = new HashMap<>(); if(referenceBandButton.isSelected()) { resampParams.put("referenceBandName", referenceBandNameBoxPanel.getSelectedReferenceBand()); } else if (widthAndHeightButton.isSelected()) { resampParams.put("targetWidth", targetWidthAndHeightPanel.getWidthSelected()); resampParams.put("targetHeight", targetWidthAndHeightPanel.getHeightSelected()); } else if (resolutionButton.isSelected()) { resampParams.put("targetResolution", targetResolutionPanel.getResolutionSelected()); } resampParams.put("upsamplingMethod", parameterSupport.getParameterMap().get("upsamplingMethod")); resampParams.put("downsamplingMethod", parameterSupport.getParameterMap().get("downsamplingMethod")); resampParams.put("flagDownsamplingMethod", parameterSupport.getParameterMap().get("flagDownsamplingMethod")); if(advancedMethodCheckBox.isSelected()) { resampParams.put("bandResamplings", generateBandResamplings(sourceProducts.get("sourceProduct"))); } resampParams.put("resampleOnPyramidLevels", parameterSupport.getParameterMap().get("resampleOnPyramidLevels")); targetProduct = GPF.createProduct(operatorName, resampParams, sourceProducts); return targetProduct; } private String generateBandResamplings(Product sourceProduct) { updateResamplingPreset(); String bandResamplingsString = ""; for(String bandName : sourceProduct.getBandNames()) { for(BandResamplingPreset bandResamplingPreset : bandResamplingPresets) { if(bandResamplingPreset.getBandName().equals(bandName)){ if(!bandResamplingsString.isEmpty()) { bandResamplingsString = bandResamplingsString + ResamplingPreset.STRING_SEPARATOR; } bandResamplingsString = bandResamplingsString + bandResamplingPreset.getBandName() + BandResamplingPreset.SEPARATOR + bandResamplingPreset.getDownsamplingAlias() + BandResamplingPreset.SEPARATOR + bandResamplingPreset.getUpsamplingAlias(); } } } return bandResamplingsString; } Product getTargetProduct() { return targetProduct; } private void initForm() { form = new JTabbedPane(); form.add("I/O Parameters", ioParametersPanel); form.add("Resampling Parameters", new JScrollPane(createParametersPanel())); reactToSourceProductChange(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct()); } private JPanel createParametersPanel() { final PropertyEditorRegistry registry = PropertyEditorRegistry.getInstance(); final PropertySet propertySet = bindingContext.getPropertySet(); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayout.setTableWeightX(1.0); tableLayout.setTablePadding(4, 4); final TableLayout defineTargetResolutionPanelLayout = new TableLayout(2); defineTargetResolutionPanelLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); defineTargetResolutionPanelLayout.setTableFill(TableLayout.Fill.HORIZONTAL); defineTargetResolutionPanelLayout.setColumnWeightX(1, 1.0); defineTargetResolutionPanelLayout.setTablePadding(4, 5); final JPanel defineTargetSizePanel = new JPanel(defineTargetResolutionPanelLayout); defineTargetSizePanel.setBorder(BorderFactory.createTitledBorder("Define size of resampled product")); final ButtonGroup targetSizeButtonGroup = new ButtonGroup(); referenceBandButton = new JRadioButton("By reference band from source product:"); referenceBandButton.setToolTipText(REFERENCE_BAND_TOOLTIP_TEXT); widthAndHeightButton = new JRadioButton("By target width and height:"); widthAndHeightButton.setToolTipText(TARGET_WIDTH_AND_HEIGHT_TOOLTIP_TEXT); resolutionButton = new JRadioButton("By pixel resolution (in m):"); resolutionButton.setToolTipText(TARGET_RESOLUTION_TOOLTIP_TEXT); targetSizeButtonGroup.add(referenceBandButton); targetSizeButtonGroup.add(widthAndHeightButton); targetSizeButtonGroup.add(resolutionButton); defineTargetSizePanel.add(referenceBandButton); referenceBandNameBoxPanel = new ReferenceBandNameBoxPanel(); defineTargetSizePanel.add(referenceBandNameBoxPanel); defineTargetSizePanel.add(widthAndHeightButton); targetWidthAndHeightPanel = new TargetWidthAndHeightPanel(); defineTargetSizePanel.add(targetWidthAndHeightPanel); defineTargetSizePanel.add(resolutionButton); targetResolutionPanel = new TargetResolutionPanel(); defineTargetSizePanel.add(targetResolutionPanel); referenceBandButton.addActionListener(e -> { if (referenceBandButton.isSelected()) { enablePanel(REFERENCE_BAND_NAME_PANEL_INDEX); } }); widthAndHeightButton.addActionListener(e -> { if (widthAndHeightButton.isSelected()) { enablePanel(TARGET_WIDTH_AND_HEIGHT_PANEL_INDEX); } }); resolutionButton.addActionListener(e -> { if (resolutionButton.isSelected()) { enablePanel(TARGET_RESOLUTION_PANEL_INDEX); } }); referenceBandButton.setSelected(true); final TableLayout tableLayoutMethodDefinition = new TableLayout(1); tableLayoutMethodDefinition.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayoutMethodDefinition.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayoutMethodDefinition.setTableWeightX(1.0); tableLayoutMethodDefinition.setTablePadding(4, 4); JPanel methodDefinitionPanel = new JPanel(tableLayoutMethodDefinition); methodDefinitionPanel.setBorder(BorderFactory.createTitledBorder("Define resampling algorithm")); upsamplingMethodPanel = createPropertyPanel(propertySet, "upsamplingMethod", registry); downsamplingMethodPanel = createPropertyPanel(propertySet, "downsamplingMethod", registry); flagDownsamplingMethodPanel = createPropertyPanel(propertySet, "flagDownsamplingMethod", registry); //Create advancedMethodDefinitionPanel advancedMethodDefinitionPanel = createAdvancedMethodDefinitionPanel(); //Create load preset panel loadPresetPanel = createLoadSavePresetPanel(); methodDefinitionPanel.add(upsamplingMethodPanel); methodDefinitionPanel.add(tableLayout.createVerticalSpacer()); methodDefinitionPanel.add(downsamplingMethodPanel); methodDefinitionPanel.add(tableLayout.createVerticalSpacer()); methodDefinitionPanel.add(flagDownsamplingMethodPanel); methodDefinitionPanel.add(tableLayout.createVerticalSpacer()); methodDefinitionPanel.add(createAdvancedCheckBoxPanel()); methodDefinitionPanel.add(advancedMethodDefinitionPanel); methodDefinitionPanel.add(loadPresetPanel); final JPanel resampleOnPyramidLevelsPanel = createPropertyPanel(propertySet, "resampleOnPyramidLevels", registry); //Add all panels final JPanel parametersPanel = new JPanel(tableLayout); parametersPanel.setBorder(new EmptyBorder(4, 4, 4, 4)); parametersPanel.add(defineTargetSizePanel); parametersPanel.add(methodDefinitionPanel); parametersPanel.add(resampleOnPyramidLevelsPanel); parametersPanel.add(tableLayout.createVerticalSpacer()); return parametersPanel; } private void enablePanel(int panelIndex) { referenceBandNameBoxPanel.setEnabled(panelIndex == 0); targetWidthAndHeightPanel.setEnabled(panelIndex == 1); targetResolutionPanel.setEnabled(panelIndex == 2); } private JPanel createPropertyPanel(PropertySet propertySet, String propertyName, PropertyEditorRegistry registry) { final PropertyDescriptor descriptor = propertySet.getProperty(propertyName).getDescriptor(); PropertyEditor propertyEditor = registry.findPropertyEditor(descriptor); JComponent[] components = propertyEditor.createComponents(descriptor, bindingContext); final JPanel propertyPanel = new JPanel(new GridLayout(1, components.length)); for (int i = components.length - 1; i >= 0; i--) { propertyPanel.add(components[i]); } return propertyPanel; } private void setEnableRec(Component container, boolean enable){ container.setEnabled(enable); try { Component[] components= ((Container) container).getComponents(); for (int i = 0; i < components.length; i++) { setEnableRec(components[i], enable); } } catch (ClassCastException e) { } } private JPanel createAdvancedCheckBoxPanel() { advancedMethodCheckBox = new JCheckBox("Advanced Method Definition by Band", false); advancedMethodCheckBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) { advancedMethodDefinitionPanel.setVisible(true); loadPresetPanel.setVisible(true); setEnableRec(upsamplingMethodPanel,false); setEnableRec(downsamplingMethodPanel,false); setEnableRec(flagDownsamplingMethodPanel,false); } else { advancedMethodDefinitionPanel.setVisible(false); loadPresetPanel.setVisible(false); setEnableRec(upsamplingMethodPanel,true); setEnableRec(downsamplingMethodPanel,true); setEnableRec(flagDownsamplingMethodPanel,true); } } }); final JPanel propertyPanel = new JPanel(new GridLayout(1, 1)); propertyPanel.add(advancedMethodCheckBox); return propertyPanel; } private JPanel createAdvancedMethodDefinitionPanel() { final TableLayout tableLayoutMethodDefinition = new TableLayout(1); tableLayoutMethodDefinition.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayoutMethodDefinition.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayoutMethodDefinition.setTableWeightX(1.0); tableLayoutMethodDefinition.setTablePadding(4, 4); JPanel panel = new JPanel(tableLayoutMethodDefinition); if(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct() != null) { BandsTreeModel myModel = new BandsTreeModel(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct()); bandResamplingPresets = new BandResamplingPreset[myModel.getTotalRows()]; for(int i = 0 ; i < myModel.getTotalRows() ; i++) { bandResamplingPresets[i] = new BandResamplingPreset(myModel.getRows()[i], (String) (parameterSupport.getParameterMap().get("downsamplingMethod")) , (String) (parameterSupport.getParameterMap().get("upsamplingMethod"))); } resamplingRowModel = new ResamplingRowModel(bandResamplingPresets, myModel); mdl = DefaultOutlineModel.createOutlineModel( myModel, resamplingRowModel, true, "Bands"); outline1 = new Outline(); outline1.setRootVisible(false); outline1.setModel(mdl); ResamplingUtils.setUpUpsamplingColumn(outline1,outline1.getColumnModel().getColumn(1), (String) parameterSupport.getParameterMap().get("upsamplingMethod")); ResamplingUtils.setUpDownsamplingColumn(outline1,outline1.getColumnModel().getColumn(2), (String) parameterSupport.getParameterMap().get("downsamplingMethod")); JScrollPane tableContainer = new JScrollPane(outline1); panel.add(tableContainer); panel.setVisible(false); } return panel; } private JPanel createLoadSavePresetPanel() { final TableLayout tableLayoutMethodDefinition = new TableLayout(2); tableLayoutMethodDefinition.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayoutMethodDefinition.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayoutMethodDefinition.setTableWeightX(1.0); tableLayoutMethodDefinition.setTablePadding(4, 4); JPanel panel = new JPanel(tableLayoutMethodDefinition); //Add Load preset button final ImageIcon loadIcon = TangoIcons.actions_document_open(TangoIcons.Res.R22); JButton loadButton = new JButton("Import Preset...", loadIcon); loadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SnapFileChooser fileChooser = new SnapFileChooser(SystemUtils.getAuxDataPath().resolve(ResamplingUtils.RESAMPLING_PRESET_FOLDER).toFile()); fileChooser.setAcceptAllFileFilterUsed(true); fileChooser.setDialogTitle("Select resampling preset"); SnapFileFilter fileFilter = new SnapFileFilter("ResPreset", ".res", "Resampling preset files"); fileChooser.addChoosableFileFilter(fileFilter); fileChooser.setFileFilter(fileFilter); fileChooser.setDialogType(SnapFileChooser.OPEN_DIALOG); File selectedFile; while (true) { int i = fileChooser.showDialog(panel, null); if (i == SnapFileChooser.APPROVE_OPTION) { selectedFile = fileChooser.getSelectedFile(); try { ResamplingPreset resamplingPreset = ResamplingPreset.loadResamplingPreset(selectedFile); //check that bands corresponds with opened product if(!resamplingPreset.isCompatibleWithProduct(ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct())) { AbstractDialog.showWarningDialog(panel, "Resampling preset incompatible with selected input product.", "Resampling preset incompatibility"); break; } //TODO that check upsampling and resampling method exist bandResamplingPresets = resamplingPreset.getBandResamplingPresets().toArray(new BandResamplingPreset[resamplingPreset.getBandResamplingPresets().size()]); for(BandResamplingPreset bandResamplingPreset : resamplingPreset.getBandResamplingPresets()) { resamplingRowModel.setValueFor(bandResamplingPreset.getBandName(),0,bandResamplingPreset.getUpsamplingAlias()); resamplingRowModel.setValueFor(bandResamplingPreset.getBandName(),1,bandResamplingPreset.getDownsamplingAlias()); advancedMethodDefinitionPanel.repaint(); } } catch (IOException e1) { AbstractDialog.showWarningDialog(panel, "Cannot load resampling preset.", "Cannot load resampling preset."); } break; } else { // Canceled selectedFile = null; break; } } } }); panel.add(loadButton); //Add Save preset button final ImageIcon saveIcon = TangoIcons.actions_document_save_as(TangoIcons.Res.R22); JButton saveButton = new JButton("Save Preset", saveIcon); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { SnapFileChooser fileChooser = new SnapFileChooser(SystemUtils.getAuxDataPath().resolve(ResamplingUtils.RESAMPLING_PRESET_FOLDER).toFile()); fileChooser.setAcceptAllFileFilterUsed(true); fileChooser.setDialogTitle("Select resampling preset"); SnapFileFilter fileFilter = new SnapFileFilter("ResPreset", ".res", "Resampling preset files"); fileChooser.addChoosableFileFilter(fileFilter); fileChooser.setFileFilter(fileFilter); fileChooser.setDialogType(SnapFileChooser.SAVE_DIALOG); File selectedFile; while (true) { int i = fileChooser.showDialog(panel, null); if (i == SnapFileChooser.APPROVE_OPTION) { selectedFile = fileChooser.getSelectedFile(); if (!selectedFile.exists()) { break; } i = JOptionPane.showConfirmDialog(panel, "The file\n" + selectedFile + "\nalready exists.\nOverwrite?", "File exists", JOptionPane.YES_NO_CANCEL_OPTION); if (i == JOptionPane.CANCEL_OPTION) { // Canceled selectedFile = null; break; } else if (i == JOptionPane.YES_OPTION) { // Overwrite existing file break; } } else { // Canceled selectedFile = null; break; } } if(selectedFile != null) { //update BandResamplingPresets with values of table updateResamplingPreset(); ResamplingPreset auxPreset = new ResamplingPreset(selectedFile.getName(),bandResamplingPresets); auxPreset.saveToFile(selectedFile, ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct()); } } }); panel.add(saveButton); panel.setVisible(false); return panel; } private OperatorMenu createDefaultMenuBar() { return new OperatorMenu(getJDialog(), operatorDescriptor, parameterSupport, getAppContext(), getHelpID()); } private void reactToSourceProductChange(Product product) { referenceBandNameBoxPanel.reactToSourceProductChange(product); targetWidthAndHeightPanel.reactToSourceProductChange(product); targetResolutionPanel.reactToSourceProductChange(product); if (product != null) { referenceBandButton.setEnabled(product.getBandNames().length > 0); final ProductNodeGroup<Band> productBands = product.getBandGroup(); final ProductNodeGroup<TiePointGrid> productTiePointGrids = product.getTiePointGridGroup(); double xOffset = Double.NaN; double yOffset = Double.NaN; if (productBands.getNodeCount() > 0) { xOffset = productBands.get(0).getImageToModelTransform().getTranslateX(); yOffset = productBands.get(0).getImageToModelTransform().getTranslateY(); } else if (productTiePointGrids.getNodeCount() > 0) { xOffset = productTiePointGrids.get(0).getImageToModelTransform().getTranslateX(); yOffset = productTiePointGrids.get(0).getImageToModelTransform().getTranslateY(); } boolean allowToSetWidthAndHeight = true; if (!Double.isNaN(xOffset) && !Double.isNaN(yOffset)) { allowToSetWidthAndHeight = allOffsetsAreEqual(productBands, xOffset, yOffset) && allOffsetsAreEqual(productTiePointGrids, xOffset, yOffset); } widthAndHeightButton.setEnabled(allowToSetWidthAndHeight); final GeoCoding sceneGeoCoding = product.getSceneGeoCoding(); resolutionButton.setEnabled(sceneGeoCoding instanceof CrsGeoCoding && ResampleUtils.allGridsAlignAtUpperLeftPixel(product)); } if (referenceBandButton.isEnabled()) { referenceBandButton.setSelected(true); referenceBandNameBoxPanel.setEnabled(true); } else if (widthAndHeightButton.isEnabled()) { widthAndHeightButton.setSelected(true); } else if (resolutionButton.isEnabled()) { resolutionButton.setSelected(true); } if(product != null) { advancedMethodDefinitionPanel.removeAll(); BandsTreeModel myModel = new BandsTreeModel(product); bandResamplingPresets = new BandResamplingPreset[myModel.getTotalRows()]; for(int i = 0 ; i < myModel.getTotalRows() ; i++) { bandResamplingPresets[i] = new BandResamplingPreset(myModel.getRows()[i], (String) (parameterSupport.getParameterMap().get("downsamplingMethod")),(String) (parameterSupport.getParameterMap().get("upsamplingMethod"))); } resamplingRowModel = new ResamplingRowModel(bandResamplingPresets, myModel); //Create the Outline's model, consisting of the TreeModel and the RowModel mdl = DefaultOutlineModel.createOutlineModel( myModel, resamplingRowModel, true, "Products"); Outline outline1 = new Outline(); outline1.setRootVisible(false); outline1.setModel(mdl); ResamplingUtils.setUpUpsamplingColumn(outline1,outline1.getColumnModel().getColumn(1), (String) parameterSupport.getParameterMap().get("upsamplingMethod")); ResamplingUtils.setUpDownsamplingColumn(outline1,outline1.getColumnModel().getColumn(2), (String) parameterSupport.getParameterMap().get("downsamplingMethod")); JScrollPane tableContainer = new JScrollPane(outline1); advancedMethodDefinitionPanel.add(tableContainer); advancedMethodDefinitionPanel.revalidate(); advancedMethodDefinitionPanel.setVisible(advancedMethodCheckBox.isSelected()); } } private void updateResamplingPreset() { if(bandResamplingPresets == null) { return; } for (BandResamplingPreset bandResamplingPreset : bandResamplingPresets) { bandResamplingPreset.setUpsamplingAlias((String) resamplingRowModel.getValueFor(bandResamplingPreset.getBandName(),0)); bandResamplingPreset.setDownsamplingAlias((String) resamplingRowModel.getValueFor(bandResamplingPreset.getBandName(),1)); } } private RasterDataNode getAnyRasterDataNode(Product product) { RasterDataNode node = null; if (product != null) { final ProductNodeGroup<Band> bandGroup = product.getBandGroup(); if (bandGroup.getNodeCount() == 0) { final ProductNodeGroup<TiePointGrid> tiePointGridGroup = product.getTiePointGridGroup(); if (tiePointGridGroup.getNodeCount() > 0) { node = tiePointGridGroup.get(0); } } else { node = bandGroup.get(0); } } return node; } private boolean allOffsetsAreEqual(ProductNodeGroup productNodeGroup, double xOffset, double yOffset) { for (int i = 0; i < productNodeGroup.getNodeCount(); i++) { final double nodeXOffset = ((RasterDataNode) productNodeGroup.get(i)).getImageToModelTransform().getTranslateX(); final double nodeYOffset = ((RasterDataNode) productNodeGroup.get(i)).getImageToModelTransform().getTranslateY(); if (Math.abs(nodeXOffset - xOffset) > 1e-8 || Math.abs(nodeYOffset - yOffset) > 1e-8) { return false; } } return true; } private class TargetResolutionPanel extends JPanel { private JSpinner resolutionSpinner; private JLabel targetResolutionTargetWidthLabel; private JLabel targetResolutionTargetHeightLabel; private final JLabel targetResolutionTargetWidthNameLabel; private final JLabel targetResolutionNameTargetHeightLabel; TargetResolutionPanel() { setToolTipText(TARGET_RESOLUTION_TOOLTIP_TEXT); resolutionSpinner = new JSpinner(new SpinnerNumberModel(1, 1, Integer.MAX_VALUE, 1)); resolutionSpinner.setEnabled(false); resolutionSpinner.addChangeListener(e -> updateTargetResolution()); final GridLayout layout = new GridLayout(3, 1); layout.setVgap(2); setLayout(layout); JPanel targetResolutionTargetWidthPanel = new JPanel(new GridLayout(1, 2)); targetResolutionTargetWidthNameLabel = new JLabel("Resulting target width: "); targetResolutionTargetWidthNameLabel.setEnabled(false); targetResolutionTargetWidthPanel.add(targetResolutionTargetWidthNameLabel); targetResolutionTargetWidthLabel = new JLabel(); targetResolutionTargetWidthLabel.setEnabled(false); targetResolutionTargetWidthPanel.add(targetResolutionTargetWidthLabel); JPanel targetResolutionTargetHeightPanel = new JPanel(new GridLayout(1, 2)); targetResolutionNameTargetHeightLabel = new JLabel("Resulting target height: "); targetResolutionNameTargetHeightLabel.setEnabled(false); targetResolutionTargetHeightPanel.add(targetResolutionNameTargetHeightLabel); targetResolutionTargetHeightLabel = new JLabel(); targetResolutionTargetHeightLabel.setEnabled(false); targetResolutionTargetHeightPanel.add(targetResolutionTargetHeightLabel); add(resolutionSpinner); add(targetResolutionTargetWidthPanel); add(targetResolutionTargetHeightPanel); } @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); resolutionSpinner.setEnabled(enabled); targetResolutionTargetWidthLabel.setEnabled(enabled); targetResolutionTargetHeightLabel.setEnabled(enabled); targetResolutionTargetWidthNameLabel.setEnabled(enabled); targetResolutionNameTargetHeightLabel.setEnabled(enabled); if (enabled) { updateTargetResolution(); } } private void updateTargetResolution() { bindingContext.getPropertySet().setValue(REFERENCE_BAND_NAME_PROPERTY_NAME, null); bindingContext.getPropertySet().setValue(TARGET_WIDTH_PROPERTY_NAME, null); bindingContext.getPropertySet().setValue(TARGET_HEIGHT_PROPERTY_NAME, null); bindingContext.getPropertySet().setValue(TARGET_RESOLUTION_PROPERTY_NAME, Integer.parseInt(resolutionSpinner.getValue().toString())); updateTargetResolutionTargetWidthAndHeight(); } private void updateTargetResolutionTargetWidthAndHeight() { final Product selectedProduct = ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct(); final RasterDataNode node = getAnyRasterDataNode(selectedProduct); int targetWidth = 0; int targetHeight = 0; if (node != null) { final int resolution = Integer.parseInt(resolutionSpinner.getValue().toString()); final double nodeResolution = node.getImageToModelTransform().getScaleX(); targetWidth = (int) (node.getRasterWidth() * (nodeResolution / resolution)); targetHeight = (int) (node.getRasterHeight() * (nodeResolution / resolution)); } targetResolutionTargetWidthLabel.setText("" + targetWidth); targetResolutionTargetHeightLabel.setText("" + targetHeight); } private void reactToSourceProductChange(Product product) { if (product != null) { resolutionSpinner.setValue(determineResolutionFromProduct(product)); } else { resolutionSpinner.setValue(0); } } private void handleParameterLoadRequest(Map<String, Object> parameterMap) { if (parameterMap.containsKey(TARGET_RESOLUTION_PROPERTY_NAME)) { resolutionSpinner.setValue(parameterMap.get(TARGET_RESOLUTION_PROPERTY_NAME)); resolutionButton.setSelected(true); enablePanel(TARGET_RESOLUTION_PANEL_INDEX); } } private int determineResolutionFromProduct(Product product) { final RasterDataNode node = getAnyRasterDataNode(product); if (node != null) { return (int) node.getImageToModelTransform().getScaleX(); } return 1; } public Object getResolutionSelected() { return resolutionSpinner.getValue(); } } private class TargetWidthAndHeightPanel extends JPanel { private JSpinner widthSpinner; private JSpinner heightSpinner; private double targetWidthHeightRatio; private final JLabel targetWidthNameLabel; private final JLabel targetHeightNameLabel; private final JLabel widthHeightRatioNameLabel; private JLabel widthHeightRatioLabel; private boolean updatingTargetWidthAndHeight; TargetWidthAndHeightPanel() { setToolTipText(TARGET_WIDTH_AND_HEIGHT_TOOLTIP_TEXT); updatingTargetWidthAndHeight = false; targetWidthHeightRatio = 1.0; final GridLayout layout = new GridLayout(3, 2); layout.setVgap(2); setLayout(layout); targetWidthNameLabel = new JLabel("Target width:"); targetWidthNameLabel.setEnabled(false); add(targetWidthNameLabel); widthSpinner = new JSpinner(new SpinnerNumberModel(100, 0, 1000000, 1)); widthSpinner.setEnabled(false); add(widthSpinner); targetHeightNameLabel = new JLabel("Target height:"); targetHeightNameLabel.setEnabled(false); add(targetHeightNameLabel); heightSpinner = new JSpinner(new SpinnerNumberModel(100, 0, 1000000, 1)); heightSpinner.setEnabled(false); add(heightSpinner); widthHeightRatioNameLabel = new JLabel("Width / height ratio: "); widthHeightRatioNameLabel.setEnabled(false); add(widthHeightRatioNameLabel); widthHeightRatioLabel = new JLabel(); widthHeightRatioLabel.setEnabled(false); add(widthHeightRatioLabel); widthSpinner.addChangeListener(e -> updateTargetWidth()); heightSpinner.addChangeListener(e -> updateTargetHeight()); } @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); widthSpinner.setEnabled(enabled); heightSpinner.setEnabled(enabled); widthHeightRatioLabel.setEnabled(enabled); targetWidthNameLabel.setEnabled(enabled); targetHeightNameLabel.setEnabled(enabled); widthHeightRatioNameLabel.setEnabled(enabled); if (enabled) { updateTargetWidthAndHeight(); } } private void updateTargetWidth() { if (!updatingTargetWidthAndHeight) { updatingTargetWidthAndHeight = true; final int targetWidth = Integer.parseInt(widthSpinner.getValue().toString()); final int targetHeight = (int) (targetWidth / targetWidthHeightRatio); heightSpinner.setValue(targetHeight); updateTargetWidthAndHeight(); updatingTargetWidthAndHeight = false; } } private void updateTargetHeight() { if (!updatingTargetWidthAndHeight) { updatingTargetWidthAndHeight = true; final int targetHeight = Integer.parseInt(heightSpinner.getValue().toString()); final int targetWidth = (int) (targetHeight * targetWidthHeightRatio); widthSpinner.setValue(targetWidth); updateTargetWidthAndHeight(); updatingTargetWidthAndHeight = false; } } private void updateTargetWidthAndHeight() { bindingContext.getPropertySet().setValue(REFERENCE_BAND_NAME_PROPERTY_NAME, null); bindingContext.getPropertySet().setValue(TARGET_WIDTH_PROPERTY_NAME, Integer.parseInt(widthSpinner.getValue().toString())); bindingContext.getPropertySet().setValue(TARGET_HEIGHT_PROPERTY_NAME, Integer.parseInt(heightSpinner.getValue().toString())); bindingContext.getPropertySet().setValue(TARGET_RESOLUTION_PROPERTY_NAME, null); } private void reactToSourceProductChange(Product product) { if (product != null) { targetWidthHeightRatio = product.getSceneRasterWidth() / (double) product.getSceneRasterHeight(); widthSpinner.setValue(product.getSceneRasterWidth()); heightSpinner.setValue(product.getSceneRasterHeight()); } else { targetWidthHeightRatio = 1.0; widthSpinner.setValue(0); heightSpinner.setValue(0); } widthHeightRatioLabel.setText(String.format("%.5f", targetWidthHeightRatio)); } private void handleParameterLoadRequest(Map<String, Object> parameterMap) { if (parameterMap.containsKey(TARGET_WIDTH_PROPERTY_NAME) && parameterMap.containsKey(TARGET_HEIGHT_PROPERTY_NAME)) { widthSpinner.setValue(parameterMap.get(TARGET_WIDTH_PROPERTY_NAME)); heightSpinner.setValue(parameterMap.get(TARGET_HEIGHT_PROPERTY_NAME)); widthAndHeightButton.setSelected(true); enablePanel(TARGET_WIDTH_AND_HEIGHT_PANEL_INDEX); } } public Object getWidthSelected(){ return widthSpinner.getValue(); } public Object getHeightSelected(){ return heightSpinner.getValue(); } } private class ReferenceBandNameBoxPanel extends JPanel { private JComboBox<String> referenceBandNameBox; private JLabel referenceBandTargetWidthLabel; private JLabel referenceBandTargetHeightLabel; private final JLabel referenceBandTargetHeightNameLabel; private final JLabel referenceBandTargetWidthNameLabel; ReferenceBandNameBoxPanel() { setToolTipText(REFERENCE_BAND_TOOLTIP_TEXT); referenceBandNameBox = new JComboBox<>(); referenceBandNameBox.addActionListener(e -> { updateReferenceBandTargetWidthAndHeight(); }); final GridLayout referenceBandNameBoxPanelLayout = new GridLayout(3, 1); referenceBandNameBoxPanelLayout.setVgap(2); setLayout(referenceBandNameBoxPanelLayout); add(referenceBandNameBox); JPanel referenceBandNameTargetWidthPanel = new JPanel(new GridLayout(1, 2)); referenceBandTargetWidthNameLabel = new JLabel("Resulting target width: "); referenceBandNameTargetWidthPanel.add(referenceBandTargetWidthNameLabel); referenceBandTargetWidthLabel = new JLabel(); referenceBandNameTargetWidthPanel.add(referenceBandTargetWidthLabel); JPanel referenceBandNameTargetHeightPanel = new JPanel(new GridLayout(1, 2)); referenceBandTargetHeightNameLabel = new JLabel("Resulting target height: "); referenceBandNameTargetHeightPanel.add(referenceBandTargetHeightNameLabel); referenceBandTargetHeightLabel = new JLabel(); referenceBandNameTargetHeightPanel.add(referenceBandTargetHeightLabel); add(referenceBandNameTargetWidthPanel); add(referenceBandNameTargetHeightPanel); referenceBandNameBox.addActionListener(e -> updateReferenceBandName()); } @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); referenceBandNameBox.setEnabled(enabled); referenceBandTargetWidthLabel.setEnabled(enabled); referenceBandTargetHeightLabel.setEnabled(enabled); referenceBandTargetWidthNameLabel.setEnabled(enabled); referenceBandTargetHeightNameLabel.setEnabled(enabled); if (enabled) { updateReferenceBandName(); } } private void updateReferenceBandTargetWidthAndHeight() { if (referenceBandNameBox.getSelectedItem() != null) { final String bandName = referenceBandNameBox.getSelectedItem().toString(); final Band band = ioParametersPanel.getSourceProductSelectorList().get(0).getSelectedProduct().getBand(bandName); referenceBandTargetWidthLabel.setText("" + band.getRasterWidth()); referenceBandTargetHeightLabel.setText("" + band.getRasterHeight()); } } private void updateReferenceBandName() { if (referenceBandNameBox.getSelectedItem() != null) { bindingContext.getPropertySet().setValue(REFERENCE_BAND_NAME_PROPERTY_NAME, referenceBandNameBox.getSelectedItem().toString()); } else { bindingContext.getPropertySet().setValue(REFERENCE_BAND_NAME_PROPERTY_NAME, null); } bindingContext.getPropertySet().setValue(TARGET_WIDTH_PROPERTY_NAME, null); bindingContext.getPropertySet().setValue(TARGET_HEIGHT_PROPERTY_NAME, null); bindingContext.getPropertySet().setValue(TARGET_RESOLUTION_PROPERTY_NAME, null); } private void reactToSourceProductChange(Product product) { referenceBandNameBox.removeAllItems(); String[] bandNames = new String[0]; if (product != null) { bandNames = product.getBandNames(); } bindingContext.getPropertySet().getProperty(REFERENCE_BAND_NAME_PROPERTY_NAME).getDescriptor().setValueSet(new ValueSet(bandNames)); referenceBandNameBox.setModel(new DefaultComboBoxModel<>(bandNames)); updateReferenceBandTargetWidthAndHeight(); } private void handleParameterLoadRequest(Map<String, Object> parameterMap) { if (parameterMap.containsKey(REFERENCE_BAND_NAME_PROPERTY_NAME)) { referenceBandNameBox.setSelectedItem(parameterMap.get(REFERENCE_BAND_NAME_PROPERTY_NAME)); referenceBandButton.setSelected(true); enablePanel(REFERENCE_BAND_NAME_PANEL_INDEX); } } public String getSelectedReferenceBand() { return referenceBandNameBox.getSelectedItem().toString(); } } private class ProductChangedHandler extends AbstractSelectionChangeListener implements ProductNodeListener { private Product currentProduct; public void releaseProduct() { if (currentProduct != null) { currentProduct.removeProductNodeListener(this); currentProduct = null; } } @Override public void selectionChanged(SelectionChangeEvent event) { Selection selection = event.getSelection(); if (selection != null) { final Product selectedProduct = (Product) selection.getSelectedValue(); if (selectedProduct != currentProduct) { if (currentProduct != null) { currentProduct.removeProductNodeListener(this); } currentProduct = selectedProduct; if (currentProduct != null) { currentProduct.addProductNodeListener(this); } if (getTargetProductSelector() != null) { updateTargetProductName(); } reactToSourceProductChange(currentProduct); } } } @Override public void nodeAdded(ProductNodeEvent event) { handleProductNodeEvent(); } @Override public void nodeChanged(ProductNodeEvent event) { handleProductNodeEvent(); } @Override public void nodeDataChanged(ProductNodeEvent event) { handleProductNodeEvent(); } @Override public void nodeRemoved(ProductNodeEvent event) { handleProductNodeEvent(); } private void updateTargetProductName() { String productName = ""; if (currentProduct != null) { productName = currentProduct.getName(); } final TargetProductSelectorModel targetProductSelectorModel = getTargetProductSelector().getModel(); targetProductSelectorModel.setProductName(productName + targetProductNameSuffix); } private void handleProductNodeEvent() { reactToSourceProductChange(currentProduct); } } private class ResamplingParameterUpdater implements ParameterUpdater { @Override public void handleParameterSaveRequest(Map<String, Object> parameterMap) throws ValidationException, ConversionException { } @Override public void handleParameterLoadRequest(Map<String, Object> parameterMap) throws ValidationException, ConversionException { referenceBandNameBoxPanel.handleParameterLoadRequest(parameterMap); targetWidthAndHeightPanel.handleParameterLoadRequest(parameterMap); targetResolutionPanel.handleParameterLoadRequest(parameterMap); } } }
senbox-org/snap-desktop
snap-gpf-ui/src/main/java/org/esa/snap/core/gpf/ui/resample/ResamplingDialog.java
Java
gpl-3.0
51,430
declare module goog { function require(name: 'goog.vec.mat4d'): typeof goog.vec.mat4d; } declare module goog.vec.mat4d { /** @typedef {goog.vec.Float64} */ type Type = goog.vec.Float64; /** * Creates a mat4d with all elements initialized to zero. * * @return {!goog.vec.mat4d.Type} The new mat4d. */ function create(): goog.vec.mat4d.Type; /** * Initializes the matrix from the set of values. Note the values supplied are * in column major order. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the * values. * @param {number} v00 The values at (0, 0). * @param {number} v10 The values at (1, 0). * @param {number} v20 The values at (2, 0). * @param {number} v30 The values at (3, 0). * @param {number} v01 The values at (0, 1). * @param {number} v11 The values at (1, 1). * @param {number} v21 The values at (2, 1). * @param {number} v31 The values at (3, 1). * @param {number} v02 The values at (0, 2). * @param {number} v12 The values at (1, 2). * @param {number} v22 The values at (2, 2). * @param {number} v32 The values at (3, 2). * @param {number} v03 The values at (0, 3). * @param {number} v13 The values at (1, 3). * @param {number} v23 The values at (2, 3). * @param {number} v33 The values at (3, 3). * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setFromValues(mat: goog.vec.mat4d.Type, v00: number, v10: number, v20: number, v30: number, v01: number, v11: number, v21: number, v31: number, v02: number, v12: number, v22: number, v32: number, v03: number, v13: number, v23: number, v33: number): goog.vec.mat4d.Type; /** * Initializes mat4d mat from mat4d src. * * @param {goog.vec.mat4d.Type} mat The destination matrix. * @param {goog.vec.mat4d.Type} src The source matrix. * @return {!goog.vec.mat4d.Type} Return mat so that operations can be * chained together. */ function setFromMat4d(mat: goog.vec.mat4d.Type, src: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Initializes mat4d mat from mat4f src (typed as a Float32Array to * avoid circular goog.requires). * * @param {goog.vec.mat4d.Type} mat The destination matrix. * @param {Float32Array} src The source matrix. * @return {!goog.vec.mat4d.Type} Return mat so that operations can be * chained together. */ function setFromMat4f(mat: goog.vec.mat4d.Type, src: Float32Array): goog.vec.mat4d.Type; /** * Initializes mat4d mat from Array src. * * @param {goog.vec.mat4d.Type} mat The destination matrix. * @param {Array<number>} src The source matrix. * @return {!goog.vec.mat4d.Type} Return mat so that operations can be * chained together. */ function setFromArray(mat: goog.vec.mat4d.Type, src: Array<number>): goog.vec.mat4d.Type; /** * Retrieves the element at the requested row and column. * * @param {goog.vec.mat4d.Type} mat The matrix containing the value to * retrieve. * @param {number} row The row index. * @param {number} column The column index. * @return {number} The element value at the requested row, column indices. */ function getElement(mat: goog.vec.mat4d.Type, row: number, column: number): number; /** * Sets the element at the requested row and column. * * @param {goog.vec.mat4d.Type} mat The matrix containing the value to * retrieve. * @param {number} row The row index. * @param {number} column The column index. * @param {number} value The value to set at the requested row, column. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setElement(mat: goog.vec.mat4d.Type, row: number, column: number, value: number): goog.vec.mat4d.Type; /** * Sets the diagonal values of the matrix from the given values. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the values. * @param {number} v00 The values for (0, 0). * @param {number} v11 The values for (1, 1). * @param {number} v22 The values for (2, 2). * @param {number} v33 The values for (3, 3). * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setDiagonalValues(mat: goog.vec.mat4d.Type, v00: number, v11: number, v22: number, v33: number): goog.vec.mat4d.Type; /** * Sets the diagonal values of the matrix from the given vector. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the values. * @param {goog.vec.vec4d.Type} vec The vector containing the values. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setDiagonal(mat: goog.vec.mat4d.Type, vec: goog.vec.vec4d.Type): goog.vec.mat4d.Type; /** * Gets the diagonal values of the matrix into the given vector. * * @param {goog.vec.mat4d.Type} mat The matrix containing the values. * @param {goog.vec.vec4d.Type} vec The vector to receive the values. * @param {number=} opt_diagonal Which diagonal to get. A value of 0 selects the * main diagonal, a positive number selects a super diagonal and a negative * number selects a sub diagonal. * @return {goog.vec.vec4d.Type} return vec so that operations can be * chained together. */ function getDiagonal(mat: goog.vec.mat4d.Type, vec: goog.vec.vec4d.Type, opt_diagonal?: number): goog.vec.vec4d.Type; /** * Sets the specified column with the supplied values. * * @param {goog.vec.mat4d.Type} mat The matrix to recieve the values. * @param {number} column The column index to set the values on. * @param {number} v0 The value for row 0. * @param {number} v1 The value for row 1. * @param {number} v2 The value for row 2. * @param {number} v3 The value for row 3. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setColumnValues(mat: goog.vec.mat4d.Type, column: number, v0: number, v1: number, v2: number, v3: number): goog.vec.mat4d.Type; /** * Sets the specified column with the value from the supplied vector. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the values. * @param {number} column The column index to set the values on. * @param {goog.vec.vec4d.Type} vec The vector of elements for the column. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setColumn(mat: goog.vec.mat4d.Type, column: number, vec: goog.vec.vec4d.Type): goog.vec.mat4d.Type; /** * Retrieves the specified column from the matrix into the given vector. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the values. * @param {number} column The column to get the values from. * @param {goog.vec.vec4d.Type} vec The vector of elements to * receive the column. * @return {!goog.vec.vec4d.Type} return vec so that operations can be * chained together. */ function getColumn(mat: goog.vec.mat4d.Type, column: number, vec: goog.vec.vec4d.Type): goog.vec.vec4d.Type; /** * Sets the columns of the matrix from the given vectors. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the values. * @param {goog.vec.vec4d.Type} vec0 The values for column 0. * @param {goog.vec.vec4d.Type} vec1 The values for column 1. * @param {goog.vec.vec4d.Type} vec2 The values for column 2. * @param {goog.vec.vec4d.Type} vec3 The values for column 3. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setColumns(mat: goog.vec.mat4d.Type, vec0: goog.vec.vec4d.Type, vec1: goog.vec.vec4d.Type, vec2: goog.vec.vec4d.Type, vec3: goog.vec.vec4d.Type): goog.vec.mat4d.Type; /** * Retrieves the column values from the given matrix into the given vectors. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the columns. * @param {goog.vec.vec4d.Type} vec0 The vector to receive column 0. * @param {goog.vec.vec4d.Type} vec1 The vector to receive column 1. * @param {goog.vec.vec4d.Type} vec2 The vector to receive column 2. * @param {goog.vec.vec4d.Type} vec3 The vector to receive column 3. */ function getColumns(mat: goog.vec.mat4d.Type, vec0: goog.vec.vec4d.Type, vec1: goog.vec.vec4d.Type, vec2: goog.vec.vec4d.Type, vec3: goog.vec.vec4d.Type): void; /** * Sets the row values from the supplied values. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the values. * @param {number} row The index of the row to receive the values. * @param {number} v0 The value for column 0. * @param {number} v1 The value for column 1. * @param {number} v2 The value for column 2. * @param {number} v3 The value for column 3. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setRowValues(mat: goog.vec.mat4d.Type, row: number, v0: number, v1: number, v2: number, v3: number): goog.vec.mat4d.Type; /** * Sets the row values from the supplied vector. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the row values. * @param {number} row The index of the row. * @param {goog.vec.vec4d.Type} vec The vector containing the values. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setRow(mat: goog.vec.mat4d.Type, row: number, vec: goog.vec.vec4d.Type): goog.vec.mat4d.Type; /** * Retrieves the row values into the given vector. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the values. * @param {number} row The index of the row supplying the values. * @param {goog.vec.vec4d.Type} vec The vector to receive the row. * @return {!goog.vec.vec4d.Type} return vec so that operations can be * chained together. */ function getRow(mat: goog.vec.mat4d.Type, row: number, vec: goog.vec.vec4d.Type): goog.vec.vec4d.Type; /** * Sets the rows of the matrix from the supplied vectors. * * @param {goog.vec.mat4d.Type} mat The matrix to receive the values. * @param {goog.vec.vec4d.Type} vec0 The values for row 0. * @param {goog.vec.vec4d.Type} vec1 The values for row 1. * @param {goog.vec.vec4d.Type} vec2 The values for row 2. * @param {goog.vec.vec4d.Type} vec3 The values for row 3. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained together. */ function setRows(mat: goog.vec.mat4d.Type, vec0: goog.vec.vec4d.Type, vec1: goog.vec.vec4d.Type, vec2: goog.vec.vec4d.Type, vec3: goog.vec.vec4d.Type): goog.vec.mat4d.Type; /** * Retrieves the rows of the matrix into the supplied vectors. * * @param {goog.vec.mat4d.Type} mat The matrix to supply the values. * @param {goog.vec.vec4d.Type} vec0 The vector to receive row 0. * @param {goog.vec.vec4d.Type} vec1 The vector to receive row 1. * @param {goog.vec.vec4d.Type} vec2 The vector to receive row 2. * @param {goog.vec.vec4d.Type} vec3 The vector to receive row 3. */ function getRows(mat: goog.vec.mat4d.Type, vec0: goog.vec.vec4d.Type, vec1: goog.vec.vec4d.Type, vec2: goog.vec.vec4d.Type, vec3: goog.vec.vec4d.Type): void; /** * Makes the given 4x4 matrix the zero matrix. * * @param {goog.vec.mat4d.Type} mat The matrix. * @return {!goog.vec.mat4d.Type} return mat so operations can be chained. */ function makeZero(mat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix the identity matrix. * * @param {goog.vec.mat4d.Type} mat The matrix. * @return {!goog.vec.mat4d.Type} return mat so operations can be chained. */ function makeIdentity(mat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Performs a per-component addition of the matrix mat0 and mat1, storing * the result into resultMat. * * @param {goog.vec.mat4d.Type} mat0 The first addend. * @param {goog.vec.mat4d.Type} mat1 The second addend. * @param {goog.vec.mat4d.Type} resultMat The matrix to * receive the results (may be either mat0 or mat1). * @return {!goog.vec.mat4d.Type} return resultMat so that operations can be * chained together. */ function addMat(mat0: goog.vec.mat4d.Type, mat1: goog.vec.mat4d.Type, resultMat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Performs a per-component subtraction of the matrix mat0 and mat1, * storing the result into resultMat. * * @param {goog.vec.mat4d.Type} mat0 The minuend. * @param {goog.vec.mat4d.Type} mat1 The subtrahend. * @param {goog.vec.mat4d.Type} resultMat The matrix to receive * the results (may be either mat0 or mat1). * @return {!goog.vec.mat4d.Type} return resultMat so that operations can be * chained together. */ function subMat(mat0: goog.vec.mat4d.Type, mat1: goog.vec.mat4d.Type, resultMat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Multiplies matrix mat with the given scalar, storing the result * into resultMat. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} scalar The scalar value to multiply to each element of mat. * @param {goog.vec.mat4d.Type} resultMat The matrix to receive * the results (may be mat). * @return {!goog.vec.mat4d.Type} return resultMat so that operations can be * chained together. */ function multScalar(mat: goog.vec.mat4d.Type, scalar: number, resultMat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Multiplies the two matrices mat0 and mat1 using matrix multiplication, * storing the result into resultMat. * * @param {goog.vec.mat4d.Type} mat0 The first (left hand) matrix. * @param {goog.vec.mat4d.Type} mat1 The second (right hand) matrix. * @param {goog.vec.mat4d.Type} resultMat The matrix to receive * the results (may be either mat0 or mat1). * @return {!goog.vec.mat4d.Type} return resultMat so that operations can be * chained together. */ function multMat(mat0: goog.vec.mat4d.Type, mat1: goog.vec.mat4d.Type, resultMat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Transposes the given matrix mat storing the result into resultMat. * * @param {goog.vec.mat4d.Type} mat The matrix to transpose. * @param {goog.vec.mat4d.Type} resultMat The matrix to receive * the results (may be mat). * @return {!goog.vec.mat4d.Type} return resultMat so that operations can be * chained together. */ function transpose(mat: goog.vec.mat4d.Type, resultMat: goog.vec.mat4d.Type): goog.vec.mat4d.Type; /** * Computes the determinant of the matrix. * * @param {goog.vec.mat4d.Type} mat The matrix to compute the matrix for. * @return {number} The determinant of the matrix. */ function determinant(mat: goog.vec.mat4d.Type): number; /** * Computes the inverse of mat storing the result into resultMat. If the * inverse is defined, this function returns true, false otherwise. * * @param {goog.vec.mat4d.Type} mat The matrix to invert. * @param {goog.vec.mat4d.Type} resultMat The matrix to receive * the result (may be mat). * @return {boolean} True if the inverse is defined. If false is returned, * resultMat is not modified. */ function invert(mat: goog.vec.mat4d.Type, resultMat: goog.vec.mat4d.Type): boolean; /** * Returns true if the components of mat0 are equal to the components of mat1. * * @param {goog.vec.mat4d.Type} mat0 The first matrix. * @param {goog.vec.mat4d.Type} mat1 The second matrix. * @return {boolean} True if the the two matrices are equivalent. */ function equals(mat0: goog.vec.mat4d.Type, mat1: goog.vec.mat4d.Type): boolean; /** * Transforms the given vector with the given matrix storing the resulting, * transformed vector into resultVec. The input vector is multiplied against the * upper 3x4 matrix omitting the projective component. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the transformation. * @param {goog.vec.vec3d.Type} vec The 3 element vector to transform. * @param {goog.vec.vec3d.Type} resultVec The 3 element vector to * receive the results (may be vec). * @return {!goog.vec.vec3d.Type} return resultVec so that operations can be * chained together. */ function multVec3(mat: goog.vec.mat4d.Type, vec: goog.vec.vec3d.Type, resultVec: goog.vec.vec3d.Type): goog.vec.vec3d.Type; /** * Transforms the given vector with the given matrix storing the resulting, * transformed vector into resultVec. The input vector is multiplied against the * upper 3x3 matrix omitting the projective component and translation * components. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the transformation. * @param {goog.vec.vec3d.Type} vec The 3 element vector to transform. * @param {goog.vec.vec3d.Type} resultVec The 3 element vector to * receive the results (may be vec). * @return {!goog.vec.vec3d.Type} return resultVec so that operations can be * chained together. */ function multVec3NoTranslate(mat: goog.vec.mat4d.Type, vec: goog.vec.vec3d.Type, resultVec: goog.vec.vec3d.Type): goog.vec.vec3d.Type; /** * Transforms the given vector with the given matrix storing the resulting, * transformed vector into resultVec. The input vector is multiplied against the * full 4x4 matrix with the homogeneous divide applied to reduce the 4 element * vector to a 3 element vector. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the transformation. * @param {goog.vec.vec3d.Type} vec The 3 element vector to transform. * @param {goog.vec.vec3d.Type} resultVec The 3 element vector * to receive the results (may be vec). * @return {!goog.vec.vec3d.Type} return resultVec so that operations can be * chained together. */ function multVec3Projective(mat: goog.vec.mat4d.Type, vec: goog.vec.vec3d.Type, resultVec: goog.vec.vec3d.Type): goog.vec.vec3d.Type; /** * Transforms the given vector with the given matrix storing the resulting, * transformed vector into resultVec. * * @param {goog.vec.mat4d.Type} mat The matrix supplying the transformation. * @param {goog.vec.vec4d.Type} vec The vector to transform. * @param {goog.vec.vec4d.Type} resultVec The vector to * receive the results (may be vec). * @return {!goog.vec.vec4d.Type} return resultVec so that operations can be * chained together. */ function multVec4(mat: goog.vec.mat4d.Type, vec: goog.vec.vec4d.Type, resultVec: goog.vec.vec4d.Type): goog.vec.vec4d.Type; /** * Makes the given 4x4 matrix a translation matrix with x, y and z * translation factors. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} x The translation along the x axis. * @param {number} y The translation along the y axis. * @param {number} z The translation along the z axis. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeTranslate(mat: goog.vec.mat4d.Type, x: number, y: number, z: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix as a scale matrix with x, y and z scale factors. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} x The scale along the x axis. * @param {number} y The scale along the y axis. * @param {number} z The scale along the z axis. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeScale(mat: goog.vec.mat4d.Type, x: number, y: number, z: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix a rotation matrix with the given rotation * angle about the axis defined by the vector (ax, ay, az). * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The rotation angle in radians. * @param {number} ax The x component of the rotation axis. * @param {number} ay The y component of the rotation axis. * @param {number} az The z component of the rotation axis. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeRotate(mat: goog.vec.mat4d.Type, angle: number, ax: number, ay: number, az: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix a rotation matrix with the given rotation * angle about the X axis. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The rotation angle in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeRotateX(mat: goog.vec.mat4d.Type, angle: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix a rotation matrix with the given rotation * angle about the Y axis. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The rotation angle in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeRotateY(mat: goog.vec.mat4d.Type, angle: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix a rotation matrix with the given rotation * angle about the Z axis. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The rotation angle in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeRotateZ(mat: goog.vec.mat4d.Type, angle: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix a perspective projection matrix. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} left The coordinate of the left clipping plane. * @param {number} right The coordinate of the right clipping plane. * @param {number} bottom The coordinate of the bottom clipping plane. * @param {number} top The coordinate of the top clipping plane. * @param {number} near The distance to the near clipping plane. * @param {number} far The distance to the far clipping plane. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeFrustum(mat: goog.vec.mat4d.Type, left: number, right: number, bottom: number, top: number, near: number, far: number): goog.vec.mat4d.Type; /** * Makse the given 4x4 matrix perspective projection matrix given a * field of view and aspect ratio. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} fovy The field of view along the y (vertical) axis in * radians. * @param {number} aspect The x (width) to y (height) aspect ratio. * @param {number} near The distance to the near clipping plane. * @param {number} far The distance to the far clipping plane. * @return {goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makePerspective(mat: goog.vec.mat4d.Type, fovy: number, aspect: number, near: number, far: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix an orthographic projection matrix. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} left The coordinate of the left clipping plane. * @param {number} right The coordinate of the right clipping plane. * @param {number} bottom The coordinate of the bottom clipping plane. * @param {number} top The coordinate of the top clipping plane. * @param {number} near The distance to the near clipping plane. * @param {number} far The distance to the far clipping plane. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeOrtho(mat: goog.vec.mat4d.Type, left: number, right: number, bottom: number, top: number, near: number, far: number): goog.vec.mat4d.Type; /** * Makes the given 4x4 matrix a modelview matrix of a camera so that * the camera is 'looking at' the given center point. * * Note that unlike most other goog.vec functions where we inline * everything, this function does not inline various goog.vec * functions. This makes the code more readable, but somewhat * less efficient. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {goog.vec.vec3d.Type} eyePt The position of the eye point * (camera origin). * @param {goog.vec.vec3d.Type} centerPt The point to aim the camera at. * @param {goog.vec.vec3d.Type} worldUpVec The vector that identifies * the up direction for the camera. * @return {goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeLookAt(mat: goog.vec.mat4d.Type, eyePt: goog.vec.vec3d.Type, centerPt: goog.vec.vec3d.Type, worldUpVec: goog.vec.vec3d.Type): goog.vec.mat4d.Type; /** * Decomposes a matrix into the lookAt vectors eyePt, fwdVec and worldUpVec. * The matrix represents the modelview matrix of a camera. It is the inverse * of lookAt except for the output of the fwdVec instead of centerPt. * The centerPt itself cannot be recovered from a modelview matrix. * * Note that unlike most other goog.vec functions where we inline * everything, this function does not inline various goog.vec * functions. This makes the code more readable, but somewhat * less efficient. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {goog.vec.vec3d.Type} eyePt The position of the eye point * (camera origin). * @param {goog.vec.vec3d.Type} fwdVec The vector describing where * the camera points to. * @param {goog.vec.vec3d.Type} worldUpVec The vector that * identifies the up direction for the camera. * @return {boolean} True if the method succeeds, false otherwise. * The method can only fail if the inverse of viewMatrix is not defined. */ function toLookAt(mat: goog.vec.mat4d.Type, eyePt: goog.vec.vec3d.Type, fwdVec: goog.vec.vec3d.Type, worldUpVec: goog.vec.vec3d.Type): boolean; /** * Makes the given 4x4 matrix a rotation matrix given Euler angles using * the ZXZ convention. * Given the euler angles [theta1, theta2, theta3], the rotation is defined as * rotation = rotation_z(theta1) * rotation_x(theta2) * rotation_z(theta3), * with theta1 in [0, 2 * pi], theta2 in [0, pi] and theta3 in [0, 2 * pi]. * rotation_x(theta) means rotation around the X axis of theta radians, * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} theta1 The angle of rotation around the Z axis in radians. * @param {number} theta2 The angle of rotation around the X axis in radians. * @param {number} theta3 The angle of rotation around the Z axis in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function makeEulerZXZ(mat: goog.vec.mat4d.Type, theta1: number, theta2: number, theta3: number): goog.vec.mat4d.Type; /** * Decomposes a rotation matrix into Euler angles using the ZXZ convention so * that rotation = rotation_z(theta1) * rotation_x(theta2) * rotation_z(theta3), * with theta1 in [0, 2 * pi], theta2 in [0, pi] and theta3 in [0, 2 * pi]. * rotation_x(theta) means rotation around the X axis of theta radians. * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {goog.vec.vec3d.Type} euler The ZXZ Euler angles in * radians as [theta1, theta2, theta3]. * @param {boolean=} opt_theta2IsNegative Whether theta2 is in [-pi, 0] instead * of the default [0, pi]. * @return {!goog.vec.vec4d.Type} return euler so that operations can be * chained together. */ function toEulerZXZ(mat: goog.vec.mat4d.Type, euler: goog.vec.vec3d.Type, opt_theta2IsNegative?: boolean): goog.vec.vec4d.Type; /** * Translates the given matrix by x,y,z. Equvialent to: * goog.vec.mat4d.multMat( * mat, * goog.vec.mat4d.makeTranslate(goog.vec.mat4d.create(), x, y, z), * mat); * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} x The translation along the x axis. * @param {number} y The translation along the y axis. * @param {number} z The translation along the z axis. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function translate(mat: goog.vec.mat4d.Type, x: number, y: number, z: number): goog.vec.mat4d.Type; /** * Scales the given matrix by x,y,z. Equivalent to: * goog.vec.mat4d.multMat( * mat, * goog.vec.mat4d.makeScale(goog.vec.mat4d.create(), x, y, z), * mat); * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} x The x scale factor. * @param {number} y The y scale factor. * @param {number} z The z scale factor. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function scale(mat: goog.vec.mat4d.Type, x: number, y: number, z: number): goog.vec.mat4d.Type; /** * Rotate the given matrix by angle about the x,y,z axis. Equivalent to: * goog.vec.mat4d.multMat( * mat, * goog.vec.mat4d.makeRotate(goog.vec.mat4d.create(), angle, x, y, z), * mat); * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The angle in radians. * @param {number} x The x component of the rotation axis. * @param {number} y The y component of the rotation axis. * @param {number} z The z component of the rotation axis. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function rotate(mat: goog.vec.mat4d.Type, angle: number, x: number, y: number, z: number): goog.vec.mat4d.Type; /** * Rotate the given matrix by angle about the x axis. Equivalent to: * goog.vec.mat4d.multMat( * mat, * goog.vec.mat4d.makeRotateX(goog.vec.mat4d.create(), angle), * mat); * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The angle in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function rotateX(mat: goog.vec.mat4d.Type, angle: number): goog.vec.mat4d.Type; /** * Rotate the given matrix by angle about the y axis. Equivalent to: * goog.vec.mat4d.multMat( * mat, * goog.vec.mat4d.makeRotateY(goog.vec.mat4d.create(), angle), * mat); * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The angle in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function rotateY(mat: goog.vec.mat4d.Type, angle: number): goog.vec.mat4d.Type; /** * Rotate the given matrix by angle about the z axis. Equivalent to: * goog.vec.mat4d.multMat( * mat, * goog.vec.mat4d.makeRotateZ(goog.vec.mat4d.create(), angle), * mat); * * @param {goog.vec.mat4d.Type} mat The matrix. * @param {number} angle The angle in radians. * @return {!goog.vec.mat4d.Type} return mat so that operations can be * chained. */ function rotateZ(mat: goog.vec.mat4d.Type, angle: number): goog.vec.mat4d.Type; /** * Retrieves the translation component of the transformation matrix. * * @param {goog.vec.mat4d.Type} mat The transformation matrix. * @param {goog.vec.vec3d.Type} translation The vector for storing the * result. * @return {!goog.vec.vec3d.Type} return translation so that operations can be * chained. */ function getTranslation(mat: goog.vec.mat4d.Type, translation: goog.vec.vec3d.Type): goog.vec.vec3d.Type; }
leandrolanzieri/ciaabot-ide
typings/modules/closure/goog/vec/mat4d.d.ts
TypeScript
gpl-3.0
32,962
package de.leif.ffmanagementsuite.domain; import com.fasterxml.jackson.annotation.JsonIgnore; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import javax.persistence.*; import javax.validation.constraints.*; import java.io.Serializable; import java.time.LocalDate; import java.util.HashSet; import java.util.Set; import java.util.Objects; import de.leif.ffmanagementsuite.domain.enumeration.Mitgliedsstatus; /** * A Person. */ @Entity @Table(name = "person") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Person implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @Size(min = 3) @Column(name = "vorname", nullable = false) private String vorname; @NotNull @Size(min = 3) @Column(name = "nachname", nullable = false) private String nachname; @NotNull @Column(name = "geburtsdatum", nullable = false) private LocalDate geburtsdatum; @NotNull @Size(min = 3) @Column(name = "strasse", nullable = false) private String strasse; @NotNull @Min(value = 1) @Column(name = "hausnummer", nullable = false) private Integer hausnummer; @Column(name = "appendix") private String appendix; @NotNull @Size(min = 5, max = 5) @Column(name = "postleitzahl", length = 5, nullable = false) private String postleitzahl; @NotNull @Size(min = 3) @Column(name = "ort", nullable = false) private String ort; @NotNull @Enumerated(EnumType.STRING) @Column(name = "status", nullable = false) private Mitgliedsstatus status; @Column(name = "ehrung_25_jahre") private LocalDate ehrung25Jahre; @Column(name = "ehrung_40_jahre") private LocalDate ehrung40Jahre; @OneToOne @JoinColumn(unique = true) private Organisationsstruktur zugehoerigkeit; @OneToMany(mappedBy = "person") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Erreichbarkeit> erreichbarkeitens = new HashSet<>(); @OneToMany(mappedBy = "person") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Email> emails = new HashSet<>(); @OneToMany(mappedBy = "person") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Dienstzeit> dienstzeitens = new HashSet<>(); @OneToMany(mappedBy = "person") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Ausbildung> ausbildungens = new HashSet<>(); @OneToMany(mappedBy = "besitzer") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Schutzausruestung> schutzausruestungs = new HashSet<>(); @ManyToOne private Dienststellung inDienststellung; @ManyToMany @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @JoinTable(name = "person_fuehrerscheine", joinColumns = @JoinColumn(name="people_id", referencedColumnName="id"), inverseJoinColumns = @JoinColumn(name="fuehrerscheines_id", referencedColumnName="id")) private Set<Fuehrerschein> fuehrerscheines = new HashSet<>(); @ManyToMany @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @JoinTable(name = "person_verfuegbarkeiten", joinColumns = @JoinColumn(name="people_id", referencedColumnName="id"), inverseJoinColumns = @JoinColumn(name="verfuegbarkeitens_id", referencedColumnName="id")) private Set<Verfuegbarkeit> verfuegbarkeitens = new HashSet<>(); @ManyToMany(mappedBy = "teilnehmers") @JsonIgnore @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) private Set<Leistungspruefung> leistungspruefungens = new HashSet<>(); // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getVorname() { return vorname; } public Person vorname(String vorname) { this.vorname = vorname; return this; } public void setVorname(String vorname) { this.vorname = vorname; } public String getNachname() { return nachname; } public Person nachname(String nachname) { this.nachname = nachname; return this; } public void setNachname(String nachname) { this.nachname = nachname; } public LocalDate getGeburtsdatum() { return geburtsdatum; } public Person geburtsdatum(LocalDate geburtsdatum) { this.geburtsdatum = geburtsdatum; return this; } public void setGeburtsdatum(LocalDate geburtsdatum) { this.geburtsdatum = geburtsdatum; } public String getStrasse() { return strasse; } public Person strasse(String strasse) { this.strasse = strasse; return this; } public void setStrasse(String strasse) { this.strasse = strasse; } public Integer getHausnummer() { return hausnummer; } public Person hausnummer(Integer hausnummer) { this.hausnummer = hausnummer; return this; } public void setHausnummer(Integer hausnummer) { this.hausnummer = hausnummer; } public String getAppendix() { return appendix; } public Person appendix(String appendix) { this.appendix = appendix; return this; } public void setAppendix(String appendix) { this.appendix = appendix; } public String getPostleitzahl() { return postleitzahl; } public Person postleitzahl(String postleitzahl) { this.postleitzahl = postleitzahl; return this; } public void setPostleitzahl(String postleitzahl) { this.postleitzahl = postleitzahl; } public String getOrt() { return ort; } public Person ort(String ort) { this.ort = ort; return this; } public void setOrt(String ort) { this.ort = ort; } public Mitgliedsstatus getStatus() { return status; } public Person status(Mitgliedsstatus status) { this.status = status; return this; } public void setStatus(Mitgliedsstatus status) { this.status = status; } public LocalDate getEhrung25Jahre() { return ehrung25Jahre; } public Person ehrung25Jahre(LocalDate ehrung25Jahre) { this.ehrung25Jahre = ehrung25Jahre; return this; } public void setEhrung25Jahre(LocalDate ehrung25Jahre) { this.ehrung25Jahre = ehrung25Jahre; } public LocalDate getEhrung40Jahre() { return ehrung40Jahre; } public Person ehrung40Jahre(LocalDate ehrung40Jahre) { this.ehrung40Jahre = ehrung40Jahre; return this; } public void setEhrung40Jahre(LocalDate ehrung40Jahre) { this.ehrung40Jahre = ehrung40Jahre; } public Organisationsstruktur getZugehoerigkeit() { return zugehoerigkeit; } public Person zugehoerigkeit(Organisationsstruktur organisationsstruktur) { this.zugehoerigkeit = organisationsstruktur; return this; } public void setZugehoerigkeit(Organisationsstruktur organisationsstruktur) { this.zugehoerigkeit = organisationsstruktur; } public Set<Erreichbarkeit> getErreichbarkeitens() { return erreichbarkeitens; } public Person erreichbarkeitens(Set<Erreichbarkeit> erreichbarkeits) { this.erreichbarkeitens = erreichbarkeits; return this; } public Person addErreichbarkeiten(Erreichbarkeit erreichbarkeit) { this.erreichbarkeitens.add(erreichbarkeit); erreichbarkeit.setPerson(this); return this; } public Person removeErreichbarkeiten(Erreichbarkeit erreichbarkeit) { this.erreichbarkeitens.remove(erreichbarkeit); erreichbarkeit.setPerson(null); return this; } public void setErreichbarkeitens(Set<Erreichbarkeit> erreichbarkeits) { this.erreichbarkeitens = erreichbarkeits; } public Set<Email> getEmails() { return emails; } public Person emails(Set<Email> emails) { this.emails = emails; return this; } public Person addEmails(Email email) { this.emails.add(email); email.setPerson(this); return this; } public Person removeEmails(Email email) { this.emails.remove(email); email.setPerson(null); return this; } public void setEmails(Set<Email> emails) { this.emails = emails; } public Set<Dienstzeit> getDienstzeitens() { return dienstzeitens; } public Person dienstzeitens(Set<Dienstzeit> dienstzeits) { this.dienstzeitens = dienstzeits; return this; } public Person addDienstzeiten(Dienstzeit dienstzeit) { this.dienstzeitens.add(dienstzeit); dienstzeit.setPerson(this); return this; } public Person removeDienstzeiten(Dienstzeit dienstzeit) { this.dienstzeitens.remove(dienstzeit); dienstzeit.setPerson(null); return this; } public void setDienstzeitens(Set<Dienstzeit> dienstzeits) { this.dienstzeitens = dienstzeits; } public Set<Ausbildung> getAusbildungens() { return ausbildungens; } public Person ausbildungens(Set<Ausbildung> ausbildungs) { this.ausbildungens = ausbildungs; return this; } public Person addAusbildungen(Ausbildung ausbildung) { this.ausbildungens.add(ausbildung); ausbildung.setPerson(this); return this; } public Person removeAusbildungen(Ausbildung ausbildung) { this.ausbildungens.remove(ausbildung); ausbildung.setPerson(null); return this; } public void setAusbildungens(Set<Ausbildung> ausbildungs) { this.ausbildungens = ausbildungs; } public Set<Schutzausruestung> getSchutzausruestungs() { return schutzausruestungs; } public Person schutzausruestungs(Set<Schutzausruestung> schutzausruestungs) { this.schutzausruestungs = schutzausruestungs; return this; } public Person addSchutzausruestung(Schutzausruestung schutzausruestung) { this.schutzausruestungs.add(schutzausruestung); schutzausruestung.setBesitzer(this); return this; } public Person removeSchutzausruestung(Schutzausruestung schutzausruestung) { this.schutzausruestungs.remove(schutzausruestung); schutzausruestung.setBesitzer(null); return this; } public void setSchutzausruestungs(Set<Schutzausruestung> schutzausruestungs) { this.schutzausruestungs = schutzausruestungs; } public Dienststellung getInDienststellung() { return inDienststellung; } public Person inDienststellung(Dienststellung dienststellung) { this.inDienststellung = dienststellung; return this; } public void setInDienststellung(Dienststellung dienststellung) { this.inDienststellung = dienststellung; } public Set<Fuehrerschein> getFuehrerscheines() { return fuehrerscheines; } public Person fuehrerscheines(Set<Fuehrerschein> fuehrerscheins) { this.fuehrerscheines = fuehrerscheins; return this; } public Person addFuehrerscheine(Fuehrerschein fuehrerschein) { this.fuehrerscheines.add(fuehrerschein); return this; } public Person removeFuehrerscheine(Fuehrerschein fuehrerschein) { this.fuehrerscheines.remove(fuehrerschein); return this; } public void setFuehrerscheines(Set<Fuehrerschein> fuehrerscheins) { this.fuehrerscheines = fuehrerscheins; } public Set<Verfuegbarkeit> getVerfuegbarkeitens() { return verfuegbarkeitens; } public Person verfuegbarkeitens(Set<Verfuegbarkeit> verfuegbarkeits) { this.verfuegbarkeitens = verfuegbarkeits; return this; } public Person addVerfuegbarkeiten(Verfuegbarkeit verfuegbarkeit) { this.verfuegbarkeitens.add(verfuegbarkeit); return this; } public Person removeVerfuegbarkeiten(Verfuegbarkeit verfuegbarkeit) { this.verfuegbarkeitens.remove(verfuegbarkeit); return this; } public void setVerfuegbarkeitens(Set<Verfuegbarkeit> verfuegbarkeits) { this.verfuegbarkeitens = verfuegbarkeits; } public Set<Leistungspruefung> getLeistungspruefungens() { return leistungspruefungens; } public Person leistungspruefungens(Set<Leistungspruefung> leistungspruefungs) { this.leistungspruefungens = leistungspruefungs; return this; } public Person addLeistungspruefungen(Leistungspruefung leistungspruefung) { this.leistungspruefungens.add(leistungspruefung); leistungspruefung.getTeilnehmers().add(this); return this; } public Person removeLeistungspruefungen(Leistungspruefung leistungspruefung) { this.leistungspruefungens.remove(leistungspruefung); leistungspruefung.getTeilnehmers().remove(this); return this; } public void setLeistungspruefungens(Set<Leistungspruefung> leistungspruefungs) { this.leistungspruefungens = leistungspruefungs; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Person person = (Person) o; if (person.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), person.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "Person{" + "id=" + getId() + ", vorname='" + getVorname() + "'" + ", nachname='" + getNachname() + "'" + ", geburtsdatum='" + getGeburtsdatum() + "'" + ", strasse='" + getStrasse() + "'" + ", hausnummer='" + getHausnummer() + "'" + ", appendix='" + getAppendix() + "'" + ", postleitzahl='" + getPostleitzahl() + "'" + ", ort='" + getOrt() + "'" + ", status='" + getStatus() + "'" + ", ehrung25Jahre='" + getEhrung25Jahre() + "'" + ", ehrung40Jahre='" + getEhrung40Jahre() + "'" + "}"; } }
t08094a/ffManagementSuite
src/main/java/de/leif/ffmanagementsuite/domain/Person.java
Java
gpl-3.0
14,945
<?php /** * sfGuardGroup * * This class has been auto-generated by the Doctrine ORM Framework * * @package gpol * @subpackage model * @author Your name here * @version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $ */ class sfGuardGroup extends PluginsfGuardGroup { }
bewiwi/gpol
lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardGroup.class.php
PHP
gpl-3.0
299
\hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor}{}\doxysection{ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor Class Reference} \label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor}\index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} Inheritance diagram for ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=326pt]{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor__inherit__graph} \end{center} \end{figure} Collaboration diagram for ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor__coll__graph} \end{center} \end{figure} \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a327e969ab9cbeb999c1f73e7c4c47494}{Specification\+Editor}} (\mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu}{Menu}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_a3fe23bf751f59f3c1b85bbff1ebc737c}{parent}}) \item void \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a704f58fb72ecaceb0c0300af701410a9}{show}} () \item void \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a6fce15bfffd96b9f9c599173f0d3b8ac}{on\+Click}} (int id) \item \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_description}{Menu\+Description}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a003a769cdc15415da1a97086adaab08a}{get\+Menu\+Description}} () \end{DoxyCompactItemize} \doxysubsection*{Private Attributes} \begin{DoxyCompactItemize} \item final \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1data_1_1_data_editor}{Data\+Editor}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a135c19815daa91b60a2d1dbbbe0d90e4}{data\+Editor}} \item final \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1reference_1_1_reference_editor}{Reference\+Editor}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a5ab480533bd7468527f08d699572c3be}{reference\+Editor}} \item final \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1data_1_1_type_selector}{Type\+Selector}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a3ab3d64aba4ee43330b650d0c105f17e}{type\+Selector}} \item \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1lang_1_1_specification}{Specification}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a64a07724329a3216f0a3d103fb835327}{specification}} \item \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_description}{Menu\+Description}} \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_af4bd2bbe1de12596b4c3cb37313abaad}{description}} \end{DoxyCompactItemize} \doxysubsection*{Additional Inherited Members} \doxysubsection{Constructor \& Destructor Documentation} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a327e969ab9cbeb999c1f73e7c4c47494}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a327e969ab9cbeb999c1f73e7c4c47494}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!SpecificationEditor@{SpecificationEditor}} \index{SpecificationEditor@{SpecificationEditor}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{SpecificationEditor()}{SpecificationEditor()}} {\footnotesize\ttfamily ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+Specification\+Editor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu}{Menu}}}]{parent }\end{DoxyParamCaption})} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a003a769cdc15415da1a97086adaab08a}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a003a769cdc15415da1a97086adaab08a}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!getMenuDescription@{getMenuDescription}} \index{getMenuDescription@{getMenuDescription}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{getMenuDescription()}{getMenuDescription()}} {\footnotesize\ttfamily \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_description}{Menu\+Description}} ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+get\+Menu\+Description (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a6fce15bfffd96b9f9c599173f0d3b8ac}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a6fce15bfffd96b9f9c599173f0d3b8ac}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!onClick@{onClick}} \index{onClick@{onClick}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{onClick()}{onClick()}} {\footnotesize\ttfamily void ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+on\+Click (\begin{DoxyParamCaption}\item[{int}]{id }\end{DoxyParamCaption})} Reimplemented from \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_afbc74abfc1492def706f39b8919633ea}{ch.\+innovazion.\+arionide.\+menu.\+Menu}}. Here is the call graph for this function\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a6fce15bfffd96b9f9c599173f0d3b8ac_cgraph} \end{center} \end{figure} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a704f58fb72ecaceb0c0300af701410a9}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a704f58fb72ecaceb0c0300af701410a9}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!show@{show}} \index{show@{show}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{show()}{show()}} {\footnotesize\ttfamily void ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+show (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Reimplemented from \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_abceecd7d7b2b230be630bb1d7da4010e}{ch.\+innovazion.\+arionide.\+menu.\+Menu}}. Here is the call graph for this function\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a704f58fb72ecaceb0c0300af701410a9_cgraph} \end{center} \end{figure} \doxysubsection{Member Data Documentation} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a135c19815daa91b60a2d1dbbbe0d90e4}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a135c19815daa91b60a2d1dbbbe0d90e4}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!dataEditor@{dataEditor}} \index{dataEditor@{dataEditor}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{dataEditor}{dataEditor}} {\footnotesize\ttfamily final \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1data_1_1_data_editor}{Data\+Editor}} ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+data\+Editor\hspace{0.3cm}{\ttfamily [private]}} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_af4bd2bbe1de12596b4c3cb37313abaad}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_af4bd2bbe1de12596b4c3cb37313abaad}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!description@{description}} \index{description@{description}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{description}{description}} {\footnotesize\ttfamily \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1_menu_description}{Menu\+Description}} ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+description\hspace{0.3cm}{\ttfamily [private]}} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a5ab480533bd7468527f08d699572c3be}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a5ab480533bd7468527f08d699572c3be}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!referenceEditor@{referenceEditor}} \index{referenceEditor@{referenceEditor}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{referenceEditor}{referenceEditor}} {\footnotesize\ttfamily final \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1reference_1_1_reference_editor}{Reference\+Editor}} ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+reference\+Editor\hspace{0.3cm}{\ttfamily [private]}} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a64a07724329a3216f0a3d103fb835327}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a64a07724329a3216f0a3d103fb835327}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!specification@{specification}} \index{specification@{specification}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{specification}{specification}} {\footnotesize\ttfamily \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1lang_1_1_specification}{Specification}} ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+specification\hspace{0.3cm}{\ttfamily [private]}} \mbox{\Hypertarget{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a3ab3d64aba4ee43330b650d0c105f17e}\label{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor_a3ab3d64aba4ee43330b650d0c105f17e}} \index{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}!typeSelector@{typeSelector}} \index{typeSelector@{typeSelector}!ch.innovazion.arionide.menu.structure.specification.SpecificationEditor@{ch.innovazion.arionide.menu.structure.specification.SpecificationEditor}} \doxysubsubsection{\texorpdfstring{typeSelector}{typeSelector}} {\footnotesize\ttfamily final \mbox{\hyperlink{classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1data_1_1_type_selector}{Type\+Selector}} ch.\+innovazion.\+arionide.\+menu.\+structure.\+specification.\+Specification\+Editor.\+type\+Selector\hspace{0.3cm}{\ttfamily [private]}} The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize} \item src/ch/innovazion/arionide/menu/structure/specification/\mbox{\hyperlink{_specification_editor_8java}{Specification\+Editor.\+java}}\end{DoxyCompactItemize}
thedreamer979/Arionide
doc/latex/classch_1_1innovazion_1_1arionide_1_1menu_1_1structure_1_1specification_1_1_specification_editor.tex
TeX
gpl-3.0
14,105
/* * stack_guard.c is a piece of uCon 2009 Capture The Flag code * Copyright (C) 2002 Marcos Alvares <marcos.alvares@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define STACK_PROTECTION typedef unsigned int uint; unsigned int safe_eip = 0; void __smash_the_stack (char *params); unsigned long __get_ebp(void); int main (int argc, char *argv[]) { if (argc != 2) { printf("\n::. Test smashing the stack .::\n"); printf(" usage: %s <params>\n", argv[0]); exit(1); } __smash_the_stack (argv[1]); return 0; } void __smash_the_stack (char *params) { #ifdef STACK_PROTECTION unsigned long canary[1]; canary[0] = 0x11111111; #endif char buffer[20]; strcpy(buffer, params); #ifdef STACK_PROTECTION printf("%#x\n\n", canary); if (*canary != 0x11111111) { printf("the base stack has been modified\n"); exit(0); } #endif // exit(0); } int check_canary (unsigned long *address, unsigned long value) { } unsigned long __get_ebp(void) { __asm__("movl %ebp, %eax"); }
mabj/ctf_ucon2
challenges/misc/stack_guard.c
C
gpl-3.0
1,740
/* io.h --- * * Filename: io.h * Author: Jules <archjules> * Created: Sun Dec 11 23:20:25 2016 (+0100) * Last-Updated: Sun Dec 11 23:21:06 2016 (+0100) * By: Jules <archjules> */ #ifndef IO_H #define IO_H uint8_t io_handle_read(struct CPU *, uint8_t port); void io_handle_write(struct CPU *, uint8_t port, uint8_t value); #endif /* IO_H */
CoiledSpring/Gameboy
include/memory/io.h
C
gpl-3.0
362
package mod.config; import java.util.Set; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraftforge.fml.client.IModGuiFactory; public class ModGuiFactory implements IModGuiFactory{ @Override public void initialize(Minecraft minecraftInstance) { } @Override public Class<? extends GuiScreen> mainConfigGuiClass() { return ConfigGui.class; } @Override public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { return null; } @Override public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; } }
MCrafterzz/minecraft-mod
src/main/java/mod/config/ModGuiFactory.java
Java
gpl-3.0
653
JavaCPP Presets for Leptonica ============================= Introduction ------------ This directory contains the JavaCPP Presets module for: * Leptonica 1.73 http://www.leptonica.org/ Please refer to the parent README.md file for more detailed information about the JavaCPP Presets. Documentation ------------- Java API documentation is available here: * http://bytedeco.org/javacpp-presets/leptonica/apidocs/ Sample Usage ------------ Here is a simple example of Leptonica ported to Java from this C source file: * http://tpgit.github.io/Leptonica/sudokutest_8c_source.html We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `src/main/java/SudokuTest.java` source files below, simply execute on the command line: ```bash $ mvn compile exec:java -Dexec.args="[filein]" ``` ### The `pom.xml` build file ```xml <project> <modelVersion>4.0.0</modelVersion> <groupId>org.bytedeco.javacpp-presets.leptonica</groupId> <artifactId>sudokutest</artifactId> <version>1.2</version> <properties> <exec.mainClass>SudokuTest</exec.mainClass> </properties> <dependencies> <dependency> <groupId>org.bytedeco.javacpp-presets</groupId> <artifactId>leptonica</artifactId> <version>1.73-1.2</version> </dependency> </dependencies> </project> ``` ### The `src/main/java/SudokuTest.java` source file ```java /*====================================================================* - Copyright (C) 2001 Leptonica. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *====================================================================*/ /* * sudokutest.c * * Tests sudoku solver and generator. */ import org.bytedeco.javacpp.*; import static org.bytedeco.javacpp.lept.*; public class SudokuTest { static final String startsol = "3 8 7 2 6 4 1 9 5 " + "2 6 5 8 9 1 4 3 7 " + "1 4 9 5 3 7 6 8 2 " + "5 2 3 7 1 6 8 4 9 " + "7 1 6 9 4 8 2 5 3 " + "8 9 4 3 5 2 7 1 6 " + "9 7 2 1 8 5 3 6 4 " + "4 3 1 6 7 9 5 2 8 " + "6 5 8 4 2 3 9 7 1"; public static void main(String[] args) { Loader.load(lept.class); IntPointer unique = new IntPointer(1); IntPointer array; L_SUDOKU sud; if (args.length != 0 && args.length != 1) { System.err.println("Syntax: SudokuTest [filein]"); System.exit(1); } if (args.length == 0) { /* Generate a new sudoku by element elimination */ array = sudokuReadString(new BytePointer(startsol)); sud = sudokuGenerate(array, 3693, 28, 7); sudokuDestroy(sud); lept_free(array); System.exit(0); } /* Solve the input sudoku */ if ((array = sudokuReadFile(new BytePointer(args[0]))) == null) { System.err.println("invalid input"); System.exit(1); } if ((sud = sudokuCreate(array)) == null) { System.err.println("sud not made"); System.exit(1); } sudokuOutput(sud, L_SUDOKU_INIT); startTimer(); sudokuSolve(sud); System.err.printf("Time: %7.3f sec\n", stopTimer()); sudokuOutput(sud, L_SUDOKU_STATE); sudokuDestroy(sud); /* Test for uniqueness */ sudokuTestUniqueness(array, unique); if (unique.get(0) != 0) { System.err.println("Sudoku is unique"); } else { System.err.println("Sudoku is NOT unique"); } lept_free(array); } } ```
bobocop/gsn35
lib/javacv/leptonica/README.md
Markdown
gpl-3.0
5,225
package org.cardiacatlas.xpacs.web.rest; import org.cardiacatlas.xpacs.XpacswebApp; import org.cardiacatlas.xpacs.domain.CapModel; import org.cardiacatlas.xpacs.domain.PatientInfo; import org.cardiacatlas.xpacs.repository.CapModelRepository; import org.cardiacatlas.xpacs.repository.search.CapModelSearchRepository; import org.cardiacatlas.xpacs.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.time.LocalDate; import java.time.ZoneId; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the CapModelResource REST controller. * * @see CapModelResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = XpacswebApp.class) public class CapModelResourceIntTest { private static final LocalDate DEFAULT_CREATION_DATE = LocalDate.ofEpochDay(0L); private static final LocalDate UPDATED_CREATION_DATE = LocalDate.now(ZoneId.systemDefault()); private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String UPDATED_NAME = "BBBBBBBBBB"; private static final String DEFAULT_TYPE = "AAAAAAAAAA"; private static final String UPDATED_TYPE = "BBBBBBBBBB"; private static final String DEFAULT_XML_FILE = "AAAAAAAAAA"; private static final String UPDATED_XML_FILE = "BBBBBBBBBB"; private static final String DEFAULT_MODEL_FILE = "AAAAAAAAAA"; private static final String UPDATED_MODEL_FILE = "BBBBBBBBBB"; private static final String DEFAULT_URI = "AAAAAAAAAA"; private static final String UPDATED_URI = "BBBBBBBBBB"; private static final String DEFAULT_COMMENT = "AAAAAAAAAA"; private static final String UPDATED_COMMENT = "BBBBBBBBBB"; @Autowired private CapModelRepository capModelRepository; @Autowired private CapModelSearchRepository capModelSearchRepository; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restCapModelMockMvc; private CapModel capModel; @Before public void setup() { MockitoAnnotations.initMocks(this); CapModelResource capModelResource = new CapModelResource(capModelRepository, capModelSearchRepository); this.restCapModelMockMvc = MockMvcBuilders.standaloneSetup(capModelResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static CapModel createEntity(EntityManager em) { CapModel capModel = new CapModel() .creation_date(DEFAULT_CREATION_DATE) .name(DEFAULT_NAME) .type(DEFAULT_TYPE) .xml_file(DEFAULT_XML_FILE) .model_file(DEFAULT_MODEL_FILE) .uri(DEFAULT_URI) .comment(DEFAULT_COMMENT); // Add required entity PatientInfo patientInfoFK = PatientInfoResourceIntTest.createEntity(em); em.persist(patientInfoFK); em.flush(); capModel.setPatientInfoFK(patientInfoFK); return capModel; } @Before public void initTest() { capModelSearchRepository.deleteAll(); capModel = createEntity(em); } @Test @Transactional public void createCapModel() throws Exception { int databaseSizeBeforeCreate = capModelRepository.findAll().size(); // Create the CapModel restCapModelMockMvc.perform(post("/api/cap-models") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(capModel))) .andExpect(status().isCreated()); // Validate the CapModel in the database List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeCreate + 1); CapModel testCapModel = capModelList.get(capModelList.size() - 1); assertThat(testCapModel.getCreation_date()).isEqualTo(DEFAULT_CREATION_DATE); assertThat(testCapModel.getName()).isEqualTo(DEFAULT_NAME); assertThat(testCapModel.getType()).isEqualTo(DEFAULT_TYPE); assertThat(testCapModel.getXml_file()).isEqualTo(DEFAULT_XML_FILE); assertThat(testCapModel.getModel_file()).isEqualTo(DEFAULT_MODEL_FILE); assertThat(testCapModel.getUri()).isEqualTo(DEFAULT_URI); assertThat(testCapModel.getComment()).isEqualTo(DEFAULT_COMMENT); // Validate the CapModel in Elasticsearch CapModel capModelEs = capModelSearchRepository.findOne(testCapModel.getId()); assertThat(capModelEs).isEqualToComparingFieldByField(testCapModel); } @Test @Transactional public void createCapModelWithExistingId() throws Exception { int databaseSizeBeforeCreate = capModelRepository.findAll().size(); // Create the CapModel with an existing ID CapModel existingCapModel = new CapModel(); existingCapModel.setId(1L); // An entity with an existing ID cannot be created, so this API call must fail restCapModelMockMvc.perform(post("/api/cap-models") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(existingCapModel))) .andExpect(status().isBadRequest()); // Validate the Alice in the database List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void checkCreation_dateIsRequired() throws Exception { int databaseSizeBeforeTest = capModelRepository.findAll().size(); // set the field null capModel.setCreation_date(null); // Create the CapModel, which fails. restCapModelMockMvc.perform(post("/api/cap-models") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(capModel))) .andExpect(status().isBadRequest()); List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void checkNameIsRequired() throws Exception { int databaseSizeBeforeTest = capModelRepository.findAll().size(); // set the field null capModel.setName(null); // Create the CapModel, which fails. restCapModelMockMvc.perform(post("/api/cap-models") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(capModel))) .andExpect(status().isBadRequest()); List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeTest); } @Test @Transactional public void getAllCapModels() throws Exception { // Initialize the database capModelRepository.saveAndFlush(capModel); // Get all the capModelList restCapModelMockMvc.perform(get("/api/cap-models?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(capModel.getId().intValue()))) .andExpect(jsonPath("$.[*].creation_date").value(hasItem(DEFAULT_CREATION_DATE.toString()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString()))) .andExpect(jsonPath("$.[*].type").value(hasItem(DEFAULT_TYPE.toString()))) .andExpect(jsonPath("$.[*].xml_file").value(hasItem(DEFAULT_XML_FILE.toString()))) .andExpect(jsonPath("$.[*].model_file").value(hasItem(DEFAULT_MODEL_FILE.toString()))) .andExpect(jsonPath("$.[*].uri").value(hasItem(DEFAULT_URI.toString()))) .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString()))); } @Test @Transactional public void getCapModel() throws Exception { // Initialize the database capModelRepository.saveAndFlush(capModel); // Get the capModel restCapModelMockMvc.perform(get("/api/cap-models/{id}", capModel.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(capModel.getId().intValue())) .andExpect(jsonPath("$.creation_date").value(DEFAULT_CREATION_DATE.toString())) .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString())) .andExpect(jsonPath("$.type").value(DEFAULT_TYPE.toString())) .andExpect(jsonPath("$.xml_file").value(DEFAULT_XML_FILE.toString())) .andExpect(jsonPath("$.model_file").value(DEFAULT_MODEL_FILE.toString())) .andExpect(jsonPath("$.uri").value(DEFAULT_URI.toString())) .andExpect(jsonPath("$.comment").value(DEFAULT_COMMENT.toString())); } @Test @Transactional public void getNonExistingCapModel() throws Exception { // Get the capModel restCapModelMockMvc.perform(get("/api/cap-models/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateCapModel() throws Exception { // Initialize the database capModelRepository.saveAndFlush(capModel); capModelSearchRepository.save(capModel); int databaseSizeBeforeUpdate = capModelRepository.findAll().size(); // Update the capModel CapModel updatedCapModel = capModelRepository.findOne(capModel.getId()); updatedCapModel .creation_date(UPDATED_CREATION_DATE) .name(UPDATED_NAME) .type(UPDATED_TYPE) .xml_file(UPDATED_XML_FILE) .model_file(UPDATED_MODEL_FILE) .uri(UPDATED_URI) .comment(UPDATED_COMMENT); restCapModelMockMvc.perform(put("/api/cap-models") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(updatedCapModel))) .andExpect(status().isOk()); // Validate the CapModel in the database List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeUpdate); CapModel testCapModel = capModelList.get(capModelList.size() - 1); assertThat(testCapModel.getCreation_date()).isEqualTo(UPDATED_CREATION_DATE); assertThat(testCapModel.getName()).isEqualTo(UPDATED_NAME); assertThat(testCapModel.getType()).isEqualTo(UPDATED_TYPE); assertThat(testCapModel.getXml_file()).isEqualTo(UPDATED_XML_FILE); assertThat(testCapModel.getModel_file()).isEqualTo(UPDATED_MODEL_FILE); assertThat(testCapModel.getUri()).isEqualTo(UPDATED_URI); assertThat(testCapModel.getComment()).isEqualTo(UPDATED_COMMENT); // Validate the CapModel in Elasticsearch CapModel capModelEs = capModelSearchRepository.findOne(testCapModel.getId()); assertThat(capModelEs).isEqualToComparingFieldByField(testCapModel); } @Test @Transactional public void updateNonExistingCapModel() throws Exception { int databaseSizeBeforeUpdate = capModelRepository.findAll().size(); // Create the CapModel // If the entity doesn't have an ID, it will be created instead of just being updated restCapModelMockMvc.perform(put("/api/cap-models") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(capModel))) .andExpect(status().isCreated()); // Validate the CapModel in the database List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteCapModel() throws Exception { // Initialize the database capModelRepository.saveAndFlush(capModel); capModelSearchRepository.save(capModel); int databaseSizeBeforeDelete = capModelRepository.findAll().size(); // Get the capModel restCapModelMockMvc.perform(delete("/api/cap-models/{id}", capModel.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate Elasticsearch is empty boolean capModelExistsInEs = capModelSearchRepository.exists(capModel.getId()); assertThat(capModelExistsInEs).isFalse(); // Validate the database is empty List<CapModel> capModelList = capModelRepository.findAll(); assertThat(capModelList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void searchCapModel() throws Exception { // Initialize the database capModelRepository.saveAndFlush(capModel); capModelSearchRepository.save(capModel); // Search the capModel restCapModelMockMvc.perform(get("/api/_search/cap-models?query=id:" + capModel.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(capModel.getId().intValue()))) .andExpect(jsonPath("$.[*].creation_date").value(hasItem(DEFAULT_CREATION_DATE.toString()))) .andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString()))) .andExpect(jsonPath("$.[*].type").value(hasItem(DEFAULT_TYPE.toString()))) .andExpect(jsonPath("$.[*].xml_file").value(hasItem(DEFAULT_XML_FILE.toString()))) .andExpect(jsonPath("$.[*].model_file").value(hasItem(DEFAULT_MODEL_FILE.toString()))) .andExpect(jsonPath("$.[*].uri").value(hasItem(DEFAULT_URI.toString()))) .andExpect(jsonPath("$.[*].comment").value(hasItem(DEFAULT_COMMENT.toString()))); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(CapModel.class); } }
CardiacAtlasProject/xpacs-web
src/test/java/org/cardiacatlas/xpacs/web/rest/CapModelResourceIntTest.java
Java
gpl-3.0
15,512
/* * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. */ package com.fr.design.actions.cell.style; import com.fr.base.Style; import com.fr.base.chart.BaseChartCollection; import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.mainframe.ElementCasePane; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.Selection; import com.fr.report.cell.FloatElement; import com.fr.report.elementcase.TemplateElementCase; /** * Abstract cellstyle. */ public abstract class AbstractStyleAction extends ElementCaseAction implements StyleActionInterface { protected AbstractStyleAction(ElementCasePane t) { super(t); } @Override public abstract Style executeStyle(Style style, Style defStyle); @Override public boolean executeActionReturnUndoRecordNeeded() { ElementCasePane reportPane = this.getEditingComponent(); if (reportPane == null) { return false; } return ReportActionUtils.executeAction(this, reportPane); } /** * Update Style. * * @param style the updated style. */ @Override public void updateStyle(Style style) { // peter:这个方法默认情况下什么都不做. } public boolean isFontStye() { return true; } @Override public void update() { // james:应该从Action中的ReportPane拿Style,而不是从reportFrame中拿 this.setEnabled(true); ElementCasePane reportPane = this.getEditingComponent(); if (reportPane == null) { this.setEnabled(false); return; } if (isFontStye()) { Selection cs = reportPane.getSelection(); TemplateElementCase tplEC = reportPane.getEditingElementCase(); if (tplEC != null && cs instanceof FloatSelection) { FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); if (selectedFloat == null) { //有情况是撤销worksheet里面的元素撤消了,但是reportpane里面的selection没有变 reportPane.setSelection(new CellSelection()); return; } Object value = selectedFloat.getValue(); if (value instanceof BaseChartCollection) { this.setEnabled(false); return; } } } // 更新Style this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); } }
fanruan/finereport-design
designer/src/com/fr/design/actions/cell/style/AbstractStyleAction.java
Java
gpl-3.0
2,765
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.16"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Arionide: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Arionide &#160;<span id="projectnumber">1.1</span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.16 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacech.html">ch</a></li><li class="navelem"><a class="el" href="namespacech_1_1innovazion.html">innovazion</a></li><li class="navelem"><a class="el" href="namespacech_1_1innovazion_1_1arionide.html">arionide</a></li><li class="navelem"><a class="el" href="namespacech_1_1innovazion_1_1arionide_1_1lang.html">lang</a></li><li class="navelem"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">TextObject</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">ch.innovazion.arionide.lang.TextObject Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">ch.innovazion.arionide.lang.TextObject</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a763a0e0c1c70bb97819a1ee6fe3f1ed3">add</a>(String value, NativeDataCommunicator communicator)</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a275580999682ab44c16dcceb68aff268">data</a></td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html#a6e49f8cb1f268673f9fad48a0e538c18">getData</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">ch.innovazion.arionide.lang.TextObject</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#ac70d19286a217c02fcff9c83e62394a4">getDataStream</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a8ef0a7d935316cc4b41b207652a8fd05">getID</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#aada45f75cea3cfaefce475e60b4c5801">getObjects</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a56c7d4e76ab27b9de00e29b8ad72708a">getSize</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html#ac74145cddec5990ee94002c4e2738cbb">getValue</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">ch.innovazion.arionide.lang.TextObject</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#aff550405909a549ac9a702faac351d16">id</a></td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a9959c00a1d61fe433c46980392081817">index</a></td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a9ed9914713a78ac74c4a00bd750ec8cc">isConsistent</a>()</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a8f687a17b5b25eb55020099b42b13243">Object</a>(List&lt; Integer &gt; structure, String id)</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html#a933df67db868f41fa673f1b4b305b8f0">setValue</a>(String value)</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">ch.innovazion.arionide.lang.TextObject</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html#a419149f1e76528b51c8f0f2e08c8a842">structure</a></td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_object.html">ch.innovazion.arionide.lang.Object</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html#a254d98897fe19f5b1a49d8d7ef2291cf">TextObject</a>(String value, String id)</td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">ch.innovazion.arionide.lang.TextObject</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html#a1cdf03866756fc9359110e9145df57b4">value</a></td><td class="entry"><a class="el" href="classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object.html">ch.innovazion.arionide.lang.TextObject</a></td><td class="entry"><span class="mlabel">private</span></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.16 </small></address> </body> </html>
thedreamer979/Arionide
doc/html/classch_1_1innovazion_1_1arionide_1_1lang_1_1_text_object-members.html
HTML
gpl-3.0
9,417
<?php namespace App\Http\Controllers; use App\Models\Course; use Illuminate\Http\Request; use App\Http\Requests; class CourseController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $courses = Course::all(); return view('courses.index', compact('courses')); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('courses.create'); } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, [ 'name' => 'unique:courses,name|required|max:255', ]); Course::create([ 'name' => $request->name, ]); return redirect('/course'); } /** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { // } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } }
bvbunnik/laravel-recipes
app/Http/Controllers/CourseController.php
PHP
gpl-3.0
1,877
body { counter-reset:table figure; background-color: #fff; margin: 1em auto; max-width: 700px; overflow: visible; padding-left: 2em; padding-right: 2em; font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.35; } #header { text-align: center; } #TOC { clear: both; margin: 0 0 10px 10px; padding: 4px; width: 400px; border: 1px solid #CCCCCC; border-radius: 5px; background-color: #f6f6f6; font-size: 13px; line-height: 1.3; } #TOC .toctitle { font-weight: bold; font-size: 15px; margin-left: 5px; } #TOC ul { padding-left: 40px; margin-left: -1.5em; margin-top: 5px; margin-bottom: 5px; } #TOC ul ul { margin-left: -2em; } #TOC li { line-height: 16px; } table { margin: 1em auto; border-width: 1px; border-color: #DDDDDD; border-style: outset; border-collapse: collapse; } table th { border-width: 2px; padding: 5px; border-style: inset; } table td { border-width: 1px; border-style: inset; line-height: 18px; padding: 5px 5px; } table, table th, table td { border-left-style: none; border-right-style: none; } table thead, table tr.even { background-color: #f7f7f7; } p { margin: 0.5em 0; } blockquote { background-color: #f6f6f6; padding: 0.25em 0.75em; } hr { border-style: solid; border: none; border-top: 1px solid #777; margin: 28px 0; } dl { margin-left: 0; } dl dd { margin-bottom: 13px; margin-left: 13px; } dl dt { font-weight: bold; } ul { margin-top: 0; } ul li { list-style: circle outside; } ul ul { margin-bottom: 0; } pre, code { background-color: #f7f7f7; border-radius: 3px; color: #333; white-space: pre-wrap; /* Wrap long lines */ } pre { border-radius: 3px; margin: 5px 0px 10px 0px; padding: 10px; } pre:not([class]) { background-color: #f7f7f7; } code { font-family: Consolas, Monaco, 'Courier New', monospace; font-size: 85%; } p > code, li > code { padding: 2px 0px; } div.figure { text-align: center; } img { background-color: #FFFFFF; padding: 2px; border: 1px solid #DDDDDD; border-radius: 3px; border: 1px solid #CCCCCC; margin: 0 5px; border:1px solid #021a40; } h1 { margin-top: 0; font-size: 35px; line-height: 40px; } h2 { border-bottom: 4px solid #f7f7f7; padding-top: 10px; padding-bottom: 2px; font-size: 145%; } h3 { border-bottom: 2px solid #f7f7f7; padding-top: 10px; font-size: 120%; } h4 { border-bottom: 1px solid #f7f7f7; margin-left: 8px; font-size: 105%; } h5, h6 { border-bottom: 1px solid #ccc; font-size: 105%; } a { color: #0033dd; text-decoration: none; } a:hover { color: #6666ff; } a:visited { color: #800080; } a:visited:hover { color: #BB00BB; } a[href^="http:"] { text-decoration: underline; } a[href^="https:"] { text-decoration: underline; } caption::before{ counter-increment: table; content: "Table " counter(table) ": "; } .caption::before{ counter-increment: figure; content: "Figure " counter(figure) ": "; } p.caption { font-style: italic; font-size: 90%; color: grey; margin-bottom: 3.5em; } /* Class described in https://benjeffrey.com/posts/pandoc-syntax-highlighting-css Colours from https://gist.github.com/robsimmons/1172277 */ code > span.kw { color: #555; font-weight: bold; } /* Keyword */ code > span.dt { color: #902000; } /* DataType */ code > span.dv { color: #40a070; } /* DecVal (decimal values) */ code > span.bn { color: #d14; } /* BaseN */ code > span.fl { color: #d14; } /* Float */ code > span.ch { color: #d14; } /* Char */ code > span.st { color: #d14; } /* String */ code > span.co { color: #888888; font-style: italic; } /* Comment */ code > span.ot { color: #007020; } /* OtherToken */ code > span.al { color: #ff0000; font-weight: bold; } /* AlertToken */ code > span.fu { color: #900; font-weight: bold; } /* Function calls */ code > span.er { color: #a61717; background-color: #e3d2d2; } /* ErrorTok */
dinilu/EPDr
vignettes/myvignette.css
CSS
gpl-3.0
4,066
/** Copyright 2010 Christian Kästner This file is part of CIDE. CIDE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. CIDE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with CIDE. If not, see <http://www.gnu.org/licenses/>. See http://www.fosd.de/cide/ for further information. */ package de.ovgu.cide.export.physical.internal; import de.ovgu.cide.export.CopiedNaiveASTFlattener; import de.ovgu.cide.export.useroptions.IUserOptionProvider; public interface IPhysicalOptions extends IUserOptionProvider { boolean getDerivativesInSubdirectories(); /** * debug only * * @return */ boolean isDebugPrintInnerClassRefinements(); /** * if true, than method objects are refactored into static top-level * classes, i.e., a this pointer is passed and own files are created. * * otherwise method objects are just created and refined as non-static inner * classes */ boolean getMethodObjectsInStaticToplevelClass(); /** * move all classes to top level classes (necessary for AHEAD) */ boolean getFlattenPackages(); /** * if all classes are moved to top level classes, remove all import * declarations that start with this prefix (null if none), e.g. * "com.sleepycat" */ String getRemovePackagePrefix(); /** * allows a prefix for each file, even depending on the current layer. used * by ahead to add a "layer X;" specification * * null if no header is specified * * @param layerName * @return */ String getFileHeader(String layerName); /** * returns the pretty printer that handles the correct output of refinements * and Super calls etc. * * @return */ CopiedNaiveASTFlattener getPrettyPrinter(); /** * file name for a given class name * * @param identifier * @return */ String getFilename(String className); }
ckaestne/CIDE
CIDE_Export_Physical/src/de/ovgu/cide/export/physical/internal/IPhysicalOptions.java
Java
gpl-3.0
2,325
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="de"> <head> <!-- Generated by javadoc (1.8.0_172) on Thu Jan 13 22:52:30 CET 2022 --> <title>Uses of Class meico.mpm.elements.maps.data.RubatoData</title> <meta name="date" content="2022-01-13"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class meico.mpm.elements.maps.data.RubatoData"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?meico/mpm/elements/maps/data/class-use/RubatoData.html" target="_top">Frames</a></li> <li><a href="RubatoData.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class meico.mpm.elements.maps.data.RubatoData" class="title">Uses of Class<br>meico.mpm.elements.maps.data.RubatoData</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#meico.mpm.elements.maps">meico.mpm.elements.maps</a></td> <td class="colLast"> <div class="block">Contains the classes for MPM maps.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#meico.mpm.elements.maps.data">meico.mpm.elements.maps.data</a></td> <td class="colLast"> <div class="block">The classes in this package represent performance data.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="meico.mpm.elements.maps"> <!-- --> </a> <h3>Uses of <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a> in <a href="../../../../../../meico/mpm/elements/maps/package-summary.html">meico.mpm.elements.maps</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../meico/mpm/elements/maps/package-summary.html">meico.mpm.elements.maps</a> that return <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>private <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></code></td> <td class="colLast"><span class="typeNameLabel">RubatoMap.</span><code><span class="memberNameLink"><a href="../../../../../../meico/mpm/elements/maps/RubatoMap.html#getRubatoDataAt-double-">getRubatoDataAt</a></span>(double&nbsp;date)</code> <div class="block">collect all data that is needed to compute the rubato at the specified date</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>private <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></code></td> <td class="colLast"><span class="typeNameLabel">RubatoMap.</span><code><span class="memberNameLink"><a href="../../../../../../meico/mpm/elements/maps/RubatoMap.html#getRubatoDataOf-int-">getRubatoDataOf</a></span>(int&nbsp;index)</code> <div class="block">this collects the rubato data of a specific element of this rubatoMap, given via the index</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../meico/mpm/elements/maps/package-summary.html">meico.mpm.elements.maps</a> with parameters of type <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><span class="typeNameLabel">RubatoMap.</span><code><span class="memberNameLink"><a href="../../../../../../meico/mpm/elements/maps/RubatoMap.html#addRubato-meico.mpm.elements.maps.data.RubatoData-">addRubato</a></span>(<a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a>&nbsp;data)</code> <div class="block">add a rubato element to the map</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>private static double</code></td> <td class="colLast"><span class="typeNameLabel">RubatoMap.</span><code><span class="memberNameLink"><a href="../../../../../../meico/mpm/elements/maps/RubatoMap.html#computeRubatoTransformation-double-meico.mpm.elements.maps.data.RubatoData-">computeRubatoTransformation</a></span>(double&nbsp;date, <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a>&nbsp;rubatoData)</code> <div class="block">compute the date to which the input date is shifted by the specified rubato</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="meico.mpm.elements.maps.data"> <!-- --> </a> <h3>Uses of <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a> in <a href="../../../../../../meico/mpm/elements/maps/data/package-summary.html">meico.mpm.elements.maps.data</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../meico/mpm/elements/maps/data/package-summary.html">meico.mpm.elements.maps.data</a> that return <a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">RubatoData</a></code></td> <td class="colLast"><span class="typeNameLabel">RubatoData.</span><code><span class="memberNameLink"><a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html#clone--">clone</a></span>()</code> <div class="block">create a copy of this object</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../meico/mpm/elements/maps/data/RubatoData.html" title="class in meico.mpm.elements.maps.data">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?meico/mpm/elements/maps/data/class-use/RubatoData.html" target="_top">Frames</a></li> <li><a href="RubatoData.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
cemfi/meico
docs/meico/mpm/elements/maps/data/class-use/RubatoData.html
HTML
gpl-3.0
10,793
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * LICENSE: See LICENSE in the top level directory * FILE: game_sa/CVehicleSA.cpp * PURPOSE: Vehicle base entity * DEVELOPERS: Ed Lyons <eai@opencoding.net> * Christian Myhre Lundheim <> * Cecill Etheredge <ijsf@gmx.net> * Jax <> * Stanislav Bobrov <lil_toady@hotmail.com> * The_GTA <> * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ #include "StdInc.h" extern CGameSA* pGame; CVehicleSA::CVehicleSA () : m_ucAlpha ( 255 ), m_bIsDerailable ( true ), m_vecGravity ( 0.0f, 0.0f, -1.0f ), m_HeadLightColor ( SColorRGBA ( 255, 255, 255, 255 ) ) { } /** *\todo ASAP: Remove all the VC specific (SCM) function calls propperly */ CVehicleSA::CVehicleSA( eVehicleTypes dwModelID ) : m_ucAlpha ( 255 ), m_bIsDerailable ( true ), m_vecGravity ( 0.0f, 0.0f, -1.0f ), m_HeadLightColor ( SColorRGBA ( 255, 255, 255, 255 ) ) { DEBUG_TRACE("CVehicleSA::CVehicleSA( eVehicleTypes dwModelID )"); // for SA, we can just call the following function and it should just work: // CCarCtrl::CreateCarForScript(int,class CVector,unsigned char) // ModelID, Position, IsMissionVehicle DWORD dwReturn = 0; // Is it a train? DWORD dwFunc = FUNC_CCarCtrlCreateCarForScript; _asm { push 0 // its a mission vehicle push 0 push 0 push 0 // spawn at 0,0,0 push dwModelID call dwFunc add esp, 0x14 mov dwReturn, eax } m_pInterface = reinterpret_cast < CEntitySAInterface* > ( dwReturn ); this->BeingDeleted = FALSE; m_pInterface->bStreamingDontDelete = true; m_pInterface->bDontStream = true; // store our CVehicleSA pointer in the vehicle's time of creation member (as it won't get modified later and as far as I know it isn't used for something important) GetVehicleInterface ()->m_pVehicle = this; // Unlock doors as they spawn randomly with locked doors LockDoors ( false ); // Reset the car countss to 0 so that this vehicle doesn't affect the population vehicles for ( int i = 0; i < 5; i++ ) { *(DWORD *)(VARS_CarCounts + i * sizeof(DWORD)) = 0; } // only applicable for CAutomobile based vehicles (i.e. not bikes or boats, but includes planes, helis etc) this->damageManager = new CDamageManagerSA ( m_pInterface, (CDamageManagerSAInterface *)((DWORD)this->GetInterface() + 1440)); // Replace the handling interface with our own to prevent handlig.cfg cheats and allow custom handling stuff. // We don't use SA's array because we want one handling per vehicle type and also allow custom handlings // per car later. /*CHandlingEntry* pEntry = pGame->GetHandlingManager ()->CreateHandlingData (); //CHandlingEntry* pEntry = pGame->GetHandlingManager ()->GetHandlingData ( dwModelID ); pEntry->ApplyHandlingData ( pGame->GetHandlingManager ()->GetHandlingData ( dwModelID ) ); // We need to do that so vehicle handling wont get corrupted SetHandlingData ( pEntry ); pEntry->Recalculate ();*/ GetVehicleInterface ()->m_nVehicleFlags.bVehicleCanBeTargetted = true; this->internalID = pGame->GetPools ()->GetVehicleRef ( (DWORD *)this->GetVehicleInterface () ); } CVehicleSA::CVehicleSA ( CVehicleSAInterface * vehicleInterface ) { m_pInterface = vehicleInterface; m_pInterface->bStreamingDontDelete = true; m_pInterface->bDontStream = true; this->BeingDeleted = FALSE; // Store our CVehicleSA pointer in the vehicle's time of creation member (as it won't get modified later and as far as I know it isn't used for something important) GetVehicleInterface ()->m_pVehicle = this; // Reset the car countss to 0 so that this vehicle doesn't affect the population vehicles for ( int i = 0; i < 5; i++ ) { *(DWORD *)(VARS_CarCounts + i * sizeof(DWORD)) = 0; } // only applicable for CAutomobile based vehicles (i.e. not bikes, trains or boats, but includes planes, helis etc) this->damageManager = new CDamageManagerSA( m_pInterface, (CDamageManagerSAInterface *)((DWORD)this->GetInterface() + 1440)); this->internalID = pGame->GetPools ()->GetVehicleRef ( (DWORD *)this->GetVehicleInterface () ); m_bIsDerailable = true; m_ucAlpha = 255; } // DESTRUCTOR CVehicleSA::~CVehicleSA() { DEBUG_TRACE("CVehicleSA::~CVehicleSA()"); if(!this->BeingDeleted) { if ( (DWORD)m_pInterface->vtbl != VTBL_CPlaceable ) { GetVehicleInterface ()->m_pVehicle = NULL; if ( this->damageManager ) delete this->damageManager; DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = 0x6D2460; _asm { mov ecx, dwThis call dwFunc } CWorldSA * world = (CWorldSA *)pGame->GetWorld(); world->Remove ( m_pInterface ); world->RemoveReferencesToDeletedObject ( m_pInterface ); dwFunc = m_pInterface->vtbl->SCALAR_DELETING_DESTRUCTOR; // we use the vtbl so we can be vehicle type independent _asm { mov ecx, dwThis push 1 //delete too call dwFunc } } this->BeingDeleted = true; ((CPoolsSA *)pGame->GetPools())->RemoveVehicle((CVehicle *)this); } } VOID CVehicleSA::SetMoveSpeed ( CVector* vecMoveSpeed ) { DWORD dwFunc = FUNC_GetMoveSpeed; DWORD dwThis = (DWORD)this->GetInterface(); DWORD dwReturn = 0; _asm { mov ecx, dwThis call dwFunc mov dwReturn, eax } memcpy((void *)dwReturn, vecMoveSpeed, sizeof(CVector)); // In case of train: calculate on-rail speed WORD wModelID = GetModelIndex(); if ( wModelID == 537 || wModelID == 538 || wModelID == 569 || wModelID == 570 || wModelID == 590 || wModelID == 449 ) { if ( !IsDerailed () ) { CVehicleSAInterface* pInterf = GetVehicleInterface (); // Find the rail node we are on DWORD dwNumNodes = ((DWORD *)ARRAY_NumRailTrackNodes) [ pInterf->m_ucRailTrackID ]; SRailNodeSA* pNode = ( (SRailNodeSA **) ARRAY_RailTrackNodePointers ) [ pInterf->m_ucRailTrackID ]; SRailNodeSA* pNodesEnd = &pNode [ dwNumNodes ]; while ( (float)pNode->sRailDistance / 3.0f <= pInterf->m_fTrainRailDistance && pNode < pNodesEnd ) { pNode++; } if ( pNode >= pNodesEnd ) return; // Get the direction vector between the nodes the train is between CVector vecNode1 ( (float)(pNode - 1)->sX / 8.0f, (float)(pNode - 1)->sY / 8.0f, (float)(pNode - 1)->sZ / 8.0f ); CVector vecNode2 ( (float)pNode->sX / 8.0f, (float)pNode->sY / 8.0f, (float)pNode->sZ / 8.0f ); CVector vecDirection = vecNode2 - vecNode1; vecDirection.Normalize (); // Set the speed pInterf->m_fTrainSpeed = vecDirection.DotProduct ( vecMoveSpeed ); } } } CVehicleSAInterface * CVehicleSA::GetNextCarriageInTrain ( void ) { return (CVehicleSAInterface *)*(DWORD *)((DWORD)this->GetInterface() + 1492); } CVehicle * CVehicleSA::GetNextTrainCarriage ( void ) { CVehicleSAInterface * pVehicle = GetNextCarriageInTrain(); if ( pVehicle ) return pGame->GetPools()->GetVehicle ( (DWORD *)pVehicle ); else return NULL; } bool CVehicleSA::AddProjectile ( eWeaponType eWeapon, CVector vecOrigin, float fForce, CVector * target, CEntity * targetEntity ) { return ((CProjectileInfoSA*)pGame->GetProjectileInfo())->AddProjectile ( (CEntitySA*)this, eWeapon, vecOrigin, fForce, target, targetEntity ); } void CVehicleSA::SetNextTrainCarriage ( CVehicle * next ) { if ( next ) { CVehicleSA * pNextVehicle = dynamic_cast < CVehicleSA* > ( next ); if ( pNextVehicle ) { *(DWORD *)((DWORD)this->GetInterface () + 1492) = (DWORD)pNextVehicle->GetInterface(); if ( pNextVehicle->GetPreviousTrainCarriage () != this ) pNextVehicle->SetPreviousTrainCarriage ( this ); } } else { *(DWORD *)((DWORD)this->GetInterface() + 1492) = NULL; } } CVehicleSAInterface * CVehicleSA::GetPreviousCarriageInTrain ( void ) { return (CVehicleSAInterface *)*(DWORD *)((DWORD)this->GetInterface() + 1488); } void CVehicleSA::SetPreviousTrainCarriage ( CVehicle * previous ) { if ( previous ) { CVehicleSA * pPreviousVehicle = dynamic_cast < CVehicleSA* > ( previous ); if ( pPreviousVehicle ) { *(DWORD *)((DWORD)this->GetInterface () + 1488) = (DWORD)pPreviousVehicle->GetInterface(); if ( pPreviousVehicle->GetNextTrainCarriage () != this ) pPreviousVehicle->SetNextTrainCarriage ( this ); } } else { *(DWORD *)((DWORD)this->GetInterface() + 1488) = NULL; } } CVehicle * CVehicleSA::GetPreviousTrainCarriage ( void ) { CVehicleSAInterface * pVehicle = GetPreviousCarriageInTrain(); if ( pVehicle ) return pGame->GetPools()->GetVehicle ( (DWORD *)pVehicle ); else return NULL; } bool CVehicleSA::IsDerailed ( void ) { CVehicleSAInterface* pInterface = GetVehicleInterface (); return pInterface->trainFlags.bIsDerailed; } void CVehicleSA::SetDerailed ( bool bDerailed ) { WORD wModelID = GetModelIndex(); if ( wModelID == 537 || wModelID == 538 || wModelID == 569 || wModelID == 570 || wModelID == 590 || wModelID == 449 ) { CVehicleSAInterface* pInterface = GetVehicleInterface (); DWORD dwThis = (DWORD)pInterface; if ( bDerailed ) { pInterface->trainFlags.bIsDerailed = true; * ( DWORD * ) ( dwThis + 64 ) &= ( DWORD ) 0xFFFDFFFB; } else { pInterface->trainFlags.bIsDerailed = false; * ( DWORD * ) ( dwThis + 64 ) |= ( DWORD ) 0x20004; // Recalculate the on-rail distance from the start node (train position parameter, m_fTrainRailDistance) DWORD dwFunc = FUNC_CVehicle_RecalcOnRailDistance; _asm { mov ecx, dwThis call dwFunc } // Reset the speed GetVehicleInterface ()->m_fTrainSpeed = 0.0f; } } } float CVehicleSA::GetTrainSpeed () { return GetVehicleInterface ()->m_fTrainSpeed; } void CVehicleSA::SetTrainSpeed ( float fSpeed ) { GetVehicleInterface ()->m_fTrainSpeed = fSpeed; } bool CVehicleSA::GetTrainDirection () { return ( *( (BYTE *)GetInterface () + 1464 ) & 0x40 ) != 0; } void CVehicleSA::SetTrainDirection ( bool bDirection ) { if ( bDirection ) { *( (BYTE *)GetInterface () + 1464 ) |= 0x40; } else { *( (BYTE *)GetInterface () + 1464 ) &= ~0x40; } } BYTE CVehicleSA::GetRailTrack () { return GetVehicleInterface ()->m_ucRailTrackID; } void CVehicleSA::SetRailTrack ( BYTE ucTrackID ) { if ( ucTrackID >= NUM_RAILTRACKS ) return; CVehicleSAInterface* pInterf = GetVehicleInterface (); pInterf->m_ucRailTrackID = ucTrackID; if ( !IsDerailed () ) { DWORD dwFunc = FUNC_CVehicle_RecalcOnRailDistance; _asm { mov ecx, pInterf call dwFunc } } } bool CVehicleSA::CanPedEnterCar ( void ) { DEBUG_TRACE("bool CVehicleSA::CanPedEnterCar ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_CanPedEnterCar; bool bReturn = false; _asm { mov ecx, dwThis call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::CanPedJumpOutCar ( CPed* pPed ) { DEBUG_TRACE("bool CVehicleSA::CanPedJumpOutCar ( CPed* pPed )"); bool bReturn = false; CPedSA* pPedSA = dynamic_cast < CPedSA* > ( pPed ); if ( pPedSA ) { DWORD dwThis = (DWORD) m_pInterface; CPedSAInterface* pPedInt = pPedSA->GetPedInterface(); DWORD dwFunc = FUNC_CVehicle_CanPedJumpOutCar; _asm { mov ecx, dwThis push pPedInt call dwFunc mov bReturn, al } } return bReturn; } bool CVehicleSA::AreDoorsLocked ( void ) { return ( GetVehicleInterface ()->ul_doorstate == 2 || GetVehicleInterface ()->ul_doorstate == 5 || GetVehicleInterface ()->ul_doorstate == 4 || GetVehicleInterface ()->ul_doorstate == 7 || GetVehicleInterface ()->ul_doorstate == 3 ); } void CVehicleSA::LockDoors ( bool bLocked ) { bool bAreDoorsLocked = AreDoorsLocked (); bool bAreDoorsUndamageable = AreDoorsUndamageable (); if ( bLocked && !bAreDoorsLocked ) { if ( bAreDoorsUndamageable ) GetVehicleInterface ()->ul_doorstate = 7; else GetVehicleInterface ()->ul_doorstate = 2; } else if ( !bLocked && bAreDoorsLocked ) { if ( bAreDoorsUndamageable ) GetVehicleInterface ()->ul_doorstate = 1; else GetVehicleInterface ()->ul_doorstate = 0; } } bool CVehicleSA::AreDoorsUndamageable ( void ) { return ( GetVehicleInterface ()->ul_doorstate == 1 || GetVehicleInterface ()->ul_doorstate == 7 ); } void CVehicleSA::SetDoorsUndamageable ( bool bUndamageable ) { bool bAreDoorsLocked = AreDoorsLocked (); bool bAreDoorsUndamageable = AreDoorsUndamageable (); if ( bUndamageable && !bAreDoorsUndamageable ) { if ( bAreDoorsLocked ) GetVehicleInterface ()->ul_doorstate = 7; else GetVehicleInterface ()->ul_doorstate = 1; } else if ( !bUndamageable && bAreDoorsUndamageable ) { if ( bAreDoorsLocked ) GetVehicleInterface ()->ul_doorstate = 2; else GetVehicleInterface ()->ul_doorstate = 0; } } void CVehicleSA::AddVehicleUpgrade ( DWORD dwModelID ) { DEBUG_TRACE("void CVehicleSA::AddVehicleUpgrade ( DWORD dwModelID )"); if ( dwModelID >= 1000 && dwModelID <= 1193 ) { DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_AddVehicleUpgrade; _asm { mov ecx, dwThis push dwModelID call dwFunc } } } void CVehicleSA::RemoveVehicleUpgrade ( DWORD dwModelID ) { DEBUG_TRACE("void CVehicleSA::RemoveVehicleUpgrade ( DWORD dwModelID )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_RemoveVehicleUpgrade; _asm { mov ecx, dwThis push dwModelID call dwFunc } } bool CVehicleSA::CanPedLeanOut ( CPed* pPed ) { DEBUG_TRACE("bool CVehicleSA::CanPedLeanOut ( CPed* pPed )"); bool bReturn = false; CPedSA* pPedSA = dynamic_cast < CPedSA* > ( pPed ); if ( pPedSA ) { DWORD dwThis = (DWORD) m_pInterface; CPedSAInterface* pPedInt = pPedSA->GetPedInterface(); DWORD dwFunc = FUNC_CVehicle_CanPedLeanOut; _asm { mov ecx, dwThis push pPedInt call dwFunc mov bReturn, al } } return bReturn; } bool CVehicleSA::CanPedStepOutCar ( bool bUnknown ) { DEBUG_TRACE("bool CVehicleSA::CanPedStepOutCar ( bool bUnknown )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwUnknown = (DWORD) bUnknown; DWORD dwFunc = FUNC_CVehicle_CanPedStepOutCar; bool bReturn = false; _asm { mov ecx, dwThis push dwUnknown call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::CarHasRoof ( void ) { DEBUG_TRACE("bool CVehicleSA::CarHasRoof ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_CarHasRoof; bool bReturn = false; _asm { mov ecx, dwThis call dwFunc mov bReturn, al } return bReturn; } void CVehicleSA::ExtinguishCarFire ( void ) { DEBUG_TRACE("void CVehicleSA::ExtinguishCarFire ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_ExtinguishCarFire; _asm { mov ecx, dwThis call dwFunc } } DWORD CVehicleSA::GetBaseVehicleType ( void ) { DEBUG_TRACE("DWORD CVehicleSA::GetBaseVehicleType ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_GetBaseVehicleType; DWORD dwReturn = 0; _asm { mov ecx, dwThis call dwFunc mov dwReturn, eax } return dwReturn; } void CVehicleSA::SetBodyDirtLevel ( float fDirtLevel ) { DEBUG_TRACE("void CVehicleSA::SetBodyDirtLevel ( float fDirtLevel )"); GetVehicleInterface ()->nBodyDirtLevel = fDirtLevel; } float CVehicleSA::GetBodyDirtLevel ( void ) { DEBUG_TRACE("float CVehicleSA::GetBodyDirtLevel ( void )"); return GetVehicleInterface ()->nBodyDirtLevel; } unsigned char CVehicleSA::GetCurrentGear ( void ) { DEBUG_TRACE("unsigned char CVehicleSA::GetCurrentGear ( void )"); return GetVehicleInterface ()->m_nCurrentGear; } float CVehicleSA::GetGasPedal ( void ) { DEBUG_TRACE("float CVehicleSA::GetGasPedal ( void )"); return GetVehicleInterface ()->m_fGasPedal; } float CVehicleSA::GetHeightAboveRoad ( void ) { DEBUG_TRACE("float CVehicleSA::GetHeightAboveRoad ( void )"); DWORD dwThis = (DWORD) GetVehicleInterface (); DWORD dwFunc = FUNC_CVehicle_GetHeightAboveRoad; float fReturn; _asm { mov ecx, dwThis call dwFunc fstp fReturn } return fReturn; } float CVehicleSA::GetSteerAngle ( void ) { DEBUG_TRACE("float CVehicleSA::GetSteerAngle ( void )"); return GetVehicleInterface ()->m_fSteerAngle; } bool CVehicleSA::GetTowBarPos ( CVector* pVector ) { DEBUG_TRACE("bool CVehicleSA::GetTowBarPos ( CVector* pVector )"); CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(m_pInterface->vtbl); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = vehicleVTBL->GetTowbarPos; bool bReturn = false; _asm { mov ecx, dwThis push 0 push 1 push pVector call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::GetTowHitchPos ( CVector* pVector ) { DEBUG_TRACE("bool CVehicleSA::GetTowHitchPos ( CVector* pVector )"); CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(m_pInterface->vtbl); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = vehicleVTBL->GetTowHitchPos; bool bReturn = false; _asm { mov ecx, dwThis push 0 push 1 push pVector call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::IsOnItsSide ( void ) { DEBUG_TRACE("bool CVehicleSA::IsOnItsSide ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_IsOnItsSide; bool bReturn = false; _asm { mov ecx, dwThis call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::IsLawEnforcementVehicle ( void ) { DEBUG_TRACE("bool CVehicleSA::IsLawEnforcementVehicle ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_IsLawEnforcementVehicle; bool bReturn = false; _asm { mov ecx, dwThis call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::IsPassenger ( CPed* pPed ) { DEBUG_TRACE("bool CVehicleSA::IsPassenger ( CPed* pPed )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_IsPassenger; bool bReturn = false; _asm { mov ecx, dwThis push pPed call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::IsSphereTouchingVehicle ( CVector * vecOrigin, float fRadius ) { DEBUG_TRACE("bool CVehicleSA::IsSphereTouchingVehicle ( CVector * vecOrigin, float fRadius )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_IsSphereTouchingVehicle; bool bReturn = false; _asm { push eax mov ecx, dwThis mov eax, vecOrigin push fRadius push dword ptr [eax] push dword ptr [eax + 4] push dword ptr [eax + 8] call dwFunc mov bReturn, al } return bReturn; } bool CVehicleSA::IsUpsideDown ( void ) { DEBUG_TRACE("bool CVehicleSA::IsUpsideDown ( void )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_IsUpsideDown; bool bReturn = false; _asm { mov ecx, dwThis call dwFunc mov bReturn, al } return bReturn; } void CVehicleSA::MakeDirty ( CColPoint* pPoint ) { DEBUG_TRACE("void CVehicleSA::MakeDirty ( CColPoint* pPoint )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = FUNC_CVehicle_MakeDirty; _asm { mov ecx, dwThis push pPoint call dwFunc } } void CVehicleSA::SetEngineOn ( bool bEngineOn ) { DEBUG_TRACE("void CVehicleSA::SetEngineOn ( bool bEngineOn )"); DWORD dwThis = (DWORD) m_pInterface; DWORD dwEngineOn = (DWORD) bEngineOn; DWORD dwFunc = FUNC_CVehicle_SetEngineOn; _asm { mov ecx, dwThis push dwEngineOn call dwFunc } } CPed* CVehicleSA::GetDriver ( void ) { DEBUG_TRACE("CPed* CVehicleSA::GetDriver ( void )"); CPoolsSA* pPools = (CPoolsSA *)pGame->GetPools(); CPedSAInterface* pDriver = GetVehicleInterface ()->pDriver; if ( pDriver ) return pPools->GetPed( (DWORD*) pDriver ); else return NULL; } CPed* CVehicleSA::GetPassenger ( unsigned char ucSlot ) { DEBUG_TRACE("CPed* CVehicleSA::GetPassenger ( unsigned char ucSlot )"); CPoolsSA* pPools = (CPoolsSA *)pGame->GetPools(); if ( ucSlot < 8 ) { CPedSAInterface* pPassenger = GetVehicleInterface ()->pPassengers [ucSlot]; if ( pPassenger ) return pPools->GetPed( (DWORD*) pPassenger ); } return NULL; } bool CVehicleSA::IsBeingDriven() { DEBUG_TRACE("bool CVehicleSA::IsBeingDriven()"); CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); if ( GetVehicleInterface ()->pDriver != NULL ) return TRUE; else return FALSE; } /** * \todo Implement for other vehicle types too and check */ void CVehicleSA::PlaceBikeOnRoadProperly() { DEBUG_TRACE("void CVehicleSA::PlaceBikeOnRoadProperly()"); DWORD dwFunc = FUNC_Bike_PlaceOnRoadProperly; DWORD dwBike = (DWORD)this->GetInterface(); _asm { mov ecx, dwBike call dwFunc } } void CVehicleSA::PlaceAutomobileOnRoadProperly() { DEBUG_TRACE("void CVehicleSA::PlaceAutomobileOnRoadProperly()"); DWORD dwFunc = FUNC_Automobile_PlaceOnRoadProperly; DWORD dwAutomobile = (DWORD)this->GetInterface(); _asm { mov ecx, dwAutomobile call dwFunc } } void CVehicleSA::SetColor ( unsigned char color1, unsigned char color2, unsigned char color3, unsigned char color4 ) { ((CVehicleSAInterface *)(this->GetInterface()))->m_colour1 = color1; ((CVehicleSAInterface *)(this->GetInterface()))->m_colour2 = color2; ((CVehicleSAInterface *)(this->GetInterface()))->m_colour3 = color3; ((CVehicleSAInterface *)(this->GetInterface()))->m_colour3 = color4; } void CVehicleSA::GetColor ( unsigned char* color1, unsigned char* color2, unsigned char* color3, unsigned char* color4 ) { *color1 = ((CVehicleSAInterface *)(this->GetInterface()))->m_colour1; *color2 = ((CVehicleSAInterface *)(this->GetInterface()))->m_colour2; *color3 = ((CVehicleSAInterface *)(this->GetInterface()))->m_colour3; *color4 = ((CVehicleSAInterface *)(this->GetInterface()))->m_colour4; } // works with firetrucks & tanks void CVehicleSA::GetTurretRotation ( float * fHorizontal, float * fVertical ) { DEBUG_TRACE("void * CVehicleSA::GetTurretRotation ( float * fHorizontal, float * fVertical )"); // This is coded in asm because for some reason it was failing to compile // correctly with normal c++. DWORD vehicleInterface = (DWORD)this->GetInterface(); float fHoriz = 0.0f; float fVert = 0.0f; _asm { mov eax, vehicleInterface add eax, 0x94C fld [eax] fstp fHoriz add eax, 4 fld [eax] fstp fVert } *fHorizontal = fHoriz; *fVertical = fVert; } void CVehicleSA::SetTurretRotation ( float fHorizontal, float fVertical ) { DEBUG_TRACE("void * CVehicleSA::SetTurretRotation ( float fHorizontal, float fVertical )"); //*(float *)(this->GetInterface() + 2380) = fHorizontal; //*(float *)(this->GetInterface() + 2384) = fVertical; DWORD vehicleInterface = (DWORD)this->GetInterface(); _asm { mov eax, vehicleInterface add eax, 0x94C fld fHorizontal fstp [eax] add eax, 4 fld fVertical fstp [eax] } } bool CVehicleSA::IsSirenOrAlarmActive ( ) { return ((CVehicleSAInterface *)this->GetInterface())->m_nVehicleFlags.bSirenOrAlarm; } void CVehicleSA::SetSirenOrAlarmActive ( bool bActive ) { ((CVehicleSAInterface *)this->GetInterface())->m_nVehicleFlags.bSirenOrAlarm = bActive; } DWORD * CVehicleSA::GetMemoryValue ( DWORD dwOffset ) { if ( dwOffset <= SIZEOF_CHELI ) return (DWORD *)((DWORD)(this->GetInterface()) + dwOffset); else return NULL; } /* bool CVehicleSA::isInRect(FLOAT fX1, FLOAT fY1, FLOAT fX2, FLOAT fY2, bool bShowHotspot) { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_IN_RECT_STILL,&this->internalID,&fX1,&fY1,&fX2,&fY2,&bShowHotspot); } //----------------------------------------------------------- bool CVehicleSA::isInCube(CVector * v3dCorner1, CVector * v3dCorner2, bool bShowHotspot) { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_IN_CUBE_STILL,&this->internalID,*v3dCorner1,*v3dCorner2,&bShowHotspot); } //----------------------------------------------------------- bool CVehicleSA::isNearPoint(FLOAT fX, FLOAT fY, FLOAT fRadiusX, FLOAT fRadiusY, bool bShowHotspot, bool bStill) { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_NEAR_POINT,&this->internalID,&fX,&fY,&fRadiusX,&fRadiusY,&bShowHotspot,&bStill); } //----------------------------------------------------------- bool CVehicleSA::isNearPoint3D(FLOAT fX, FLOAT fY, FLOAT fZ, FLOAT fRadiusX, FLOAT fRadiusY, FLOAT fRadiusZ, bool bShowHotspot, bool bStill) { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_NEAR_POINT_3D,&this->internalID,&fX,&fY,&fZ,&fRadiusX,&fRadiusY,&fRadiusZ,&bShowHotspot,&bStill); } //----------------------------------------------------------- bool CVehicleSA::isStopped() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_STOPPED,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isWrecked() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_WRECKED,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isOnLand() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_ON_LAND,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isCrushed() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_CRUSHED,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isOnRoof() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_FLIPPED,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isAirbourne() { return (bool)CallScriptFunction(GTAVC_SCM_IS_AIRBORNE,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isUpsidedown() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_UPSIDEDOWN,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isStuck() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_STUCK,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isSunk() { return (bool)CallScriptFunction(GTAVC_SCM_HAS_CAR_SUNK,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isBoundingSphereVisible() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_BOUNDING_SPHERE_VISIBLE,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isDamaged() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_DAMAGED,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isBombActive() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_BOMB_STATUS,&this->internalID); } //----------------------------------------------------------- bool CVehicleSA::isPassengerSeatFree() { return (bool)CallScriptFunction(GTAVC_SCM_IS_CAR_PASSENGER_SEAT_FREE,&this->internalID); } //----------------------------------------------------------- DWORD CVehicleSA::passengerCount() { return ((CVehicleSAInterface *)this->GetInterface())->PassengerCount; } //----------------------------------------------------------- DWORD CVehicleSA::maxPassengers() { DWORD dwMaxPassengers = 0; CallScriptFunction(GTAVC_SCM_GET_CAR_MAX_PASSENGERS,&this->internalID, &dwMaxPassengers); return dwMaxPassengers; } //----------------------------------------------------------- void CVehicleSA::setDensity(DWORD dwDensity) { CallScriptFunction(GTAVC_SCM_SET_CAR_DENSITY,&this->internalID,&dwDensity); } //----------------------------------------------------------- void CVehicleSA::makeHeavy(bool bHeavy) { CallScriptFunction(GTAVC_SCM_MAKE_CAR_HEAVY,&this->internalID,&bHeavy); } */ //----------------------------------------------------------- /** * \todo Make a eDoorState enum */ /* void CVehicleSA::setDoorsStatus(DWORD dwStatus) { CallScriptFunction(GTAVC_SCM_SET_CAR_DOOR_STATUS,&this->internalID,&dwStatus); } //----------------------------------------------------------- void CVehicleSA::setTaxiLight(bool bOn) { CallScriptFunction(GTAVC_SCM_SET_CAR_TAXIAVAILABLE,&this->internalID,&bOn); } //----------------------------------------------------------- void CVehicleSA::setSpeed(FLOAT fSpeed) { CallScriptFunction(GTAVC_SCM_SET_CAR_SPEED,&this->internalID,&fSpeed); } //----------------------------------------------------------- FLOAT CVehicleSA::getSpeed() { FLOAT fReturn; CallScriptFunction(GTAVC_SCM_GET_CAR_SPEED,&this->internalID, &fReturn); return fReturn; } //----------------------------------------------------------- void CVehicleSA::setSpeedInstantly(FLOAT fSpeed) { CallScriptFunction(GTAVC_SCM_SET_CAR_SPEED_INSTANTLY,&this->internalID,&fSpeed); } //----------------------------------------------------------- void CVehicleSA::setImmunities(bool bBullet, bool bFire, bool bExplosion, bool bDamage, bool bUnknown) { CallScriptFunction(GTAVC_SCM_SET_CAR_IMMUNITIES,&this->internalID,&bBullet,&bFire,&bExplosion,&bDamage,&bUnknown); } */ //----------------------------------------------------------- FLOAT CVehicleSA::GetHealth() { CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); return vehicle->m_nHealth; } //----------------------------------------------------------- void CVehicleSA::SetHealth( FLOAT fHealth ) { CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); vehicle->m_nHealth = fHealth; if ( fHealth >= 250.0f ) vehicle->m_fBurningTime = 0.0f; } // SHould be plane funcs void CVehicleSA::SetLandingGearDown ( bool bLandingGearDown ) { // This is the C code corresponding to the gta_sa // asm code at address 0x6CB39A. CVehicleSAInterface* pInterface = this->GetVehicleInterface (); DWORD dwThis = (DWORD)pInterface; float& fPosition = *(float *)( dwThis + 0x9CC ); float& fTimeStep = *(float *)( 0xB7CB5C ); float& flt_871904 = *(float *)( 0x871904 ); if ( IsLandingGearDown () != bLandingGearDown ) { // The following code toggles the landing gear direction if ( fPosition == 0.0f ) { *(DWORD *)(dwThis + 0x5A5) = 0x02020202; fPosition += ( fTimeStep * flt_871904 ); } else { if ( fPosition != 1.0f ) fPosition *= -1.0f; else fPosition = ( fTimeStep * flt_871904 ) - 1.0f; } } } float CVehicleSA::GetLandingGearPosition ( ) { DWORD dwThis = (DWORD)this->GetInterface(); return *(float *)(dwThis + 2508); } void CVehicleSA::SetLandingGearPosition ( float fPosition ) { DWORD dwThis = (DWORD)this->GetInterface(); *(float *)(dwThis + 2508) = fPosition; } bool CVehicleSA::IsLandingGearDown ( ) { DWORD dwThis = (DWORD)this->GetInterface(); if ( *(float *)(dwThis + 2508) <= 0.0f ) return true; else return false; } void CVehicleSA::Fix ( void ) { DEBUG_TRACE("void CVehicleSA::Fix ( void )"); DWORD dwThis = (DWORD) GetInterface(); DWORD dwFunc = 0; CModelInfo* pModelInfo = pGame->GetModelInfo ( this->GetModelIndex() ); if ( pModelInfo ) { if ( pModelInfo->IsCar() || pModelInfo->IsMonsterTruck() || pModelInfo->IsTrailer() ) dwFunc = FUNC_CAutomobile__Fix; else if ( pModelInfo->IsPlane() ) dwFunc = FUNC_CPlane__Fix; else if ( pModelInfo->IsHeli() ) dwFunc = FUNC_CHeli__Fix; else if ( pModelInfo->IsBike() ) dwFunc = FUNC_CBike_Fix; if ( dwFunc) { _asm { mov ecx, dwThis call dwFunc } } } } CDamageManager * CVehicleSA::GetDamageManager() { DEBUG_TRACE("CDamageManager * CVehicleSA::GetDamageManager()"); return this->damageManager; } void CVehicleSA::BlowUp ( CEntity* pCreator, unsigned long ulUnknown ) { CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(this->GetInterface()->vtbl); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = vehicleVTBL->BlowUpCar; DWORD dwCreator = (DWORD)pCreator; _asm { push ulUnknown push dwCreator mov ecx, dwThis call dwFunc } } void CVehicleSA::BlowUpCutSceneNoExtras ( unsigned long ulUnknown1, unsigned long ulUnknown2, unsigned long ulUnknown3, unsigned long ulUnknown4 ) { CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(this->GetInterface()->vtbl); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = vehicleVTBL->BlowUpCarCutSceneNoExtras; _asm { push ulUnknown1 push ulUnknown2 push ulUnknown3 push ulUnknown4 mov ecx, dwThis call dwFunc } } void CVehicleSA::FadeOut ( bool bFadeOut ) { CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); vehicle->bDistanceFade = bFadeOut; vehicle->m_nVehicleFlags.bFadeOut = bFadeOut; } bool CVehicleSA::IsFadingOut ( void ) { CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); return vehicle->m_nVehicleFlags.bFadeOut; } unsigned char CVehicleSA::GetNumberGettingIn ( void ) { return GetVehicleInterface ()->m_nNumGettingIn; } unsigned char CVehicleSA::GetPassengerCount ( void ) { return GetVehicleInterface ()->m_nNumPassengers; } unsigned char CVehicleSA::GetMaxPassengerCount ( void ) { return GetVehicleInterface ()->m_nMaxPassengers; } bool CVehicleSA::SetTowLink ( CVehicle* pVehicle ) { DEBUG_TRACE("bool CAutomobileSA::SetTowLink ( CVehicle* pVehicle )"); bool bReturn = false; CVehicleSA* pVehicleSA = dynamic_cast < CVehicleSA* > ( pVehicle ); if ( pVehicleSA ) { DWORD dwThis = (DWORD) GetInterface(); CVehicleSAInterface* pVehicleInt = pVehicleSA->GetVehicleInterface(); CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(this->GetInterface()->vtbl); DWORD dwFunc = vehicleVTBL->SetTowLink; _asm { mov ecx, dwThis push 1 push pVehicleInt call dwFunc mov bReturn, al } } return bReturn; } bool CVehicleSA::BreakTowLink ( void ) { DEBUG_TRACE("bool CVehicleSA::BreakTowLink ( void )"); DWORD dwThis = (DWORD) GetInterface(); CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(this->GetInterface()->vtbl); DWORD dwFunc = vehicleVTBL->BreakTowLink; bool bReturn = false; _asm { mov ecx, dwThis call dwFunc mov bReturn, al } return bReturn; } CVehicle * CVehicleSA::GetTowedVehicle ( void ) { DEBUG_TRACE("CVehicle * CVehicleSA::GetTowedVehicle ( void )"); CVehicleSAInterface * pTowedVehicle = (CVehicleSAInterface *)*(DWORD *)((DWORD)this->GetInterface() + 1224); if ( pTowedVehicle ) return pGame->GetPools()->GetVehicle ( (DWORD *)pTowedVehicle ); return NULL; } CVehicle * CVehicleSA::GetTowedByVehicle ( void ) { DEBUG_TRACE("CVehicle * CVehicleSA::GetTowedVehicle ( void )"); CVehicleSAInterface * pTowedVehicle = (CVehicleSAInterface *)*(DWORD *)((DWORD)this->GetInterface() + 1220); if ( pTowedVehicle ) return pGame->GetPools()->GetVehicle ( (DWORD *)pTowedVehicle ); return NULL; } void CVehicleSA::SetWinchType ( eWinchType winchType ) { if ( winchType < 4 && winchType != 2 ) { GetVehicleInterface ()->WinchType = winchType; } } void CVehicleSA::PickupEntityWithWinch ( CEntity* pEntity ) { CEntitySA* pEntitySA = dynamic_cast < CEntitySA* > ( pEntity ); if ( pEntitySA ) { DWORD dwFunc = FUNC_CVehicle_PickUpEntityWithWinch; DWORD dwThis = (DWORD) GetInterface(); DWORD dwEntityInterface = (DWORD) pEntitySA->GetInterface (); _asm { push dwEntityInterface mov ecx, dwThis call dwFunc } } } void CVehicleSA::ReleasePickedUpEntityWithWinch ( void ) { DWORD dwFunc = FUNC_CVehicle_ReleasePickedUpEntityWithWinch; DWORD dwThis = (DWORD) GetInterface(); _asm { mov ecx, dwThis call dwFunc } } void CVehicleSA::SetRopeHeightForHeli ( float fRopeHeight ) { DWORD dwFunc = FUNC_CVehicle_SetRopeHeightForHeli; DWORD dwThis = (DWORD) GetInterface(); _asm { push fRopeHeight mov ecx, dwThis call dwFunc } } CPhysical * CVehicleSA::QueryPickedUpEntityWithWinch ( ) { DWORD dwFunc = FUNC_CVehicle_QueryPickedUpEntityWithWinch; DWORD dwThis = (DWORD) GetInterface(); CPhysicalSAInterface * phys; CPhysical * physRet; _asm { mov ecx, dwThis call dwFunc mov phys, eax } if ( phys ) { CPoolsSA * pPools = ((CPoolsSA *)pGame->GetPools()); switch(phys->nType) { case ENTITY_TYPE_PED: physRet = (CPhysical *)pPools->GetPed((DWORD *)phys); break; case ENTITY_TYPE_VEHICLE: physRet = (CPhysical *)pGame->GetPools()->GetVehicle ( (DWORD *)phys ); break; case ENTITY_TYPE_OBJECT: physRet = (CPhysical *)pPools->GetObject( (DWORD *)phys ); break; default: physRet = NULL; } } return physRet; } void CVehicleSA::SetRemap ( int iRemap ) { DWORD dwFunc = FUNC_CVehicle__SetRemap; DWORD dwThis = (DWORD) GetInterface(); _asm { mov ecx, dwThis push iRemap call dwFunc } } int CVehicleSA::GetRemapIndex ( void ) { DWORD dwFunc = FUNC_CVehicle__GetRemapIndex; DWORD dwThis = (DWORD) GetInterface(); int iReturn = 0; _asm { mov ecx, dwThis call dwFunc mov iReturn, eax } return iReturn; } void CVehicleSA::SetRemapTexDictionary ( int iRemapTextureDictionary ) { DWORD dwFunc = FUNC_CVehicle__SetRemapTexDictionary; DWORD dwThis = (DWORD) GetInterface(); _asm { mov ecx, dwThis push iRemapTextureDictionary call dwFunc } } bool CVehicleSA::IsSmokeTrailEnabled ( void ) { return ( *(unsigned char*)((DWORD)this->GetInterface() + 2560) == 1 ); } void CVehicleSA::SetSmokeTrailEnabled ( bool bEnabled ) { *(unsigned char*)((DWORD)this->GetInterface() + 2560) = ( bEnabled ) ? 1 : 0; } CHandlingEntry* CVehicleSA::GetHandlingData ( void ) { return m_pHandlingData; } void CVehicleSA::SetHandlingData ( CHandlingEntry* pHandling ) { // Store the handling data we set for later retrival through Get m_pHandlingData = static_cast < CHandlingEntrySA* > ( pHandling ); // Put it in our interface CVehicleSAInterface* pInt = GetVehicleInterface(); m_pHandlingData->Recalculate(); pInt->pHandlingData = m_pHandlingData->GetInterface (); /*pInt->dwHandlingFlags = m_pHandlingData->GetInterface ()->uiHandlingFlags; pInt->fMass = m_pHandlingData->GetInterface ()->fMass; pInt->fTurnMass = m_pHandlingData->GetInterface ()->fTurnMass;// * pGame->GetHandlingManager()->GetTurnMassMultiplier(); pInt->vecCenterOfMass = &m_pHandlingData->GetInterface()->vecCenterOfMass; pInt->fBuoyancyConstant = m_pHandlingData->GetInterface()->fUnknown2;*/ /*if (m_pHandlingData->GetInterface()->fDragCoeff >= pGame->GetHandlingManager()->GetBasicDragCoeff()) GetVehicleInterface ()->fDragCoeff = pGame->GetHandlingManager()->GetBasicDragCoeff(); else*/ //pInt->fDragCoeff = m_pHandlingData->GetInterface()->fDragCoeff / 1000 * pGame->GetHandlingManager()->GetDragMultiplier(); } // Updates internal vehicle settings void CVehicleSA::UpdateHandlingStatus ( void ) { // Not supposed to happen if (!m_pHandlingData) return; // Put it in our interface CVehicleSAInterface* pInt = GetVehicleInterface(); pInt->dwHandlingFlags = m_pHandlingData->GetInterface ()->uiHandlingFlags; pInt->fMass = m_pHandlingData->GetInterface ()->fMass; pInt->fTurnMass = m_pHandlingData->GetInterface ()->fTurnMass;// * pGame->GetHandlingManager()->GetTurnMassMultiplier(); pInt->vecCenterOfMass = &m_pHandlingData->GetInterface()->vecCenterOfMass; pInt->fBuoyancyConstant = m_pHandlingData->GetInterface()->fUnknown2; /*if (m_pHandlingData->GetInterface()->fDragCoeff >= pGame->GetHandlingManager()->GetBasicDragCoeff()) GetVehicleInterface ()->fDragCoeff = pGame->GetHandlingManager()->GetBasicDragCoeff(); else*/ //pInt->fDragCoeff = m_pHandlingData->GetInterface()->fDragCoeff / 1000 * pGame->GetHandlingManager()->GetDragMultiplier(); } void CVehicleSA::BurstTyre ( BYTE bTyre ) { CVehicleSAInterfaceVTBL * vehicleVTBL = (CVehicleSAInterfaceVTBL *)(m_pInterface->vtbl); DWORD dwThis = (DWORD) m_pInterface; DWORD dwFunc = vehicleVTBL->BurstTyre; _asm { mov ecx, dwThis push 1 // not used push bTyre call dwFunc } } BYTE CVehicleSA::GetBikeWheelStatus ( BYTE bWheel ) { if ( bWheel == 0 ) return * ( BYTE * ) ( (DWORD)this->GetInterface() + 0x65C ); if ( bWheel == 1 ) return * ( BYTE * ) ( (DWORD)this->GetInterface() + 0x65D ); return 0; } void CVehicleSA::SetBikeWheelStatus ( BYTE bWheel, BYTE bStatus ) { if ( bWheel == 0 ) * ( BYTE * ) ( (DWORD)this->GetInterface() + 0x65C ) = bStatus; else if ( bWheel == 1 ) * ( BYTE * ) ( (DWORD)this->GetInterface() + 0x65D ) = bStatus; } void CVehicleSA::SetTaxiLightOn ( bool bLightOn ) { DEBUG_TRACE("void CVehicleSA::SetTaxiLight ( bool bLightOn )"); DWORD dwThis = (DWORD) GetInterface(); DWORD dwState = (DWORD) bLightOn; DWORD dwFunc = FUNC_CAutomobile_SetTaxiLight; _asm { mov ecx, dwThis push dwState call dwFunc } } void GetMatrixForGravity ( const CVector& vecGravity, CMatrix& mat ) { // Calculates a basis where the z axis is the inverse of the gravity if ( vecGravity.Length () > 0.0001f ) { mat.vUp = -vecGravity; mat.vUp.Normalize (); if ( fabs(mat.vUp.fX) > 0.0001f || fabs(mat.vUp.fZ) > 0.0001f ) { CVector y ( 0.0f, 1.0f, 0.0f ); mat.vFront = vecGravity; mat.vFront.CrossProduct ( &y ); mat.vFront.CrossProduct ( &vecGravity ); mat.vFront.Normalize (); } else { mat.vFront = CVector ( 0.0f, 0.0f, vecGravity.fY ); } mat.vRight = mat.vFront; mat.vRight.CrossProduct ( &mat.vUp ); } else { // No gravity, use default axes mat.vRight = CVector ( 1.0f, 0.0f, 0.0f ); mat.vFront = CVector ( 0.0f, 1.0f, 0.0f ); mat.vUp = CVector ( 0.0f, 0.0f, 1.0f ); } } void CVehicleSA::SetGravity ( const CVector* pvecGravity ) { if ( pGame->GetPools ()->GetPedFromRef ( 1 )->GetVehicle () == this ) { // If this is the local player's vehicle, adjust the camera's position history. // This is to keep the automatic camera settling (which happens when driving while not moving the mouse) // nice and consistent while the gravity changes. CCam* pCam = pGame->GetCamera ()->GetCam ( pGame->GetCamera ()->GetActiveCam () ); CMatrix matOld, matNew; GetMatrixForGravity ( m_vecGravity, matOld ); GetMatrixForGravity ( *pvecGravity, matNew ); CVector* pvecPosition = &m_pInterface->Placeable.matrix->vPos; matOld.Invert (); pCam->GetTargetHistoryPos () [ 0 ] = matOld * (pCam->GetTargetHistoryPos () [ 0 ] - *pvecPosition); pCam->GetTargetHistoryPos () [ 0 ] = matNew * pCam->GetTargetHistoryPos () [ 0 ] + *pvecPosition; pCam->GetTargetHistoryPos () [ 1 ] = matOld * (pCam->GetTargetHistoryPos () [ 1 ] - *pvecPosition); pCam->GetTargetHistoryPos () [ 1 ] = matNew * pCam->GetTargetHistoryPos () [ 1 ] + *pvecPosition; } m_vecGravity = *pvecGravity; } CObject * CVehicleSA::SpawnFlyingComponent ( int i_1, unsigned int ui_2 ) { DWORD dwReturn; DWORD dwThis = ( DWORD ) GetInterface (); DWORD dwFunc = FUNC_CAutomobile__SpawnFlyingComponent; _asm { mov ecx, dwThis push ui_2 push i_1 call dwFunc mov dwReturn, eax } CObject * pObject = NULL; if ( dwReturn ) pObject = pGame->GetPools ()->GetObject ( ( DWORD * ) dwReturn ); return pObject; } typedef RwFrame * (__cdecl *RwFrameForAllObjects_t) (RwFrame * frame, void * callback, void * data); extern RwFrameForAllObjects_t RwFrameForAllObjects; void CVehicleSA::SetWheelVisibility ( eWheels wheel, bool bVisible ) { CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); RwFrame * pFrame = NULL; switch ( wheel ) { case FRONT_LEFT_WHEEL: pFrame = vehicle->pWheelFrontLeft; break; case REAR_LEFT_WHEEL: pFrame = vehicle->pWheelRearLeft; break; case FRONT_RIGHT_WHEEL: pFrame = vehicle->pWheelFrontRight; break; case REAR_RIGHT_WHEEL: pFrame = vehicle->pWheelRearRight; break; default: break; } if ( pFrame ) { DWORD dw_GetCurrentAtomicObjectCB = 0x6a0750; RwObject * pObject = NULL; // Stop GetCurrentAtomicObjectCB from returning null for 'invisible' objects * ( BYTE * ) ( 0x6A0758 ) = 0x90; * ( BYTE * ) ( 0x6A0759 ) = 0x90; RwFrameForAllObjects ( pFrame, ( void * ) dw_GetCurrentAtomicObjectCB, &pObject ); * ( BYTE * ) ( 0x6A0758 ) = 0x74; * ( BYTE * ) ( 0x6A0759 ) = 0x06; if ( pObject ) pObject->flags = ( bVisible ) ? 4 : 0; } } bool CVehicleSA::IsHeliSearchLightVisible ( void ) { // See CHeli::PreRender DWORD dwThis = ( DWORD ) GetInterface (); return * ( bool * ) ( dwThis + 2577 ); } void CVehicleSA::SetHeliSearchLightVisible ( bool bVisible ) { // See CHeli::PreRender DWORD dwThis = ( DWORD ) GetInterface (); * ( bool * ) ( dwThis + 2577 ) = bVisible; } CColModel * CVehicleSA::GetSpecialColModel ( void ) { CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); if ( vehicle->m_nSpecialColModel != 0xFF ) { CColModelSAInterface * pSpecialColModels = ( CColModelSAInterface * ) VAR_CVehicle_SpecialColModels; CColModelSAInterface * pColModelInterface = &pSpecialColModels [ vehicle->m_nSpecialColModel ]; if ( pColModelInterface ) { CColModel * pColModel = new CColModelSA ( pColModelInterface ); return pColModel; } } return NULL; } bool CVehicleSA::UpdateMovingCollision ( float fAngle ) { // If we dont have a driver, use the local player for this function // It will check a few key-states which shouldn't make any difference as we've specified an angle. CVehicleSAInterface * vehicle = (CVehicleSAInterface *)this->GetInterface(); CPedSAInterface * pDriver = vehicle->pDriver; if ( !pDriver ) { CPed * pLocalPed = pGame->GetPools ()->GetPedFromRef ( 1 ); if ( pLocalPed ) vehicle->pDriver = ( CPedSAInterface * ) pLocalPed->GetInterface (); } bool bReturn; DWORD dwThis = ( DWORD ) GetInterface (); DWORD dwFunc = FUNC_CAutomobile__UpdateMovingCollision; _asm { mov ecx, dwThis push fAngle call dwFunc mov bReturn, al } // Restore our driver vehicle->pDriver = pDriver; return bReturn; }
Pumpuli/multitheftauto
MTA10/game_sa/CVehicleSA.cpp
C++
gpl-3.0
52,564
package at.fh.swengb.resifoAndroid.activities.meldezettelEdit import java.util.Calendar import android.app.{DatePickerDialog, Dialog} import android.content.{DialogInterface, Intent} import android.graphics.{Color, PorterDuff} import android.os.Bundle import android.support.v7.app.{AlertDialog, AppCompatActivity} import android.view.View import android.view.View.OnClickListener import android.widget._ import at.fh.swengb.resifoAndroid.R import at.fh.swengb.resifoAndroid.activities.help.HelpActivity import at.fh.swengb.resifoAndroid.db.DBHelper /** * Created by laszlobalo on 02.01.17. */ class Meldezettel02a extends AppCompatActivity { val db = new DBHelper(this) val datePicker: DatePicker = null var calendar: Calendar = null var dateView: TextView = null var year: Int = 0 var month: Int = 0 var day: Int = 0 var currentDate: String = "" override protected def onCreate(savedInstanceState: Bundle) { super.onCreate(savedInstanceState) setContentView(R.layout.meldezettel02a) dateView = findViewById(R.id.textView3).asInstanceOf[TextView] calendar = Calendar.getInstance year = calendar.get(Calendar.YEAR) month = calendar.get(Calendar.MONTH) day = calendar.get(Calendar.DAY_OF_MONTH) showDate(year, month + 1, day) currentDate = "" val nextButton: ImageView = findViewById(R.id.nxtButton).asInstanceOf[ImageView] val helpButton: Button = findViewById(R.id.buttonHilfe).asInstanceOf[Button] val importantB2: EditText = findViewById(R.id.editText4).asInstanceOf[EditText] val importantB1: EditText = findViewById(R.id.editText5).asInstanceOf[EditText] val importantB3: EditText = findViewById(R.id.editText6).asInstanceOf[EditText] val importantB4: EditText = findViewById(R.id.editText8).asInstanceOf[EditText] val activity1Button: Button = findViewById(R.id.button1).asInstanceOf[Button] val activity2Button: Button = findViewById(R.id.button2).asInstanceOf[Button] val activity3Button: Button = findViewById(R.id.button3).asInstanceOf[Button] val activity4Button: Button = findViewById(R.id.button4).asInstanceOf[Button] val activity5Button: Button = findViewById(R.id.button5).asInstanceOf[Button] val activity6Button: Button = findViewById(R.id.button6).asInstanceOf[Button] val activity7Button: Button = findViewById(R.id.button7).asInstanceOf[Button] val activity8Button: Button = findViewById(R.id.button98).asInstanceOf[Button] importantB1.getBackground.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN) importantB2.getBackground.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN) importantB3.getBackground.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN) importantB4.getBackground.setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN) def timeChanged: Boolean = { if (currentDate == "") { Toast.makeText(getApplicationContext, "Sie haben das Datum noch nicht geändert!", Toast.LENGTH_SHORT).show() false } else true } def importantFill: Boolean = { if ((importantB1.getText.toString.trim == "" || importantB2.getText.toString.trim == "") || (importantB3.getText.toString.trim == "" || importantB4.getText.toString.trim == "")) { Toast.makeText(getApplicationContext, "Pflichtpfeld ausfüllen!", Toast .LENGTH_SHORT).show() false } else true } activity1Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Wenn Sie die Seite verlassen werden die Daten der aktuellen Seite nicht gespeichert. Möchten Sie fortfahren?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[HelpActivity]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) activity2Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Möchten Sie keinen anderen Staat angeben?") .setNegativeButton("Doch", null) .setPositiveButton("Nein, möchte ich nicht!", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[HelpActivity]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) activity3Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Wenn Sie die Seite verlassen werden die Daten der aktuellen Seite nicht gespeichert. Möchten Sie fortfahren?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[Meldezettel03]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) activity4Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Wenn Sie die Seite verlassen werden die Daten der aktuellen Seite nicht gespeichert. Möchten Sie fortfahren?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[Meldezettel04]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) activity5Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Wenn Sie die Seite verlassen werden die Daten der aktuellen Seite nicht gespeichert. Möchten Sie fortfahren?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[Meldezettel05]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) activity6Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a .this) .setMessage("Wenn Sie die Seite verlassen werden die Daten der aktuellen Seite nicht gespeichert. Möchten Sie fortfahren?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[Meldezettel06]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) activity7Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Wenn Sie die Seite verlassen werden die Daten der aktuellen Seite nicht gespeichert. Möchten Sie fortfahren?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { startActivity(new Intent(getApplicationContext, classOf[Meldezettel07])) } }) .show() } }) activity8Button.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { startActivity(new Intent(Meldezettel02a.this, classOf[Meldezettel08])) } }) helpButton.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { new AlertDialog.Builder(Meldezettel02a.this) .setMessage("Benötigen Sie Hilfe?") .setNegativeButton("Nein", null) .setPositiveButton("Ja", new android.content.DialogInterface.OnClickListener() { override def onClick(dialog: DialogInterface, which: Int): Unit = { val intent: Intent = new Intent(Meldezettel02a.this, classOf[HelpActivity]) intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) startActivity(intent) dialog.dismiss() } }) .show() } }) nextButton.setOnClickListener(new OnClickListener { def onClick(v: View): Unit = { if (importantFill && timeChanged) { db.updatePage2a(importantB2.getText.toString, importantB1.getText.toString, importantB3.getText.toString, dateView.getText.toString, importantB4.getText.toString,"1") startActivity(new Intent(getApplicationContext, classOf[Meldezettel03]).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)) } } }) } override def onBackPressed() { startActivity(new Intent(Meldezettel02a.this, classOf[Meldezettel02]).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)) } @SuppressWarnings(Array("deprecation")) def setDate(view: View) { new DatePickerDialog(this, myDateListener, year, month, day).show() Toast.makeText(getApplicationContext, "Datum wählen", Toast.LENGTH_SHORT).show } private val myDateListener: DatePickerDialog.OnDateSetListener = new DatePickerDialog.OnDateSetListener() { def onDateSet(arg0: DatePicker, arg1: Int, arg2: Int, arg3: Int) { val newarg2 = arg2 + 1 currentDate = s"$arg1/$newarg2/$arg3" showDate(arg1, arg2 + 1, arg3) } } private def showDate(year: Int, month: Int, day: Int) { dateView.setText(s"$day/$month/$year") } }
Gulasch4ever/resifo-android
app/src/main/scala/at/fh/swengb/resifoAndroid/activities/meldezettelEdit/Meldezettel02a.scala
Scala
gpl-3.0
10,885
--[[ * ReaScript Name: MIDI Overlap Selected Notes * Written: 29/05/2017 * Last Updated: 20/06/2017 * Author: David Healey. --]] reaper.Undo_BeginBlock(); for i = 0, reaper.CountMediaItems(0), 1 do --Each media item local item = reaper.GetMediaItem(0, i) --Get item if reaper.ValidatePtr2(0, item, "MediaItem*") then --Double check that we got a valid item local take = reaper.GetActiveTake(item) --Get item's active take if reaper.ValidatePtr2(0, take, "MediaItem_Take*") and reaper.TakeIsMIDI(take) then --Active take contains MIDI data retval, notes, ccs, sysex = reaper.MIDI_CountEvts(take) --Count events for n = 0, notes, 1 do --Each note event retval, n_selected, n_muted, n_ppq, n_endppq, n_chan, pitch, vel = reaper.MIDI_GetNote(take, n); --Get note data if n_selected == true then --If the note is selected nextNote = reaper.MIDI_EnumSelNotes(take, n); --Get the next selected note if nextNote ~= -1 then --If there is a next selected note retval, b_selected, b_muted, b_ppq, b_endppq, b_chan, b_pitch, b_vel = reaper.MIDI_GetNote(take, nextNote); --Get its note data len = n_endppq - n_ppq; --Take start away from end to get length len = b_ppq + (len * 0.03); --Extend length up to next note + 3% reaper.MIDI_SetNote(take, n, NULL, NULL, NULL, len, NULL, NULL, NULL, true); --Extend note length end end end reaper.MIDI_Sort(take) end end end reaper.Undo_EndBlock("MIDI Overlap Selected Notes",-1); reaper.UpdateArrange();
davidhealey/reascript
luaScripts/Misc/MIDI Overlap Selected Notes.lua
Lua
gpl-3.0
1,533
#!/bin/bash ACV="1.19" ARC=".tar.bz2" APN="Tar" export ACV ARC APN ACB=$APN-$ACV export ACB # # Tar-1.19 # ########################################## cd $LSB $TC $LSR/$ACB$ARC cd $ACB ./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin make make install
buswellj/code
linux-os-build-old/p3-scripts/scripts/Tar-1.19_p3.sh
Shell
gpl-3.0
268
/* Collisions - a real-time simulation program of colliding particles. Copyright (C) 2011 - 2015 G. Endignoux This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/gpl-3.0.txt */ #ifndef PISTON_HPP #define PISTON_HPP #include "mobile.hpp" #include "config_piston.hpp" // Mobile décrivant un piston horizontal. class Piston : public Mobile { friend class Boule; public: // Constructeur. Piston(ConfigPiston config, State& state); // Accesseurs. inline double epaisseur() const; // Calcule l'instant de la prochaine collision avec le mobile. Time collision(const Mobile* mobile) const; Time collision(const Boule* boule) const; Time collision(const Piston* piston) const; // Calcule l'instant du prochain changement de zone. Time newArea(double sizeArea, const Coord<double>& gravity) const; // Effectue la collision avec le mobile. void doCollision(Mobile* mobile, State& state); void doCollision(Boule* boule, State& state); void doCollision(Piston* piston, State& state); void changeArea(State& state); private: // Cherche des collisions avec des mobiles. void updateCollisionsMobiles(State& state); // Propriétés géométriques. double mEpaisseur; int mArea1; int mArea2; QList<Piston*>::iterator mMapIt1; QList<Piston*>::iterator mMapIt2; }; // Accesseurs. inline double Piston::epaisseur() const {return mEpaisseur;} #endif // PISTON_HPP
gendx/collisions
src/simul/piston.hpp
C++
gpl-3.0
2,060
import pigpio import time class LeftEncoder: def __init__(self, pin=24): self.pi = pigpio.pi() self.pin = pin self.pi.set_mode(pin, pigpio.INPUT) self.pi.set_pull_up_down(pin, pigpio.PUD_UP) cb1 = self.pi.callback(pin, pigpio.EITHER_EDGE, self.cbf) self.tick = 0 def cbf(self, gpio, level, tick): # print(gpio, level, tick) print(self.tick) self.tick += 1 e = LeftEncoder() while True: time.sleep(.01)
MrYsLab/razmq
hardware_baseline/encoders/left_encoder.py
Python
gpl-3.0
491
#http://informatics.mccme.ru/mod/statements/view3.php?id=22783&chapterid=113362#1 n = int(input()) def sum_kv_cifr(x): su = 0 for i in str(x): su += int(i)*int(i) return su maxi_power = 0 for i in range(1, n//2+1): print('______',i) for k in range(n//i, 0, -1): power = sum_kv_cifr(i * k) print('_', k, power) if power > maxi_power: maxi_power = power print(maxi_power)
dichenko/kpk2016
Diff/dra.py
Python
gpl-3.0
442
/* * Minecraft Forge * Copyright (c) 2016. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.minecraftforge.fml.client.config; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraft.util.text.TextFormatting; import static net.minecraftforge.fml.client.config.GuiUtils.RESET_CHAR; import static net.minecraftforge.fml.client.config.GuiUtils.UNDO_CHAR; import net.minecraftforge.fml.common.FMLLog; import org.lwjgl.input.Keyboard; /** * This class is the base screen used for editing an array-type property. It provides a list of array entries for the user to edit. * This screen is invoked from a GuiConfig screen by controls that use the EditListPropEntry IGuiConfigListEntry object. * * @author bspkrs */ public class GuiEditArray extends GuiScreen { protected GuiScreen parentScreen; protected IConfigElement configElement; protected GuiEditArrayEntries entryList; protected GuiButtonExt btnUndoChanges, btnDefault, btnDone; protected String title; protected String titleLine2; protected String titleLine3; protected int slotIndex; protected final Object[] beforeValues; protected Object[] currentValues; protected HoverChecker tooltipHoverChecker; protected List<String> toolTip; protected boolean enabled; public GuiEditArray(GuiScreen parentScreen, IConfigElement configElement, int slotIndex, Object[] currentValues, boolean enabled) { this.mc = Minecraft.getMinecraft(); this.parentScreen = parentScreen; this.configElement = configElement; this.slotIndex = slotIndex; this.beforeValues = currentValues; this.currentValues = currentValues; this.toolTip = new ArrayList<String>(); this.enabled = enabled; String propName = I18n.format(configElement.getLanguageKey()); String comment; comment = I18n.format(configElement.getLanguageKey() + ".tooltip", "\n" + TextFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + comment).split("\n")); else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.YELLOW + configElement.getComment()).split("\n")); else Collections.addAll(toolTip, (TextFormatting.GREEN + propName + "\n" + TextFormatting.RED + "No tooltip defined.").split("\n")); if (parentScreen instanceof GuiConfig) { this.title = ((GuiConfig) parentScreen).title; if (((GuiConfig) parentScreen).titleLine2 != null) { this.titleLine2 = ((GuiConfig) parentScreen).titleLine2; this.titleLine3 = I18n.format(configElement.getLanguageKey()); } else this.titleLine2 = I18n.format(configElement.getLanguageKey()); this.tooltipHoverChecker = new HoverChecker(28, 37, 0, parentScreen.width, 800); } else { this.title = I18n.format(configElement.getLanguageKey()); this.tooltipHoverChecker = new HoverChecker(8, 17, 0, parentScreen.width, 800); } } /** * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the * window resizes, the buttonList is cleared beforehand. */ @Override public void initGui() { this.entryList = createEditArrayEntries(); int undoGlyphWidth = mc.fontRenderer.getStringWidth(UNDO_CHAR) * 2; int resetGlyphWidth = mc.fontRenderer.getStringWidth(RESET_CHAR) * 2; int doneWidth = Math.max(mc.fontRenderer.getStringWidth(I18n.format("gui.done")) + 20, 100); int undoWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20; int resetWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20; int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth) / 2; this.buttonList.add(btnDone = new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done"))); this.buttonList.add(btnDefault = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5, this.height - 29, resetWidth, 20, " " + I18n.format("fml.configgui.tooltip.resetToDefault"), RESET_CHAR, 2.0F)); this.buttonList.add(btnUndoChanges = new GuiUnicodeGlyphButton(2002, this.width / 2 - buttonWidthHalf + doneWidth + 5, this.height - 29, undoWidth, 20, " " + I18n.format("fml.configgui.tooltip.undoChanges"), UNDO_CHAR, 2.0F)); } /** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */ @Override protected void actionPerformed(GuiButton button) { if (button.id == 2000) { try { this.entryList.saveListChanges(); } catch (Throwable e) { FMLLog.log.error("Error performing GuiEditArray action:", e); } this.mc.displayGuiScreen(this.parentScreen); } else if (button.id == 2001) { this.currentValues = configElement.getDefaults(); this.entryList = createEditArrayEntries(); } else if (button.id == 2002) { this.currentValues = Arrays.copyOf(beforeValues, beforeValues.length); this.entryList = createEditArrayEntries(); } } protected GuiEditArrayEntries createEditArrayEntries() { return new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues); } /** * Handles mouse input. */ @Override public void handleMouseInput() throws IOException { super.handleMouseInput(); this.entryList.handleMouseInput(); } /** * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton */ @Override protected void mouseClicked(int x, int y, int mouseEvent) throws IOException { if (mouseEvent != 0 || !this.entryList.mouseClicked(x, y, mouseEvent)) { this.entryList.mouseClickedPassThru(x, y, mouseEvent); super.mouseClicked(x, y, mouseEvent); } } /** * Called when a mouse button is released. */ @Override protected void mouseReleased(int x, int y, int mouseEvent) { if (mouseEvent != 0 || !this.entryList.mouseReleased(x, y, mouseEvent)) { super.mouseReleased(x, y, mouseEvent); } } /** * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) */ @Override protected void keyTyped(char eventChar, int eventKey) { if (eventKey == Keyboard.KEY_ESCAPE) this.mc.displayGuiScreen(parentScreen); else this.entryList.keyTyped(eventChar, eventKey); } /** * Called from the main game loop to update the screen. */ @Override public void updateScreen() { super.updateScreen(); this.entryList.updateScreen(); } /** * Draws the screen and all the components in it. */ @Override public void drawScreen(int par1, int par2, float par3) { this.drawDefaultBackground(); this.entryList.drawScreen(par1, par2, par3); this.drawCenteredString(this.fontRenderer, this.title, this.width / 2, 8, 16777215); if (this.titleLine2 != null) this.drawCenteredString(this.fontRenderer, this.titleLine2, this.width / 2, 18, 16777215); if (this.titleLine3 != null) this.drawCenteredString(this.fontRenderer, this.titleLine3, this.width / 2, 28, 16777215); this.btnDone.enabled = this.entryList.isListSavable(); this.btnDefault.enabled = enabled && !this.entryList.isDefault(); this.btnUndoChanges.enabled = enabled && this.entryList.isChanged(); super.drawScreen(par1, par2, par3); this.entryList.drawScreenPost(par1, par2, par3); if (this.tooltipHoverChecker != null && this.tooltipHoverChecker.checkHover(par1, par2)) drawToolTip(this.toolTip, par1, par2); } public void drawToolTip(List<String> stringList, int x, int y) { GuiUtils.drawHoveringText(stringList, x, y, width, height, 300, fontRenderer); } }
Severed-Infinity/technium
build/tmp/recompileMc/sources/net/minecraftforge/fml/client/config/GuiEditArray.java
Java
gpl-3.0
9,879
##Spring 2016 Workshops All workshops take place from 11:00 a.m. to 12:00 p.m. in 418a of the Central Library. ###Text Mining with the R tm Package ####Friday, January 8 *Cliff Anderson* * This workshops teaches the basics of text mining or the large-scale analysis of textual corpora. If you have interest in finding and visualizing patterns in textual corpora, this workshop will help you get started. In particlar, we'll show you how to use the [tm: Text Mining Package](https://cran.r-project.org/web/packages/tm/index.html) in R. Participants will have the opportunity to develop a corpus, conduct common transformations on words, and to create and visualize term document matrixes. ###Annotating the Web with Genius and Hypothes.is ####Friday, January 15 *Ed Warga* * A web annotation is an online annotation associated with a web resource. With a Web annotation system, a user can add, modify or remove information from a Web resource without modifying the resource itself. The annotations can be thought of as a layer on top of the existing resource, and this annotation layer is usually visible to other users who share the same annotation system. In such cases, the web annotation tool is a type of social software tool ([Wikipedia](https://en.wikipedia.org/wiki/Web_annotation)). We will explore the concept of web annotation and discuss its use in digital research. We will try out a few different tools for web annotation and evaluate their usefulness for inclusion in participants' research workflows. ###GitHub as an Educational Technology ####Friday, January 22 *Ramona Romero* *this workshop was rescheduled. New date: March 4 * Among other things, [GitHub](https://github.com/) is a social network for computer programmers. But GitHub is also a fantastic educational technology. In this session, we'll introduce you to git, the distributed version control system that powers GitHub. We'll show you how to set up an account with GitHub and collaborate with others on projects. You will learn the basics of Markdown, the simple markup language used to communicate on GitHub. We'll talk about the uses of GitHub in the classroom, the sciences, and the digital humanities. If you're brave, we'll even get into advance topics like branching and forking. By the end of the session, you'll be ready to create repositories and collaborate with scholars around the interwebs. ###Data Publication with Figshare ####Friday, January 29 *Morgan Daniels* * The datasets underlying research findings are increasingly acknowledged as valuable scholarly products. Through data publication, researchers can give more visibility to their work while making data available to others for reuse. This workshop will address data publication from the researcher's perspective, including benefits to researchers and best practices for sharing datasets. Participants will learn how to submit a dataset to Figshare, a versatile online tool for data publication. ###Minecraft as an Educational Technology ####Friday, February 5 *Cliff Anderson & Lindsey Fox* * [Minecraft](https://minecraft.net/) is among the most popular video games ever. Minecraft is deceptively simple to play, but offers an enormously malleable game environment. In this session, we'll show you how to write Minecraft *mods* (or modifications) using open source toolkits. Beyond teaching you how to write simple mods to alter the Minecraft game environment, we'll talk about potential uses for Minecraft as an educational technology. ###Cleaning Up Your Data with OpenRefine ####Friday, February 12 *Morgan Daniels* * Cleaning and preserving a dataset makes it more available for long-term use and sharing with interested colleagues (and can help you meet funding agency requirements for data management!) In this session, we'll explore the tool OpenRefine and use it to work with a sample dataset. We'll also talk about simple ways to preserve your research data. ###Building Digital Collections with Omeka ####Friday, February 19 *Carla Beals and Ed Warga* * Participants will learn how to build digital exhibits using the [Omeka](http://omeka.org/) content management system. Omeka can be used for a variety of projects including digital archives, exhibits, and collections; digital humanities projects; course sites; and student projects. This workshop offers: examples of digital collections built on the Omeka platform; hands on experience building a digital collection in Omeka; and ideas for web hosting. ###Digital Curation with Pinterest and Historypin ####Friday, February 26 *Mary Anne Caton* * If you're dealing with the web, you face the problem of information overload. How do you collect and organize your scholarly interests, particularly collections of images? We'll teach you how to get started with digital curation using two platforms: [Pinterest](www.pinterest.com) and [Historypin](https://www.historypin.org/). Digital curation is not just about organizing images of cats and your favorite vacation spots. By the end of this workshop, you'll know how to use these curation tools to advance your scholarly work. * ###GitHub as an Educational Technology ####Friday, March 4 *Ramona Romero* * Among other things, [GitHub](https://github.com/) is a social network for computer programmers. But GitHub is also a fantastic educational technology. In this session, we'll introduce you to git, the distributed version control system that powers GitHub. We'll show you how to set up an account with GitHub and collaborate with others on projects. You will learn the basics of Markdown, the simple markup language used to communicate on GitHub. We'll talk about the uses of GitHub in the classroom, the sciences, and the digital humanities. If you're brave, we'll even get into advance topics like branching and forking. By the end of the session, you'll be ready to create repositories and collaborate with scholars around the interwebs. ###Markup Languages for Digital Humanities ####Friday, March 18 *Cliff Anderson & Suellen Stringer-Hye* * Developing digital editions of scholarly texts requires the use of various so-called 'markup languages.' In this session, we'll introduce you to two key markup languages: the [Text Encoding Initiative (TEI)](http://www.tei-c.org/index.xml) and the [Journal Article Tagging Suite (JATS)](http://jats.nlm.nih.gov/). You will also learn how to mark up a document in both languages using the [oXygen XML editor](https://www.oxygenxml.com/). ###Fundamentals of Cartography ####Friday, March 25 *Lindsey Fox* * Cartography combines both the science and the aesthetic of making maps. Cartography is essential to the dissemination of geographic information. In this workshop, we will cover the fundamentals of cartography while discussing the place it takes in the world of Geographic Information Systems (GIS). ###Exploring Altmetrics with ImpactStory ####Friday, April 1 *Rick Stringer-Hye* * Altmetrics is the study and use of non-traditional scholarly impact measures that are based on activity in web-based environments. As scholarship increasingly moves online, these metrics track associated interactions and activity to generate fine-grained data, allowing researchers and policy makers to create a higher resolution picture of the reach and impact of academic research. In this workshop, [ImpactStory](https://impactstory.org/), one of the leading open source Altmetrics services, will be demonstrated. ###Managing Your Citations with Zotero ####Friday, April 8 *Chris Benda* * [Zotero](http://www.zotero.org) is an open source bibliographic management system that stores citation information and lets you use it in documents. (Translation: say goodbye to your citation nightmares.) This workshop will introduce Zotero, give participants a chance to start using it to build a library of references, and point to developer tools, like Web APIs, that allow you to use citation data creatively. ###Network Analysis and Visualization with Cytoscape ####Friday, April 15 *Lindsey Fox & Suellen Stringer-Hye* * [Cytoscape](http://www.cytoscape.org/) is an open source platform for analzying and visualizing network data. While originally developed to support biological research, you can use Cytoscape to explore any kind of network graph. We'll show you how to get started using Cytoscape to analyze simple data sets from a number of different domains, ranging from the natural sciences to the digital humanities.
EdWarga/workshops
spring2016.md
Markdown
gpl-3.0
8,468
#include "imageinfooverlayproxy.h" ImageInfoOverlayProxy::ImageInfoOverlayProxy(FloatingWidgetContainer *parent) : container(parent), overlay(nullptr) { } ImageInfoOverlayProxy::~ImageInfoOverlayProxy() { if(overlay) overlay->deleteLater(); } void ImageInfoOverlayProxy::show() { init(); overlay->show(); } void ImageInfoOverlayProxy::hide() { if(overlay) overlay->hide(); } void ImageInfoOverlayProxy::init() { if(overlay) return; overlay = new ImageInfoOverlay(container); overlay->setExifInfo(stateBuf.info); } bool ImageInfoOverlayProxy::isHidden() { return overlay ? overlay->isHidden() : true; } void ImageInfoOverlayProxy::setExifInfo(QMap<QString, QString> _info) { if(overlay) overlay->setExifInfo(_info); else stateBuf.info = _info; }
easymodo/qimgv
qimgv/gui/overlays/imageinfooverlayproxy.cpp
C++
gpl-3.0
842
<h2 id="eXastumDesktop" class="title">eXastum Desktop</h2> <span class="green_badge">Active</span> <p> ayyyyyyyyyyyyyyyyy lmao </p>
brianmillar/ontropy.org
projects/eXastumDesktop.html
HTML
gpl-3.0
136
<div class="{{$containerClass or 'form-group'}}" [ngClass]="{has-error: ({{$name}}.errors && ({{$name}}.dirty || {{$name}}.touched)}"> <label class="col-md-2 control-label">{{$label}}</label> <div class="col-md-10"> <select type="{{$type or 'text'}}" class="{{$inputClass or 'form-control'}}" @ngModel($model . '.' . $name) name="{{$name}}" @if(isset($rules) && ($nodeRule = array_get($rules, $name)) && ($nodeRules = explode('|', $nodeRule))) @foreach($nodeRules as $nodeRule) @if($nodeRule == 'required') required @endif @endforeach @endif > @foreach($options as $value => $optionName) <option value="{{$value}}">{{$optionName}}</option> @endforeach </select> <small>{{$description or ''}}</small> @include('kernel::_misc.form._private.error-container') </div> </div>
larangu/form-ng
resources/views/templates/bootstrap3/select-ng.blade.php
PHP
gpl-3.0
989
import unittest from .Weather_analyzer import is_not_number class BtcPriceTestCase(unittest.TestCase): def test_checking_of_input_in_form(self): input = 46 answer = is_not_number(input) # The bitcoin returned changes over time! self.assertEqual(answer, False)
AntonKuksov/Weather_analyzer
test_form.py
Python
gpl-3.0
300
#include <QtWidgets/QApplication> #include <QtWidgets/QPushButton> int main(int argc, char **argv) { QApplication app (argc, argv); QPushButton button ("Hello world!"); button.show(); return app.exec(); }
diegohdorta/buildroot-qt
examples/hello_world/main.cpp
C++
gpl-3.0
213
REM Copies files necessary for deployment. Used by Qt Creator REM Usage: deploy.bat xcopy /Y /I /E assets .\debug\. xcopy /Y /I /E assets .\release\.
Andlon/spark
deploy.bat
Batchfile
gpl-3.0
151
<?php require_once(__DIR__.'/Session.php'); /** * Base Bot class */ abstract class Bot { /** * Telegram message max lenght * @type int */ protected const MAX_LENGTH = 4096; /* * Bot's configuration * @type array */ protected $aConfig; /** * Checks if the received tocken matches with the Bot secret tocken * @param $token string the tocken received */ public function __construct($sToken) { $this->aConfig = parse_ini_file(__DIR__.'/'.get_called_class().'.ini.php', true); if($sToken !== $this->aConfig['SECRET']) { throw new Exception('Wrong security token'); } } /** * Parse the received json string * @param $json string the json received */ public function parse($sJson) { $sMethod = null; $aJson = json_decode($sJson, true); $oSession = Session::getSingleton(get_called_class(), $this->getChatId($aJson)); $sMessageId = $this->getMessageId($aJson); if($oSession->isAlreadyProcessed($sMessageId)) { return; } $sText = $this->getMessageText($aJson); if($sText[0] == '/') { list($sMethod, $aParts) = $this->getMethodAndArguments($sText); } elseif($this->storedMessage($this->getChatId($aJson), $this->getReplyToMessageId($aJson))) { list($sMethod, $aParts) = $this->recursivelyGetMethodAndArguments($this->getChatId($aJson), $this->getReplyToMessageId($aJson)); $aParts[] = $sText; } else { $sMethod = 'catchAll'; $aParts = array($sText); } if(!empty($sMethod) && method_exists($this, $sMethod)) { $aRes = call_user_func_array(array(&$this, $sMethod), array_merge(array($aJson), $aParts)); } else { $aRes = $this->logMessage($sJson); } $oSession->setAsProcessed($sMessageId); return $aRes; } /** * Retrieves the message's entity type * @param $message array the message * @returns string */ protected function getEntityType($aJson) { switch(true) { case array_key_exists('result', $aJson): return 'result'; case array_key_exists('message', $aJson): return 'message'; case array_key_exists('callback_query', $aJson): return 'callback_query'; default: throw new Exception('Unknown entity type '.json_encode($aJson)); } } /** * Retrieves the message's entity * @param $message array the message * @returns array */ protected function &getEntity($aJson) { switch(true) { case array_key_exists('result', $aJson): return $aJson['result']; case array_key_exists('message', $aJson): return $aJson['message']; case array_key_exists('callback_query', $aJson): return $aJson['callback_query']['message']; default: throw new Exception('Unknown entity type '.json_encode($aJson)); } } /** * Retrieves the message's chat id * @param $message array the message * @returns string */ protected function getChatId($aJson) { return $this->getEntity($aJson)['chat']['id']; } /** * Retrieves the message's id * @param $message array the message * @returns string */ protected function getMessageId($aJson) { return $this->getEntity($aJson)['message_id']; } /** * Retrieves the message's text * @param $message array the message * @returns string */ protected function getMessageText($aJson) { return $this->getEntity($aJson)['text']; } /** * Retrieves the original message's id * @param $message array the message * @returns string */ protected function getReplyToMessageId($aJson) { return $this->getEntity($aJson)['reply_to_message']['message_id']; } /** * Logs unmatched a message * @param $message string the message * @returns bool */ protected function logMessage($sMessage) { $sDir = __DIR__.'/../logs/'; if(!file_exists($sDir)) { mkdir($sDir, 0777, true); } return file_put_contents($sDir.get_called_class().'.json', $sMessage."\n", FILE_APPEND); } /** * Extracts the method and the arguments from the message * @param $message string the message * @returns array */ protected function getMethodAndArguments($sMessage) { if(preg_match('/^\/(\S+)\s*(.*)$/', $sMessage, $aMatch)) { $aParts = array(); //check if botname has been specified if(strpos($aMatch[1], '@') === false) { $sMethod = $aMatch[1]; $sPart = $aMatch[2]; } else { $aTemp = explode('@', $aMatch[1]); if($aTemp[1] == $this->aConfig['BOT_NAME']) { $sMethod = $aTemp[0]; $sPart = $aMatch[2]; } else { $sMethod = null; $sPart = $aMatch[0]; } } if(!empty($sPart)) { $aParts[] = $sPart; } return array($sMethod, $aParts); } else { return array(null, array($sMessage)); } } /** * Checks if a message has been stored (for example for a Forced Reply) * @param $chat_id string the chat's id * @param $message_id string the message's id * @returns bool */ protected function storedMessage($sChatId, $sMessageId) { $oSession = Session::getSingleton(); return $oSession->storedMessage($sChatId, $sMessageId); } /** * Stores the message structure for later check * @param $json string the message structure */ protected function storeMessage($aJson) { $oSession = Session::getSingleton(); return $oSession->storeMessage($this->getChatId($aJson), $this->getMessageId($aJson), $aJson); } /** * Retrieves the command and the arguments starting from the given message until the first chained message * @param $chat_id string the chat's id * @param $message_id string the message's id * @returns array */ protected function recursivelyGetMethodAndArguments($sChatId, $sMessageId, $aParts = array()) { $oSession = Session::getSingleton(); $sMethod = null; while($oSession->storedMessage($sChatId, $sMessageId)) { $aJson = $oSession->retrieveStoredMessage($sChatId, $sMessageId); if($this->getEntityType($aJson) != 'result') { list($sMethod, $aNewParts) = $this->getMethodAndArguments($this->getMessageText($aJson)); $aParts = array_merge($aNewParts, $aParts); } $sMessageId = $this->getReplyToMessageId($aJson); } return array($sMethod, $aParts); } /** * Retrieves the message from the storage * @param $chat_id string the chat's id * @param $message_id string the message's id * @returns array */ protected function retrieveStoredMessage($sChatId, $sMessageId) { $oSession = Session::getSingleton(); return $oSession->retrieveStoredMessage($sChatId, $sMessageId); } /** * Deletes all chained messages from the storage * @param $chat_id string the chat's id * @param $message_id string the message's id * @returns bool */ protected function recursivelyDeleteStoredMessage($sChatId, $sMessageId) { $oSession = Session::getSingleton(); while($oSession->storedMessage($sChatId, $sMessageId)) { $aJson = $oSession->retrieveStoredMessage($sChatId, $sMessageId); if(!$oSession->deleteStoredMessage($sChatId, $sMessageId)) { return false; } $sMessageId = $this->getReplyToMessageId($aJson); } return true; } /** * Deletes the message from the storage * @param $chat_id string the chat's id * @param $message_id string the message's id * @returns bool */ protected function deleteStoredMessage($sChatId, $sMessageId) { $oSession = Session::getSingleton(); return $oSession->deleteStoredMessage($sChatId, $sMessageId); } /** * Retrieves a file * @param $file_id string the file's id * @returns string */ protected function getFile($sFileId) { $aResult = $this->callTelegram('getFile', array( 'file_id' => $sFileId )); if($aResult['ok']) { //download the file to a temp path $sTempFile = tempnam(null, 'file'); file_put_contents($sTempFile, file_get_contents('https://api.telegram.org/file/bot'.$this->aConfig['HTTP_TOKEN'].'/'.$aResult['result']['file_path'])); return $sTempFile; } return false; } /** * Sends a message to a specified chat * @param $chat_id string the chat's id * @param $message string the message * @param $reply_id string the message being replied * @param $forced_reply bool tells if the user MUST reply * @param $preview bool tells if the message will contains a preview * @param $parse_mode string tells what kind of markup is used on the message * @param $keyboard array matrix representing the user keyboard * @returns array */ protected function sendMessage($sChatId, $sMessage, $sReplyId = null, $bForceReply = false, $bPreview = true, $sParseMode = null, $aKeyboard = null) { $aParams = array( 'chat_id' => $sChatId, 'text' => $sMessage, ); if(!is_null($sReplyId)) { $aParams['reply_to_message_id'] = $sReplyId; } if($bForceReply) { $aParams['reply_markup'] = '{"force_reply":true,"selective":true}'; } if(!$bPreview) { $aParams['disable_web_page_preview'] = 'true'; } if(!is_null($sParseMode)) { switch($sParseMode) { case 'Markdown': case 'HTML': $aParams['parse_mode'] = $sParseMode; break; default: throw new Exception('Invalid parse_mode: '.$sParseMode); } } if(!is_null($aKeyboard)) { $aParams['reply_markup'] = json_encode($aKeyboard); } //the message is too long, we need to split it if(strlen($sMessage) > self::MAX_LENGTH) { $aMessage = explode("\n", $sMessage); $aMessages = array(); $iIndex = 0; foreach($aMessage as $sText) { if(strlen($sText) > self::MAX_LENGTH) { throw new Exception('Message too long'); } if(strlen($aMessages[$iIndex].(empty($aMessages[$iIndex])?'':"\n").$sText) > self::MAX_LENGTH) { $iIndex++; } $aMessages[$iIndex] .= (empty($aMessages[$iIndex])?'':"\n").$sText; } $aResults = array(); foreach($aMessages as $sMessage) { $aParams['text'] = $sMessage; $aResults[] = $this->callTelegram('sendMessage', $aParams); } return $aResults; } else { return $this->callTelegram('sendMessage', $aParams); } } protected function deleteMessage($sChatId, $sMessageId) { return $this->callTelegram('deleteMessage', array( 'chat_id' => $sChatId, 'message_id' => $sMessageId )); } /** * Sends a photo to a specified chat * @param $chat_id string the chat's id * @param $photo string the photo * @param $caption string the caption * @param $reply_id string the message being replied * @param $forced_reply bool tells if the user MUST reply * @param $preview bool tells if the preview must be shown * @returns array */ protected function sendPhoto($sChatId, $sPhoto, $sCaption = null, $sReplyId = null, $bForceReply = false, $bPreview = true) { //download remote files to temp file if(substr($sPhoto, 0, 4) == 'http') { $sTempFile = tempnam(sys_get_temp_dir(), 'img'); File_put_contents($sTempFile, file_get_contents($sPhoto)); //Telegram pretends the file with the correct extension if(preg_match('/(\.\w+)[^\.]*$/', $sPhoto, $aMatch)) { rename($sTempFile, $sTempFile.$aMatch[1]); $sTempFile .= $aMatch[1]; $sPhoto = $sTempFile; } } else { $sTempFile = false; } $aParams = array( 'chat_id' => $sChatId, 'photo' => new CurlFile($sPhoto), ); if(!is_null($sCaption)) { $aParams['caption'] = $sCaption; } if(!is_null($sReplyId)) { $aParams['reply_to_message_id'] = $sReplyId; } if($bForceReply) { $aParams['reply_markup'] = '{"force_reply":true,"selective":true}'; } if(!$bPreview) { $aParams['disable_web_page_preview'] = 'true'; } $aRes = $this->callTelegram('sendPhoto', $aParams); if($sTempFile) { unlink($sTempFile); } return $aRes; } /** * Sends an audio message to a specified chat * @param $chat_id string the chat's id * @param $audio string the audio file * @param $duration int the duration of the audio * @param $performer string the performer of the audio file * @param $title string the title of the audio file * @param $reply_id string the message being replied * @param $forced_reply bool tells if the user MUST reply * @returns array */ protected function sendAudio($sChatId, $sAudio, $iDuration = null, $sPerformer = null, $sTitle = null, $sReplyId = null, $bForceReply = false) { //download remote files to temp file if(substr($sAudio, 0, 4) == 'http') { $sTempFile = tempnam(sys_get_temp_dir(), 'audio'); File_put_contents($sTempFile, file_get_contents($sAudio)); //Telegram pretends the file with the correct extension if(preg_match('/(\.\w+)[^\.]*^/', $sAudio, $aMatch)) { rename($sTempFile, $sTempFile.$aMatch[1]); $sTempFile .= $aMatch[1]; $sAudio = $sTempFile; } } else { $sTempFile = false; } $aParams = array( 'chat_id' => $sChatId, 'audio' => new CurlFile($sAudio), ); if(!is_null($iDuration)) { $aParams['duration'] = $iDuration; } if(!is_null($sPerformer)) { $aParams['performer'] = $sPerformer; } if(!is_null($sTitle)) { $aParams['title'] = $sTitle; } if(!is_null($sReplyId)) { $aParams['reply_to_message_id'] = $sReplyId; } if($bForceReply) { $aParams['reply_markup'] = '{"force_reply":true,"selective":true}'; } $aRes = $this->callTelegram('sendAudio', $aParams); if($sTempFile) { unlink($sTempFile); } return $aRes; } /** * Sends a voice message to a specified chat * @param $chat_id string the chat's id * @param $voice string the voice file * @param $duration int the duration of the voice message * @param $reply_id string the message being replied * @param $forced_reply bool tells if the user MUST reply * @returns array */ protected function sendVoice($sChatId, $sVoice, $iDuration = null, $sReplyId = null, $bForceReply = false) { //download remote files to temp file if(substr($sVoice, 0, 4) == 'http') { $sTempFile = tempnam(sys_get_temp_dir(), 'voice'); File_put_contents($sTempFile, file_get_contents($sVoice)); //Telegram pretends the file with the correct extension if(preg_match('/(\.\w+)[^\.]*^/', $sVoice, $aMatch)) { rename($sTempFile, $sTempFile.$aMatch[1]); $sTempFile .= $aMatch[1]; $sVoice = $sTempFile; } } else { $sTempFile = false; } $aParams = array( 'chat_id' => $sChatId, 'voice' => new CurlFile($sVoice), ); if(!is_null($iDuration)) { $aParams['duration'] = $iDuration; } if(!is_null($sReplyId)) { $aParams['reply_to_message_id'] = $sReplyId; } if($bForceReply) { $aParams['reply_markup'] = '{"force_reply":true,"selective":true}'; } $aRes = $this->callTelegram('sendVoice', $aParams); if($sTempFile) { unlink($sTempFile); } return $aRes; } /** * Sends a document to a specified chat * @param $chat_id string the chat's id * @param $document string the document * @param $reply_id string the message being replied * @param $forced_reply bool tells if the user MUST reply * @returns array */ protected function sendDocument($sChatId, $sDocument, $sReplyId = null, $bForceReply = false) { //download remote files to temp file if(substr($sDocument, 0, 4) == 'http') { $sTempFile = tempnam(sys_get_temp_dir(), 'doc'); File_put_contents($sTempFile, file_get_contents($sDocument)); //Telegram pretends the file with the correct extension if(preg_match('/(\.\w+)[^\.]*$/', $sDocument, $aMatch)) { rename($sTempFile, $sTempFile.$aMatch[1]); $sTempFile .= $aMatch[1]; $sDocument = $sTempFile; } } else { $sTempFile = false; } $aParams = array( 'chat_id' => $sChatId, 'document' => new CurlFile($sDocument), ); if(!is_null($sReplyId)) { $aParams['reply_to_message_id'] = $sReplyId; } if($bForceReply) { $aParams['reply_markup'] = '{"force_reply":true,"selective":true}'; } $aRes = $this->callTelegram('sendDocument', $aParams); if($sTempFile) { unlink($sTempFile); } return $aRes; } /** * Sets an action for the specified chat * @param $chat_id string the chat's id * @param $action string the action * @returns array */ protected function sendChatAction($sChatId, $sAction) { $aPossibleActions = array('typing' ,'upload_photo' ,'record_video' ,'upload_video' ,'record_audio' ,'upload_audio' ,'upload_document' ,'find_location'); if(in_array($sAction, $aPossibleActions)) { return $this->callTelegram('sendChatAction', array( 'chat_id' => $sChatId, 'action' => $sAction, )); } else { return false; } } /** * Sends a command to the Telegram server * @param $method string the chat's id * @param $arguments string the message * @returns array */ protected function callTelegram($sMethod, $aArguments) { $rCurl = curl_init(); curl_setopt_array($rCurl, array( CURLOPT_URL => 'https://api.telegram.org/bot'.$this->aConfig['HTTP_TOKEN'].'/'.$sMethod, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $aArguments )); $sResponse = curl_exec($rCurl); if($sResponse === false) { $aRes = array( 'ok' => false, 'description' => curl_error($rCurl) ); } else { $aRes = json_decode($sResponse, true); } curl_close($rCurl); return $aRes; } /** * Sends a command to the Telegram server * @param $method string the chat's id * @param $arguments string the message * @returns array */ protected function getMediaList($sFilter = '*') { $aFiles = glob(__DIR__.'/../media/'.get_called_class().'/'.$sFilter); $aRes = array(); foreach($aFiles as $sFile) { $aRes[] = basename($sFile); } return $aRes; } /** * Sends a command to the Telegram server * @param $method string the chat's id * @param $arguments string the message * @returns array */ protected function getMedia($sFilename) { return __DIR__.'/../media/'.get_called_class().'/'.$sFilename; } /** * Sends a suggestion to the Bot developer * @param $json Array the message received * @param $suggestion string the suggestion * @returns array */ protected function suggest($aJson, $sSuggestion = null) { if(empty($sSuggestion)) { $this->storeMessage($aJson); return $this->storeMessage($this->sendMessage($this->getChatId($aJson), 'Now insert the suggestion text', $this->getMessageId($aJson), true)); } $aEntity = $this->getEntity($aJson); $this->sendMessage($this->aConfig['DEVELOPER_CHAT_ID'], 'New suggestion received from ['.$aEntity['from']['first_name'].' '.$aEntity['from']['last_name'].'](tg://user?id='.$aEntity['from']['id'].'): '.$sSuggestion, null, false, true, 'Markdown'); $this->recursivelyDeleteStoredMessage($this->getChatId($aJson), $this->getReplyToMessageId($aJson)); return $this->sendMessage($this->getChatId($aJson), 'Thank you for your suggestion.'); } /** * Perform optionals scheduled operations */ protected function cron() { } /** * Describes the Bot * @param $json Array the message received * @returns array */ abstract protected function about($aJson); /** * Shows the usage message * @param $json Array the message received * @returns array */ abstract protected function help($aJson); }
nappa85/Telegram
classes/Bot.php
PHP
gpl-3.0
19,426
############################################################################### # Makefile :: Builds FIXCODE program for several platforms. [wmake] # ############################################################################### # # This Makefile builds the FIXCODE program for DOS, Windows, OS/2 and Linux. # FIXCODE is used to embed the anti-virus code into the AiR-BOOT image. # This anti-virus code protects the MBR and is installed as a TSR by the # loader. That's why it cannot be included at the source level. # # # Include a Master Makefile with several cross-platform definitions and macros. # This is used to compensate for the differences between the target platforms. # !include ../../INCLUDE/MAKEFILE.MIF # # Specifies the level of debugging. # Level 0 is no debugging (release) and each higher level may use other # assembler / compiler / linker flags and define jammed-in constants # to influence source assembly / compilation. # DEBUG_LEVEL=0 MAX_DEBUG_LEVEL=2 # # Protect against missing or invalid debug-levels. # !ifndef DEBUG_LEVEL !error DEBUG_LEVEL not defined ! !elseifndef MAX_DEBUG_LEVEL !error MAX_DEBUG_LEVEL not defined ! !elseif $(DEBUG_LEVEL) > $(MAX_DEBUG_LEVEL) !error DEBUG_LEVEL cannot exceed $(MAX_DEBUG_LEVEL) ! !elseif $(DEBUG_LEVEL) < 0 !error DEBUG_LEVEL cannot be negative ! !endif # # Base Name of Program to build. # A letter is appended for each platform version: # D=DOS, W=Windows, 2=OS2, L=Linux. # The DOS COM-version has no suffix. # BASENAME=FIXCODE # # This is a list of the Targets to be built. # TARGETS=$(BASENAME).COM $(BASENAME)D.EXE $(BASENAME)W.EXE $(BASENAME)2.EXE $(BASENAME)L.ELF #TARGETS=$(BASENAME)D.EXE #TARGETS=$(BASENAME).COM # # Assembler Tools. # #ASM=alp #ASM=tasm #ASM=wasm ASM=jwasm # # There are no masm or alp for Linux and the yasm tasm-mode is incompatible. # So we override to jwasm when a non-jwasm assembler is specified and # we are building on Linux. # !ifdef __LINUX__ !if "$(ASM)"=="masm" | "$(ASM)"=="tasm" | "$(ASM)"=="alp" ASM=jwasm !endif !endif !if "$(ASM)"=="jwasm" # -Cp = case sensitive symbols # -zcw = no _ prefix on symbols (C model) ASM_FLAGS_D0=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q -Cp -Fo$^. -Fl=$^&.LST -Fw$^&.ERR ASM_FLAGS_D1=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR ASM_FLAGS_D2=-DDEBUG_LEVEL=$(DEBUG_LEVEL) -DASSEMBLER=JWASM -q -Zd -Zi -Fo$^. -Sa -Fl=$^&.LST -Fw$^&.ERR !elseif "$(ASM)"=="wasm" ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -zq -fo=$^. -fr=$^&.ERR ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -zq -d1 -fo=$^. -fr=$^&.ERR ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -zq -d1 -fo=$^. -fr=$^&.ERR !elseif "$(ASM)"=="tasm" # -ml = case sensitive symbols ASM_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t -l ASM_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t -z -zi -c -la ASM_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) -dASSEMBLER=TASM -t -z -zi -c -la !elseif "$(ASM)"=="alp" ASM_FLAGS_D0=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP -Mb +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR ASM_FLAGS_D1=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP -Mb +Od:MS16 +Feo:OBJ +Fl +Fel:LST +Fm +Fem:ERR ASM_FLAGS_D2=-D:DEBUG_LEVEL=$(DEBUG_LEVEL) -D:ASSEMBLER=ALP !else !error Unknown Assembler specified ! !endif ASM_FLAGS=$(ASM_FLAGS_D$(DEBUG_LEVEL)) # # 16-bits C Compiler # CC16=wcc MM16=-ml CC16_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -w4 -e25 -zq -otexan -fo=$^. -fr=$^&.ERR CC16_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -d2 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR CC16_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM16) -d2 -w4 -e25 -zq -od -fo=$^. -fr=$^&.ERR CC16_FLAGS=$(CC16_FLAGS_D$(DEBUG_LEVEL)) # # 32-bits C Compiler # MM32=-mf CC32=wcc386 CC32_FLAGS_D0=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -w4 -e25 -zq -otexan -6r -fo=$^. -fr=$^&.ERR CC32_FLAGS_D1=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d2 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR CC32_FLAGS_D2=-dDEBUG_LEVEL=$(DEBUG_LEVEL) $(MM32) -d2 -w4 -e25 -zq -od -6r -fo=$^. -fr=$^&.ERR CC32_FLAGS_R=-w4 -e25 -zq -od -6r -mf -fo=$^. CC32_FLAGS=$(CC32_FLAGS_D$(DEBUG_LEVEL)) # # Linker # LNK=wlink LNK_FLAGS_D0=op q op v op map=$^&.MAP LNK_FLAGS_D1=op q op v d all op map=$^&.MAP LNK_FLAGS_D2=op q op v d all op map=$^&.MAP LNK_FLAGS=$(LNK_FLAGS_D$(DEBUG_LEVEL)) # # This is executed before Makefile processing. # .BEFORE # @echo == BEFORE == # # This is executed after Makefile processing. # .AFTER # @echo == AFTER == !ifdef __MSDOS__ @echo $(WARN_DOS_BLD_ENV) !endif # # This builds all targets by using normal dependency rules. # If this Makefile was modified, all targets are forcefully rebuilt. # all: .SYMBOLIC Makefile.bu header $(TARGETS) footer # # Alternative ways to build all targets. # The first method builds all targets by recursively # invoking WMake for each target. # If concatenation is used, like adding include-directories to the environment, # this may result in multiple identical concatenations. # The second method uses the procedure method, no concatenation problem. # #all: .SYMBOLIC # Recursive method (concatenation problem) # @for %%i in (header $(TARGETS) footer) do @$(MAKE) -h %%i # Procedure method (no concatenation problem, no re-invocation) # @for %%i in (header $(TARGETS) footer) do @%MAKE %%i # # Show the header. # header: .SYMBOLIC @echo. @echo ===================================================================== @echo = PROGRAM: FIXCODE Multi Platform [DOS, Win32, OS/2 and Linux] = @echo ===================================================================== # @echo. # # Show the footer. # footer: .SYMBOLIC @echo All targets up to date ! @echo. # # Create a backup of the Makefile when it is modified. # This also forces a rebuild of all targets. # So, when changing i.e. the DEBUG_LEVEL, all targets are rebuilt # using the new level. # Makefile.bu: Makefile @echo. @echo Makefile modified, forcing rebuild of all targets ! @echo. @%MAKE clean $(CP) Makefile Makefile.bu # # DOS WMake has a bug in that it expands $^& and $^. to lowercase, # even though the definition is in uppercase. # This gives problems when building in an OS/2 DOS-Box on a network # share where also a Linux build-environment is active. # The Linux build-environment is case sensitive and will not # find the lowercase files. # For example, a clean from Linux will not work properly in that case. # This does not influence building DOS targets on Linux. # # # MAIN TARGETS # ############################################################################### # DOS 16-bits (COM) ############################################################################### $(BASENAME).COM: $(BASENAME).OBJ $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos com @if exist $^. @echo $^. $(MSG_SUCCESS) @echo. $(BASENAME).OBJ: $(BASENAME).ASM # @echo. @echo TARGET: $^&.COM [DOS 16-bits COM-file] $(ASM) $(ASM_FLAGS) $(BASENAME).ASM @wdis -fi $^. > $^&.WDA ############################################################################### # DOS 16-bits (MZ) ############################################################################### $(BASENAME)D.EXE: $(BASENAME)D.OBJ $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys dos @if exist $^. @echo $^. $(MSG_SUCCESS) @echo. $(BASENAME)D.OBJ: $(BASENAME).C $(BASENAME).H # @echo. @echo TARGET: $^&.EXE [DOS 16-bits Executable] $(CC16) $(CC16_FLAGS) -bt=dos $(BASENAME).C @wdis -fi $^. > $^&.WDA ############################################################################### # NT 32-bits (PE) ############################################################################### $(BASENAME)W.EXE: $(BASENAME)W.OBJ $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys nt @if exist $^. @echo $^. $(MSG_SUCCESS) @echo. $(BASENAME)W.OBJ: $(BASENAME).C $(BASENAME).H # @echo. @echo TARGET: $^&.EXE [NT 32-bits Executable] $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)nt -bt=nt $(BASENAME).C @wdis -fi $^. > $^&.WDA ############################################################################### # OS/2 32-bits (LX) ############################################################################### $(BASENAME)2.EXE: $(BASENAME)2.OBJ $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^. sys os2v2 @if exist $^. @echo $^. $(MSG_SUCCESS) @echo. $(BASENAME)2.OBJ: $(BASENAME).C $(BASENAME).H # @echo. @echo TARGET: $^&.EXE [OS/2 32-bits Executable] $(CC32) $(CC32_FLAGS) -I$(%WATCOM)$(DS)h$(DS)os2 -bt=os2 $(BASENAME).C @wdis -fi $^. > $^&.WDA ############################################################################### # Linux 32-bits (ELF) ############################################################################### $(BASENAME)L.ELF: $(BASENAME)L.OBJ $(LNK) $(LNK_FLAGS) file $^&.OBJ name $^&.ELF sys linux # $(MV) $^&.ELF $^. @if exist $^. @echo $^. $(MSG_SUCCESS) @echo. $(BASENAME)L.OBJ: $(BASENAME).C $(BASENAME).H # @echo. @echo TARGET: $^&.ELF [Linux 32-bits Executable] $(CC32) $(CC32_FLAGS) -bt=linux $(BASENAME).C @wdis -fi $^. > $^&.WDA # # MAIN ACTIONS # # # Rebuild all targets. # rebuild: .SYMBOLIC @%MAKE clean @%MAKE all # # Remove all generated files. # clean: .SYMBOLIC @for %%i in ($(TARGETS)) do @if exist %%i $(RM) %%i @if exist *.OBJ $(RM) *.OBJ @if exist *.WDA $(RM) *.WDA @if exist *.NDA $(RM) *.NDA @if exist *.MAP $(RM) *.MAP @if exist *.LST $(RM) *.LST @if exist *.ERR $(RM) *.ERR @if exist *.o $(RM) *.o # # Help on using this Makefile. # help: .SYMBOLIC @echo. @echo The following actions are available: @echo wmake to build all targets @echo wmake show to show the list of buildable targets @echo wmake clean to remove all generated files @echo wmake rebuild to rebuild all targets @echo wmake help for this information @echo. # # Show the list of buildable targets. # show: .SYMBOLIC @echo. @echo The following [case sensitive] targets can be built: @for %%i in ($(TARGETS)) do @echo %%i @echo. # Alias for show list: .SYMBOLIC @%MAKE show # # Inform user that a rebuild might help if the build process fails. # .ERROR @echo. @echo Oops! @echo Some error occured in this build session. @echo If it's a linker problem, it could be @echo the result of out-of-sync object files. @echo Doing a wmake rebuild might resolve the problem. @%MAKE help @echo.
OS2World/UTIL-STARTUP-AirBoot
TOOLS/INTERNAL/Makefile
Makefile
gpl-3.0
10,343
package fi.otavanopisto.pyramus.rest; import static io.restassured.RestAssured.given; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import io.restassured.response.Response; import fi.otavanopisto.pyramus.rest.controller.permissions.SchoolPermissions; import fi.otavanopisto.pyramus.rest.model.PhoneNumber; @RunWith(Parameterized.class) public class SchoolPhoneNumberPermissionsTestsIT extends AbstractRESTPermissionsTest { private SchoolPermissions schoolPermissions = new SchoolPermissions(); @Parameters public static List<Object[]> generateData() { return getGeneratedRoleData(); } public SchoolPhoneNumberPermissionsTestsIT(String role) { this.role = role; } @Test public void testPermissionsCreateSchoolPhoneNumber() throws NoSuchFieldException { PhoneNumber phoneNumber = new PhoneNumber(null, 1l, Boolean.FALSE, "(123) 12 234 5678"); Response response = given().headers(getAuthHeaders()) .contentType("application/json") .body(phoneNumber) .post("/schools/schools/{ID}/phoneNumbers", 1l); Long statusCode = new Long(response.statusCode()); Long id; if(statusCode.toString().equals("200")){ id = new Long(response.body().jsonPath().getInt("id")); if (!id.equals(null)) { given().headers(getAdminAuthHeaders()) .delete("/schools/schools/{SCHOOLID}/phoneNumbers/{ID}", 1l, id); } } } @Test public void testPermissionsListSchoolPhoneNumbers() throws NoSuchFieldException { assertOk(given().headers(getAuthHeaders()) .get("/schools/schools/{ID}/phoneNumbers", 1l), schoolPermissions, SchoolPermissions.LIST_SCHOOLPHONENUMBERS, 200); } @Test public void testPermissionsFindSchoolPhoneNumber() throws NoSuchFieldException { assertOk(given().headers(getAuthHeaders()) .get("/schools/schools/{SCHOOLID}/phoneNumbers/{ID}", 1l, 1l), schoolPermissions, SchoolPermissions.FIND_SCHOOLPHONENUMBER, 200); } @Test public void testPermissionsDeleteSchoolPhoneNumber() throws NoSuchFieldException { PhoneNumber phoneNumber = new PhoneNumber(null, 1l, Boolean.FALSE, "(123) 12 234 5678"); Response response = given().headers(getAdminAuthHeaders()) .contentType("application/json") .body(phoneNumber) .post("/schools/schools/{SCHOOLID}/phoneNumbers", 1l); Long id = new Long(response.body().jsonPath().getInt("id")); Response deleteResponse = given().headers(getAuthHeaders()) .delete("/schools/schools/{SCHOOLID}/phoneNumbers/{ID}", 1l, id); assertOk(deleteResponse, schoolPermissions, SchoolPermissions.DELETE_SCHOOLPHONENUMBER, 204); Long statusCode = new Long(deleteResponse.statusCode()); if(!statusCode.toString().equals("204")) given().headers(getAdminAuthHeaders()) .delete("/schools/schools/{SCHOOLID}/phoneNumbers/{ID}", 1l, id); } }
otavanopisto/pyramus
pyramus/src/test/java/fi/otavanopisto/pyramus/rest/SchoolPhoneNumberPermissionsTestsIT.java
Java
gpl-3.0
3,003
/* * Extent allocator * Copyright (C) 2011 Andreas Öman * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <assert.h> #include <stdlib.h> #include <stddef.h> #include <stdio.h> #include <sys/queue.h> #include "redblack.h" #include "extents.h" LIST_HEAD(extent_freeseg_list, extent_freeseg); RB_HEAD(extent_freeseg_tree, extent_freeseg); RB_HEAD(extent_size_tree, extent_size); typedef struct extent_freeseg { RB_ENTRY(extent_freeseg) ef_link; LIST_ENTRY(extent_freeseg) ef_size_link; struct extent_size *ef_size; int ef_pos; } extent_freeseg_t; typedef struct extent_size { RB_ENTRY(extent_size) es_link; struct extent_freeseg_list es_freesegs; int es_size; } extent_size_t; struct extent_pool { struct extent_freeseg_tree ep_freesegs; struct extent_size_tree ep_sizes; extent_size_t *ep_size_skel; extent_freeseg_t *ep_freeseg_skel; int ep_total; }; /** * */ static int es_cmp(const extent_size_t *a, const extent_size_t *b) { return a->es_size - b->es_size; } /** * */ static int ef_cmp(const extent_freeseg_t *a, const extent_freeseg_t *b) { return a->ef_pos - b->ef_pos; } /** * */ static void ef_insert(extent_pool_t *ep, int size, extent_freeseg_t *ef) { extent_size_t *es; if(ep->ep_size_skel == NULL) ep->ep_size_skel = malloc(sizeof(extent_size_t)); ep->ep_size_skel->es_size = size; es = RB_INSERT_SORTED(&ep->ep_sizes, ep->ep_size_skel, es_link, es_cmp); if(es == NULL) { es = ep->ep_size_skel; ep->ep_size_skel = NULL; LIST_INIT(&es->es_freesegs); } ef->ef_size = es; LIST_INSERT_HEAD(&es->es_freesegs, ef, ef_size_link); } /** * */ static void ef_unlink(extent_pool_t *ep, extent_freeseg_t *ef) { extent_size_t *es = ef->ef_size; LIST_REMOVE(ef, ef_size_link); if(LIST_FIRST(&es->es_freesegs) == NULL) { RB_REMOVE(&ep->ep_sizes, es, es_link); free(es); } } /** * */ static void ef_destroy(extent_pool_t *ep, extent_freeseg_t *ef) { ef_unlink(ep, ef); RB_REMOVE(&ep->ep_freesegs, ef, ef_link); free(ef); } /** * */ static extent_size_t * es_find(extent_pool_t *ep, int size) { extent_size_t skel; skel.es_size = size; return RB_FIND_GE(&ep->ep_sizes, &skel, es_link, es_cmp); } /** * */ int extent_alloc(extent_pool_t *ep, int size) { extent_size_t *es; extent_freeseg_t *ef; int pos; if((es = es_find(ep, size)) == NULL) return -1; ef = LIST_FIRST(&es->es_freesegs); pos = ef->ef_pos; if(es->es_size == size) { ef_destroy(ep, ef); } else { ef->ef_pos += size; size = es->es_size - size; ef_unlink(ep, ef); ef_insert(ep, size, ef); } return pos; } /** * */ int extent_free(extent_pool_t *ep, int pos, int size) { extent_freeseg_t *ef, *p, *n; if(size == 0) return 0; if(ep->ep_freeseg_skel == NULL) ep->ep_freeseg_skel = malloc(sizeof(extent_freeseg_t)); ep->ep_freeseg_skel->ef_pos = pos; if(RB_INSERT_SORTED(&ep->ep_freesegs, ep->ep_freeseg_skel, ef_link, ef_cmp) != NULL) return -1; n = RB_NEXT(ep->ep_freeseg_skel, ef_link); p = RB_PREV(ep->ep_freeseg_skel, ef_link); if(p != NULL && p->ef_pos + p->ef_size->es_size > pos) return -2; if(n != NULL) { if(pos + size > n->ef_pos) return -3; if(n->ef_pos != pos + size) n = NULL; } if(p != NULL && p->ef_pos + p->ef_size->es_size == pos) { RB_REMOVE(&ep->ep_freesegs, ep->ep_freeseg_skel, ef_link); ef = p; size += ef->ef_size->es_size; ef_unlink(ep, ef); } else { ef = ep->ep_freeseg_skel; ep->ep_freeseg_skel = NULL; } if(n != NULL) { size += n->ef_size->es_size; ef_destroy(ep, n); } ef_insert(ep, size, ef); return 0; } /** * */ int extent_alloc_aligned(extent_pool_t *ep, int size, int alignment) { int rval, pos; extent_size_t *es; extent_freeseg_t *ef; if(alignment < 2) return extent_alloc(ep, size); alignment--; if((es = es_find(ep, size + alignment)) == NULL) return -1; ef = LIST_FIRST(&es->es_freesegs); pos = ef->ef_pos; rval = (pos + alignment) & ~alignment; const int size2 = ef->ef_pos + es->es_size - (rval + size); ef->ef_pos = rval + size; ef_unlink(ep, ef); ef_insert(ep, size2, ef); extent_free(ep, pos, rval - pos); return rval; } /** * */ extent_pool_t * extent_create(int start, int size) { extent_pool_t *ep = calloc(1, sizeof(extent_pool_t)); RB_INIT(&ep->ep_sizes); RB_INIT(&ep->ep_freesegs); ep->ep_total = size; extent_free(ep, start, size); return ep; } /** * */ void extent_destroy(extent_pool_t *ep) { extent_freeseg_t *ef; while((ef = ep->ep_freesegs.root) != NULL) ef_destroy(ep, ef); assert(ep->ep_sizes.root == NULL); free(ep); } /** * */ void extent_stats(const extent_pool_t *ep, int *totalp, int *availp, int *fragmentsp) { const extent_freeseg_t *ef; int avail = 0; int fragments = 0; RB_FOREACH(ef, &ep->ep_freesegs, ef_link) { avail += ef->ef_size->es_size; fragments++; } if(totalp != NULL) *totalp = ep->ep_total; if(availp != NULL) *availp = avail; if(fragmentsp != NULL) *fragmentsp = fragments; } /** * */ void extent_dump(extent_pool_t *ep) { extent_freeseg_t *ef; extent_size_t *es; printf(" freelist\n"); RB_FOREACH(ef, &ep->ep_freesegs, ef_link) { printf(" %10d +%d\n", ef->ef_pos, ef->ef_size->es_size); } printf(" size dist\n"); RB_FOREACH(es, &ep->ep_sizes, es_link) { int segs = 0; LIST_FOREACH(ef, &es->es_freesegs, ef_size_link) segs++; printf(" %10d * %d\n", es->es_size, segs); } } #if 0 #define ASIZE 10 #define BSIZE 100 #define CSIZE 1000 #define DSIZE 999 int main(int argc, char **argv) { extent_pool_t *ep = extent_create(0, 3000); int a, b, c, d; int total, avail, fragments; printf("Initial\n"); extent_dump(ep); a = extent_alloc(ep, ASIZE); b = extent_alloc(ep, BSIZE); c = extent_alloc(ep, CSIZE); d = extent_alloc(ep, DSIZE); printf("After four allocs\n"); extent_dump(ep); extent_stats(ep, &total, &avail, &fragments); printf(" Available %d of %d in %d fragments\n", total, avail, fragments); extent_free(ep, c, CSIZE); extent_dump(ep); extent_free(ep, a, ASIZE); extent_dump(ep); extent_free(ep, b, BSIZE); extent_dump(ep); extent_free(ep, d, DSIZE); a = extent_alloc(ep, 1023); extent_dump(ep); b = extent_alloc_aligned(ep, 99, 64); printf("Aligned alloc @ %d\n", b); c = extent_alloc_aligned(ep, 99, 64); printf("Aligned alloc @ %d\n", c); d = extent_alloc_aligned(ep, 99, 64); printf("Aligned alloc @ %d\n", d); extent_dump(ep); extent_stats(ep, &total, &avail, &fragments); printf(" Available %d of %d in %d fragments\n", avail, total, fragments); extent_free(ep, b, 99); extent_free(ep, a, 1023); extent_free(ep, c, 99); extent_free(ep, d, 99); printf("Final\n"); extent_dump(ep); return 0; } #endif
daedalus/showtime
src/misc/extents.c
C
gpl-3.0
7,543
<?php /** * LazyEater Shortcodes * * @package FrozrCoreLibrary * @subpackage Frozrmarketlibrary */ if ( ! defined( 'ABSPATH' ) ) exit; /* Exit if accessed directly*/ /*Location info shortcode*/ function frozr_user_location_info_shortcode( $atts ){ ob_start(); do_action('frozr_location_popup'); return ob_get_clean(); } add_shortcode( 'lazyeater_user_location', 'frozr_user_location_info_shortcode' ); /*LazyEater best selling dishes*/ function frozr_best_selling_dishes_shortcode( $atts ){ ob_start(); do_action('frozr_top_selling_dishes'); return ob_get_clean(); } add_shortcode( 'lazyeater_best_selling_dishes', 'frozr_best_selling_dishes_shortcode' ); /*LazyEater latest restaurants*/ function frozr_latest_resturants_shortcode( $atts ){ ob_start(); do_action('frozr_latest_resturants'); return ob_get_clean(); } add_shortcode( 'lazyeater_latest_restaurants', 'frozr_latest_resturants_shortcode' ); /*LazyEater Homepage advance dish/restaurants search box*/ function frozr_home_advance_search_shortcode( $atts ){ ob_start(); do_action('frozr_home_advance_search'); return ob_get_clean(); } add_shortcode( 'lazyeater_advance_search', 'frozr_home_advance_search_shortcode' );
MahmudHamid/LazyEater
includes/shortcodes.php
PHP
gpl-3.0
1,198
----------------------------------- -- Sonic Thrust -- Polearm weapon skill -- Skill Level: 300 -- Delivers an area attack. Damage varies with TP. -- Will stack with Sneak Attack. -- Element: None -- Modifiers: STR:40% DEX:40% -- 100%TP 200%TP 300%TP -- 3.00 3.7 4.50 ----------------------------------- require("scripts/globals/status") require("scripts/globals/settings") require("scripts/globals/weaponskills") ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {} params.numHits = 1 params.ftp100 = 3 params.ftp200 = 3.25 params.ftp300 = 3.5 params.str_wsc = 0.3 params.dex_wsc = 0.3 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0 params.crit100 = 0.0 params.crit200 = 0.0 params.crit300 = 0.0 params.canCrit = false params.acc100 = 0.0 params.acc200= 0.0 params.acc300= 0.0 params.atkmulti = 1 if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp200 = 3.7 params.ftp300 = 4.5 params.str_wsc = 0.4 params.dex_wsc = 0.4 end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, tp, primary, action, taChar, params) return tpHits, extraHits, criticalHit, damage end
m3rlin87/darkstar
scripts/globals/weaponskills/sonic_thrust.lua
Lua
gpl-3.0
1,337
namespace DungeonsAndCodeWizards { using System; using System.Linq; public class Engine { private DungeonMaster dungeonMaster; public Engine(DungeonMaster dungeonMaster) { this.dungeonMaster = dungeonMaster; } public bool IsGameOver() => dungeonMaster.IsGameOver(); public string GetStats() => dungeonMaster.GetStats(); public string ProcessCommand(string[] splitCommand) { string cmd = splitCommand[0]; string[] args = splitCommand.Skip(1).ToArray(); string output = null; try { switch (cmd) { case "JoinParty": output = dungeonMaster.JoinParty(args); break; case "AddItemToPool": output = dungeonMaster.AddItemToPool(args); break; case "PickUpItem": output = dungeonMaster.PickUpItem(args); break; case "UseItem": output = dungeonMaster.UseItem(args); break; case "UseItemOn": output = dungeonMaster.UseItemOn(args); break; case "GiveCharacterItem": output = dungeonMaster.GiveCharacterItem(args); break; case "GetStats": output = dungeonMaster.GetStats(); break; case "Attack": output = dungeonMaster.Attack(args); break; case "Heal": output = dungeonMaster.Heal(args); break; case "EndTurn": output = dungeonMaster.EndTurn(args); break; case "IsGameOver": output = dungeonMaster.IsGameOver().ToString(); break; } } catch (ArgumentException ex) { output = "Parameter Error: " + ex.Message; } catch (InvalidOperationException ex) { output = "Invalid Operation: " + ex.Message; } return output; } } }
martinmladenov/SoftUni-Solutions
CSharp OOP Basics/Exams/Exam - 18 March 2018/DungeonsAndCodeWizards/Engine.cs
C#
gpl-3.0
2,513
<HTML><HEAD><TITLE>game_start(++MatchID, ++Role, +Rules, ++StartClock, ++PlayClock, ++MsgReceiveTime)</TITLE> </HEAD><BODY>[ <A HREF="index.html">library(gameplayer)</A> | <A HREF="../index.html">General Game Player</A> | <A HREF="../fullindex.html">Alphabetic Index</A> ] <H1>game_start(++MatchID, ++Role, +Rules, ++StartClock, ++PlayClock, ++MsgReceiveTime)</H1> is called after receiving the start message of a match <DL> <DT><EM>MatchID</EM></DT> <DD>string containing the identifier of the current match </DD> <DT><EM>Role</EM></DT> <DD>the role name of this player </DD> <DT><EM>Rules</EM></DT> <DD>the game description as a list of prolog rules </DD> <DT><EM>StartClock</EM></DT> <DD>start clock in seconds </DD> <DT><EM>PlayClock</EM></DT> <DD>play clock in seconds </DD> <DT><EM>MsgReceiveTime</EM></DT> <DD>time when the message was received (in seconds since start of the process) </DD> </DL> <H2>Description</H2> game_start/6 must return before the start clock times out, i.e., before MsgReceiveTime+StartClock-{Time for sending messages} <H3>Fail Conditions</H3> None. Always succeed. <H3>Resatisfiable</H3> no <H2>See Also</H2> <A HREF="../gameplayer/game_start_timed_part-2.html">game_start_timed_part / 2</A>, <A HREF="../gameplayer/game_play-4.html">game_play / 4</A>, <A HREF="../gameplayer/game_stop-3.html">game_stop / 3</A> </BODY></HTML>
AlexLandau/fluxplayer-prolog-engine
doc/gameplayer/game_start-6.html
HTML
gpl-3.0
1,360
module GPGME class Key # Overwrite to specify the full fingerprint instead of the short key-ID. def to_s primary_subkey = subkeys[0] s = sprintf("%s %4d%s/%s %s\n", primary_subkey.secret? ? 'sec' : 'pub', primary_subkey.length, primary_subkey.pubkey_algo_letter, primary_subkey.fingerprint, primary_subkey.timestamp.strftime('%Y-%m-%d')) uids.each do |user_id| s << "uid\t\t#{user_id.name} <#{user_id.email}>\n" end subkeys.each do |subkey| s << subkey.to_s end s end def generated_at primary_subkey.timestamp end def expired? expired.present? end def summary @summary ||= begin datefmt = '%Y-%m-%d' attribs = [ "0x#{fingerprint}", email, generated_at.strftime(datefmt) ] if usability_issue.present? case usability_issue when :expired attribs << "[expired: #{expires.strftime(datefmt)}]" when :revoked # TODO: add revocation date when it's available. attribs << '[revoked]' else attribs << "[#{usability_issue}]" end end if expires? && ! expired? attribs << "[expires: #{expires.strftime(datefmt)}]" end attribs.join(' ') end end def armored "#{self.to_s}\n\n#{export(armor: true).read}" end def minimal export(minimal: true).to_s end # Force encoding, some databases save "ASCII-8BIT" as binary data. alias_method :orig_fingerprint, :fingerprint def fingerprint orig_fingerprint.encode(Encoding::US_ASCII) end def usable? usability_issue.blank? end def usability_issue if trust.present? trust elsif ! usable_for?(:encrypt) 'not capable of encryption' else nil end end def self.valid_fingerprint?(fp) fp =~ Schleuder::Conf::FINGERPRINT_REGEXP end end end
schleuder/schleuder3
lib/schleuder/gpgme/key.rb
Ruby
gpl-3.0
2,167
#!/usr/bin/env python # Copyright (C) 2012,2013,2015(H),2016 # Max Planck Institute for Polymer Research # Copyright (C) 2008,2009,2010,2011 # Max-Planck-Institute for Polymer Research & Fraunhofer SCAI # # This file is part of ESPResSo++. # # ESPResSo++ is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ESPResSo++ is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import argparse import math import re def convertTable(gro_in_file, esp_out_file, sigma=1.0, epsilon=1.0, c6=1.0, c12=1.0): """Convert GROMACS tabulated file into ESPResSo++ tabulated file (new file is created). First column of input file can be either distance or angle. For non-bonded files, c6 and c12 can be provided. Default value for sigma, epsilon, c6 and c12 is 1.0. Electrostatics are not taken into account (f and fd columns). Keyword arguments: gro_in_file -- the GROMACS tabulated file name (bonded, nonbonded, angle or dihedral). esp_out_file -- filename of the ESPResSo++ tabulated file to be written. sigma -- optional, depending on whether you want to convert units or not. epsilon -- optional, depending on whether you want to convert units or not. c6 -- optional c12 -- optional """ # determine file type bonded, angle, dihedral = False, False, False re_bond = re.compile('.*_b[0-9]+.*') re_angle = re.compile('.*_a[0-9]+.*') re_dihedral = re.compile('.*_d[0-9]+.*') if re.match(re_bond, gro_in_file): bonded = True elif re.match(re_angle, gro_in_file): angle = True bonded = True elif re.match(re_dihedral, gro_in_file): dihedral = True bonded = True fin = open(gro_in_file, 'r') fout = open(esp_out_file, 'w') if bonded: # bonded has 3 columns for line in fin: if line[0] == "#": # skip comment lines continue columns = line.split() r = float(columns[0]) f = float(columns[1]) # energy fd= float(columns[2]) # force # convert units if angle or dihedral: # degrees to radians r = math.radians(r) fd=fd*180/math.pi else: r = r / sigma e = f / epsilon f = fd*sigma / epsilon if (not angle and not dihedral and r != 0) or \ (angle and r <= math.pi and r > 0) or \ (dihedral and r >= -math.pi and r <= math.pi): fout.write("%15.8g %15.8g %15.8g\n" % (r, e, f)) else: # non-bonded has 7 columns for line in fin: if line.startswith('#'): # skip comment lines continue columns = line.split() r = float(columns[0]) g = float(columns[3]) # dispersion gd= float(columns[4]) h = float(columns[5]) # repulsion hd= float(columns[6]) e = c6*g + c12*h f = c6*gd+ c12*hd # convert units r = r / sigma e = e / epsilon f = f*sigma / epsilon if r != 0: # skip 0 fout.write("%15.8g %15.8g %15.8g\n" % (r, e, f)) fin.close() fout.close() def _args(): parser = argparse.ArgumentParser() parser.add_argument('in_file') parser.add_argument('out_file') return parser def main(): args = _args().parse_args() convertTable(args.in_file, args.out_file) if __name__ == '__main__': main()
cgchemlab/chemlab
tools/convert_gromacs2espp.py
Python
gpl-3.0
4,036
ERROR: type should be string, got "\n\nhttps://www.google.com/ncr\n"
xuemzhan/Memo
工具相关/翻墙.md
Markdown
gpl-3.0
29
package engine.frontend; import java.awt.Graphics2D; /** * * @author Thomas Hayden * @version 6/02/16 */ public class RenderableOval implements Renderable { private int x; private int y; private int width; private int height; private int level; /** * A RenderableOval is a class which will render an oval to the screen * @param x the x coordinate of the oval * @param y the y coordinate of the oval * @param width the width of the oval * @param height the height of the oval */ public RenderableOval(int x, int y, int width, int height, int level) { this.x = x; this.y = y; this.width = width; this.height = height; this.level = level; } /** * Render the oval to the screen using the given graphics object */ public void render(Graphics2D g2d) { g2d.drawOval(x, y, width, height); } public int getLevel() { return level; } }
SupremeSteak1/Wiley---Game-Engine
src/engine/frontend/RenderableOval.java
Java
gpl-3.0
882
package WWW::RottenTomatoes; use URI::Escape; use Carp qw{croak}; use base qw{LWP::UserAgent}; use JSON; our $VERSION = "1.004"; $VERSION = eval $VERSION; sub new { my ( $class, %opts ) = @_; if ( !$opts{token} ) { croak "method 'new' requires a valid token(key)"; } my $self = $class->SUPER::new; $self{token} = $opts{token}; $self{valid} = 'true' unless $self{valid} = 'false'; $self{host} = 'http://api.rottentomatoes.com/api/public/v1.0'; $self->agent("perl-WWW-RottenTomatoes/$VERSION"); return bless $self, $class; } sub DESTROY { } sub AUTOLOAD { my ( $self, %opts ) = @_; my $name = our $AUTOLOAD; $name =~ s/.*://; # parameter validation (on by default) if ( $self{valid} eq 'true' ) { use WWW::RottenTomatoes::Constants; my %params = WWW::RottenTomatoes::Constants->params; # validate method name exists croak "$name is not a valid method name" unless exists $params{$name}; # validate option name exists foreach my $opt ( keys %opts ) { croak "$opt is not a valid method parameter" unless exists $params{$name}{$opt}; } # validate required option(s) exist, and not empty foreach my $req ( keys %{ $params{$name} } ) { next if $name !~ m/^movies_/; if ( $params{$name}{$req} == 1 ) { croak "$req is a required method parameter" unless defined $opts{$req} && length $opts{$req}; } } } # begin to build url based on end points (movie, DVD, info, lists) my $url; if ( $name =~ m/^.*_movies$/ ) { $name =~ s/_movies//; $url = "/lists/movies/$name.json"; } elsif ( $name =~ m/^.*_dvd_.*$/ ) { $name =~ s/_dvd_//; if ( $name =~ m/^upcoming/ ) { $url = '/lists/DVDs/upcoming.json'; } else { $url = "/lists/DVDs/$name.json"; } } elsif ( $name =~ m/^movies_.*$/ ) { $name =~ s/^movies_//; if ( $name eq 'search' ) { $url = '/movies.json'; } elsif ( $name eq 'alias' ) { $url = '/movie_alias.json'; } elsif ( $name eq 'info' ) { $url = "/movies/$opts{movie_id}.json"; } else { $url = "/movies/$opts{movie_id}/$name.json"; } } else { $name = s/_.*//; if ( $name eq 'lists' ) { $url = '/lists.json'; } else { $url = "/lists/$name.json"; } } # continue to build and add key/values pairs to url $url = $self{host} . $url . "?apikey=$self{token}"; while ( my ( $key, $value ) = each(%opts) ) { if ( $key eq 'q' ) { $value = uri_escape($value); } $url .= "&$key=$value"; } # url complete, make http request. report accordingly my $response = $self->get($url); if ( $response->is_success ) { return eval { decode_json $response->decoded_content }; } else { croak "error: $response->status_line"; } } 1; __END__ =head1 NAME WWW::RottenTomatoes - A Perl interface to the Rotten Tomatoes API =head1 VERSION Version 1.04 =head1 SYNPOSIS use WWW::RottenTomatoes; my $rt = WWW::RottenTomatoes->new( token => 'f@k3ap!tok3n', valid => 'false' ); $rt->movies_search( q => 'The Goonies' ); =head1 DESCRIPTION This module is intended to provide an interface between Perl and the Rotten Tomatoes JSON API. The Rotten Tomatoes API is a RESTful web service. In order to use this library you must provide an api key which requires registration. For more information please see http://developer.rottentomatoes.com =head1 CONSTRUCTOR =head2 new() Creates and returns a new WWW::RottenTomatoes object my $rt = WWW::RottenTomatoes->new() =over 4 =item * C<< token => [<token>] >> The token parameter is required. You must provide a valid token/key. =item * C<< valid => [true] >> This parameter allows you to turn off parameter checking. It currently defaults to 'true' and must be set to 'false' in order to be disabled. The validator checks for method name, method constructor name, and the required constructors of the given method. The validator will also ensure required constructors are not blank or empty. The validator does not check type. =back =head1 SUBROUTINES/METHODS The following subroutine/methods documentation corresponds with the official api documentation. =head2 $obj->box_office_movies(...) Displays top box office earning movies, sorted by most recent weekend gross ticket sales $obj->box_office_movies( limit => 5, country => 'uk' ); * B< limit > S< integer, required: false, default: 16> Limits the number of box office movies returned * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->in_theatre_movies(...) Retrieves movies currently in theaters $obj->in_theatre_movies( page_limit => 10, page => 5, country => 'ca' ); * B< page_limit > S< integer, required: false, default: 16> The amount of movies in theaters to show per page * B< page > S< integer, required: false, default: 1> The selected page of in theaters movies * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->opening_movies(...) Retrieves current opening movies $obj->opening_movies( limit => 5, country => 'mx' ); * B< limit > S< integer, required: false, default: 16> Limits the number of opening movies returned * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->upcoming_movies(...) Retrieves upcoming movies. Results are paginated if they go past the specified page limit $obj->upcoming_movies( page_limit => 5, page => 2, country => 'br' ); * B< page_limit > S< integer, required: false, default: 16> The amount of upcoming movies to show per page * B< page > S< integer, required: false, default: 1> The selected page of in theaters movies * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->top_dvd_rentals(...) Retrieves the current top DVD rentals $obj->top_dvd_rentals( limit => 5, country => 'au' ); * B< limit > S< integer, required: false, default: 10> Limits the number of top rentals returned * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->current_dvd_releases(...) Retrieves current release DVDs. Results are paginated if they go past the specified page limit $obj->current_dvd_releases( page_limit => 3, page => 1, country => 'in' ); * B< page_limit > S< integer, required: false, default: 16> The amount of current release DVDs to show per page * B< page > S< integer, required: false, default: 1> The selected page of current DVD releases * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->new_dvd_releases(...) Retrieves new release DVDs. Results are paginated if they go past the specified page limit. $obj->new_dvd_releases( page_limit => 1, page => 5, country => 'cn' ); * B< page_limit > S< integer, required: false, default: 16> The amount of new release DVDs to show per page * B< page > S< integer, required: false, default: 1> The selected page of new DVD releases * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->upcoming_dvd_releases(...) Retrieves upcoming dvds. Results are paginated if they go past the specified page limit $obj->upcoming_dvd_releases( page_limit => 20, page => 7, country => 'jp' ); * B< page_limit > S< integer, required: false, default: 16> The amount of upcoming DVDs to show per page * B< page > S< integer, required: false, default: 1> The selected page of upcoming DVD releases * B< country > S< string, required: false, default: "us"> Provides localized data for the selected country (ISO 3166-1 alpha-2) if available. Otherwise, returns US data =head2 $obj->movies_info(...) Detailed information on a specific movie specified by Id. You can use the movies search endpoint or peruse the lists of movies/dvds to get the urls to movies. $obj->movies_info( id => 770672122 ); * B< id > S< integer, required: true> The movie identification number =head2 $obj->movies_cast(...) Pulls the complete movie cast for a movie $obj->movies_cast( id => 770672122 ); * B< id > S< integer, required: true> The movie identification number =head2 $obj->movies_clips(...) Related movie clips and trailers for a movie $obj->movies_clips( id => 770672122 ); * B< id > S< integer, required: true> The movie identification number =head2 $obj->movies_reviews(...) Retrieves the reviews for a movie. Results are paginated if they go past the specified page limit $obj->movie_reviews( id => 770672122, review_type => 'dvd', page_limit => 1, page => 5, country => 'us' ); * B< id > S< integer, required: true> The movie identification number * B< review_type > S< string, required: false, default: top_critic> 3 different review types are possible: "all", "top_critic" and "dvd". "top_critic" shows all the Rotten "top_critic" shows all the Rotten. "dvd" pulls the reviews given on the DVD of the movie. "all" as the name implies retrieves all reviews * B< page_limit > S< integer, required: false, default: 20> The amount of movie reviews to show per page * B< page > S< integer, required: false, default: 1> The selected page of movie reviews * B< country > S< string, required: false, default: "us"> provides localized data for selected country (ISO 3166-1 alpha-2) =head2 $obj->movies_similar(...) Shows similar movies for a movie. $obj->movies_similar( id => 770672122, limit => 1, ); * B< id > S< integer, required: true> The movie identification number * B< limit > S< integer, required: false, default: 5> Limit the number of similar movies to show =head2 $obj->movies_alias(...) Provides a movie lookup by an id from a different vendor. Only supports imdb lookup at this time $obj->movies_alias ( id => 9818, type => 'imdb', ); * B< id > S< integer, required: true> The movie identification number * B< type > S< string, required: true> alias type you want to look up - only imdb is supported at this time =head2 $obj->movies_search(...) The movies search endpoint for plain text queries. Allows you to search for movies! $obj->movies_search( q => 'The Goonies' page_limit => 20, page => 7, ); * B< q > S< string, required: true> The plain text search query to search for a movie (url encoded for you) * B< page_limit > S< integer, required: false, default: 30> The amount of upcoming DVDs to show per page * B< page > S< integer, required: false, default: 1> The selected page of upcoming DVD releases =head2 $obj->lists_directory Displays the top level lists available in the API. Currently movie lists and dvd lists available $obj->lists_directory; no parameters required =head2 $obj->movie_lists_directory Shows the movie lists vailable $obj->movie_lists_directory; no parameters required =head2 $obj->dvd_lists_directory Shows the DVD lists available $obj->dvd_list_directory; no parameters required =head1 DIAGNOSTICS N/A at the current point in time =head1 CONFIGURATION AND ENVIRONMENT This package does not make usage of any code or modules considered OS specific and no special configuration and or configuration files are needed. In order to use this package you must provide an api token/key and be able to reach the Rotten Tomatoes API url. =head1 INCOMPATIBILITIES This package is intended to be compatible with Perl 5.008 and beyond. =head1 BUGS AND LIMITATIONS Current limitations exist in the amount of http requests that can be made against the API. The scope of this limitation exists outside of the code base. =head1 DEPENDENCIES B<Carp>, B<JSON>, B<LWP::UserAgent>, B<URI::Escape> =head1 SEE ALSO B<http://developer.rottentomatoes.com/docs> You may notice differences in the required parameters of this script and the documentation. The differences are typically stop gaps to prevent the API from returning with errors and or empty/wrong results. This is present in methods that require movie id's and the search method which requires a plain text query. =head1 SUPPORT The module is provided free of support however feel free to contact the author or current maintainer with questions, bug reports, and patches. Considerations will be taken when making changes to the API. Any changes to its interface will go through at the least one deprecation cycle. =head1 LICENSE AND COPYRIGHT Copyright (c) 2011 Casey W. Vega. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 Author Casey Vega <cvega@cpan.org>
cvega/WWW-RottenTomatoes-Perl
lib/WWW/RottenTomatoes.pm
Perl
gpl-3.0
14,159
function createView(a){var b={items:[],pages:[],additionalData:[],limit:pagination.itemsPerPage,offset:0,sortBy:a.sortBy||"",sortDirection:a.sortDirection||"ASC",currentPage:1,itemsCount:0,itemType:a.itemType,url:a.url,dependencies:a.dependencies},c=new Vue({el:"#"+a.el,data:b,methods:{update:function(a){updateView(this,a)},afterUpdate:function(a){this.$on("iloaded",function(){Vue.nextTick(a)})},afterLoad:function(a){this.$once("iloaded",function(){Vue.nextTick(a)})}}}),d=a.url;a.sortBy&&(d+="&sortBy="+ a.sortBy);a.sortDirection&&(d+="&sortDirection="+a.sortDirection);var e=new ajaxRequest(d,a.el,function(){var a=JSON.parse(e.request.responseText);b.items=a.items;b.itemsCount=a.count;void 0!=a.additionalData&&(b.additionalData=a.additionalData);a=pagination.listPages(a.count);b.pages=a;c.$emit("iloaded")});e.sendRequest();return c} function updateView(a,b){void 0===b&&(b=!0);var c=a.url;0<a.limit&&(c+="&limit="+a.limit);0<a.offset&&(c+="&offset="+a.offset);a.sortBy&&(c+="&sortBy="+a.sortBy);a.sortDirection&&(c+="&sortDirection="+a.sortDirection);var d=new ajaxRequest(c,a.$el.id,function(){var c=JSON.parse(d.request.responseText);Vue.set(a,"items",c.items);void 0!=c.additionalData&&Vue.set(a,"additionalData",c.additionalData);Vue.set(a,"pages",pagination.listPages(c.count));a.$emit("iloaded");if(1==b&&(c=a.$get("dependencies"), 0<c.length))for(var f=0;f<c.length;f++)Vue.set(c[f],"limit",a.limit),Vue.set(c[f],"offset",a.offset),updateView(c[f],!0)});d.sendRequest()}function sortView(a,b,c){a.sortBy=b;a.sortDirection="ASC"==a.sortDirection?"DESC":"ASC";a.update(!0)} var pagination={itemsPerPage:15,listPages:function(a){a=Math.ceil(a/this.itemsPerPage);for(var b=[],c=0;c<a;c++){var d=c+1;b.push({index:d,limit:d*this.itemsPerPage})}return b},loadPage:function(a,b){var c=b*this.itemsPerPage-this.itemsPerPage;Vue.set(a,"limit",this.itemsPerPage);Vue.set(a,"offset",c);Vue.set(a,"currentPage",b);a.update(!0)},loadNextPage:function(a){var b=a.$get("currentPage"),c=Math.ceil(a.$get("itemsCount")/this.itemsPerPage),b=b+1;b>c&&(b=c);this.loadPage(a,b)},loadPrevPage:function(a){var b= a.$get("currentPage")-1;1>b&&(b=1);this.loadPage(a,b)},limitPagesDisplayed:function(a,b){return 1==a.index||2==a.index||a.index==b.length/2||currentPage==a.index||a.index==b.length-1||a.index==b.length}}; function submitForm(a){var b=a.currentTarget,c=b.action,d=validateCompleteForm(b);a.stopPropagation();a.preventDefault();if(1==d){a="";for(d=0;d<b.elements.length;d++){var e=b.elements[d];if(void 0!=e.attributes.multiple){for(var f="",h=0;h<e.options.length;h++){var k=e.options[h];k.selected&&(f+="&"+e.name+"="+encodeURIComponent(k.value))}""!=f&&(a+=f)}else void 0!=e.value&&(a+="&"+e.name+"="+encodeURIComponent(e.value))}var g=new ajaxRequest(c,"",function(){var a=g.request.responseText;if("ok"== a){formView.update(formView.doUpdate?!0:!1);systemMessage.added(formView.$get("itemType"));try{formSubmited()}catch(l){}}else console.log(a)});g.requestType="POST";g.postBody=a;g.sendRequest()}}function startWait(a){cssId(a).style.display="block"}function stopWait(a){cssId(a).style.display="none"}closeEndcolor="#377814";deleteEndcolor="#c62424";function confirmDelete(a,b,c,d){1==confirm(a)&&deleteElement(b,c,d)} function deleteElement(a,b,c){var d=new ajaxRequest(b,"",function(){"ok"==d.request.responseText?(removeRow(a,deleteEndcolor),void 0!=c&&(c.update(),systemMessage.deleted(c.$get("itemType")))):console.log(d.request.responseText)});d.sendRequest()}function closeElement(a,b,c){var d=new ajaxRequest(b,"",function(){"ok"==d.request.responseText&&(removeRow(a,closeEndcolor),void 0!=c&&(c.update(),systemMessage.closed(c.$get("itemType"))))});d.sendRequest()} function removeRow(a,b){var c=cssId(a);null!=c&&(c.style.backgroundColor="#FFFFFF",Velocity(c,{backgroundColor:b,backgroundColorAlpha:.6,colorAlpha:.6},{complete:function(){Velocity(c,"fadeOut",{delay:1500,duration:2500})}}))}Vue.filter("truncate",function(a,b){return a.length>=b?a.substr(0,b)+"...":a});
philippK-de/Collabtive
include/js/viewManager.min.js
JavaScript
gpl-3.0
3,995
var bfrequire = require('../../node_modules/node-brainfuckex/').require; process.chdir('../../'); bfrequire('bt.bf')(['samples/hellowhat/hw.tpl', 'World', 'Foo']);
Yuuji/bf-templates
samples/hellowhat/run.js
JavaScript
gpl-3.0
164
using CP77.CR2W.Reflection; using FastMember; using static CP77.CR2W.Types.Enums; namespace CP77.CR2W.Types { [REDMeta] public class scnCameraRid : CVariable { [Ordinal(0)] [RED("tag")] public scnRidTag Tag { get; set; } [Ordinal(1)] [RED("animations")] public CArray<scnCameraAnimationRid> Animations { get; set; } public scnCameraRid(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { } } }
Traderain/Wolven-kit
CP77.CR2W/Types/cp77/scnCameraRid.cs
C#
gpl-3.0
429
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2012.10.05 at 02:34:54 AM EEST // package ro.roda.ddi; import javax.xml.bind.JAXBElement; import javax.xml.bind.annotation.XmlElementDecl; import javax.xml.bind.annotation.XmlRegistry; import javax.xml.namespace.QName; /** * This object contains factory methods for each Java content interface and Java * element interface generated in the ddi122 package. * <p> * An ObjectFactory allows you to programatically construct new instances of the * Java representation for XML content. The Java representation of XML content * can consist of schema derived interfaces and classes representing the binding * of schema type definitions, element declarations and model groups. Factory * methods for each of these are provided in this class. * */ @XmlRegistry public class ObjectFactory { private final static QName _FileQntyTypeLink_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "Link"); private final static QName _FileQntyTypeExtLink_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "ExtLink"); private final static QName _NationTypeConcept_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "concept"); private final static QName _NationTypeTxt_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "txt"); private final static QName _CatStatTypeTable_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "table"); private final static QName _OthRefsTypeCitation_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "citation"); private final static QName _QstnTypeBackward_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "backward"); private final static QName _QstnTypeForward_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "forward"); private final static QName _QstnTypePreQTxt_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "preQTxt"); private final static QName _QstnTypePostQTxt_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "postQTxt"); private final static QName _QstnTypeQstnLit_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "qstnLit"); private final static QName _QstnTypeIvuInstr_QNAME = new QName( "http://www.icpsr.umich.edu/DDI", "ivuInstr"); /** * Create a new ObjectFactory that can be used to create new instances of * schema derived classes for package: ddi122 * */ public ObjectFactory() { } /** * Create an instance of {@link ItemType } * */ public ItemType createItemType() { return new ItemType(); } /** * Create an instance of {@link HoldingsType } * */ public HoldingsType createHoldingsType() { return new HoldingsType(); } /** * Create an instance of {@link SerStmtType } * */ public SerStmtType createSerStmtType() { return new SerStmtType(); } /** * Create an instance of {@link DataCollectorType } * */ public DataCollectorType createDataCollectorType() { return new DataCollectorType(); } /** * Create an instance of {@link SpecPermType } * */ public SpecPermType createSpecPermType() { return new SpecPermType(); } /** * Create an instance of {@link CitReqType } * */ public CitReqType createCitReqType() { return new CitReqType(); } /** * Create an instance of {@link NationType } * */ public NationType createNationType() { return new NationType(); } /** * Create an instance of {@link CopyrightType } * */ public CopyrightType createCopyrightType() { return new CopyrightType(); } /** * Create an instance of {@link VarFormatType } * */ public VarFormatType createVarFormatType() { return new VarFormatType(); } /** * Create an instance of {@link AbstractType } * */ public AbstractType createAbstractType() { return new AbstractType(); } /** * Create an instance of {@link CatStatType } * */ public CatStatType createCatStatType() { return new CatStatType(); } /** * Create an instance of {@link FileTxtType } * */ public FileTxtType createFileTxtType() { return new FileTxtType(); } /** * Create an instance of {@link TitlType } * */ public TitlType createTitlType() { return new TitlType(); } /** * Create an instance of {@link StdyInfoType } * */ public StdyInfoType createStdyInfoType() { return new StdyInfoType(); } /** * Create an instance of {@link DataDscrType } * */ public DataDscrType createDataDscrType() { return new DataDscrType(); } /** * Create an instance of {@link FundAgType } * */ public FundAgType createFundAgType() { return new FundAgType(); } /** * Create an instance of {@link ValrngType } * */ public ValrngType createValrngType() { return new ValrngType(); } /** * Create an instance of {@link TopcClasType } * */ public TopcClasType createTopcClasType() { return new TopcClasType(); } /** * Create an instance of {@link FileNameType } * */ public FileNameType createFileNameType() { return new FileNameType(); } /** * Create an instance of {@link DocSrcType } * */ public DocSrcType createDocSrcType() { return new DocSrcType(); } /** * Create an instance of {@link IDNoType } * */ public IDNoType createIDNoType() { return new IDNoType(); } /** * Create an instance of {@link ProdDateType } * */ public ProdDateType createProdDateType() { return new ProdDateType(); } /** * Create an instance of {@link StdyDscrType } * */ public StdyDscrType createStdyDscrType() { return new StdyDscrType(); } /** * Create an instance of {@link DocDscrType } * */ public DocDscrType createDocDscrType() { return new DocDscrType(); } /** * Create an instance of {@link OthIdType } * */ public OthIdType createOthIdType() { return new OthIdType(); } /** * Create an instance of {@link AuthEntyType } * */ public AuthEntyType createAuthEntyType() { return new AuthEntyType(); } /** * Create an instance of {@link RspStmtType } * */ public RspStmtType createRspStmtType() { return new RspStmtType(); } /** * Create an instance of {@link SoftwareType } * */ public SoftwareType createSoftwareType() { return new SoftwareType(); } /** * Create an instance of {@link OrigArchType } * */ public OrigArchType createOrigArchType() { return new OrigArchType(); } /** * Create an instance of {@link CitationType } * */ public CitationType createCitationType() { return new CitationType(); } /** * Create an instance of {@link VerRespType } * */ public VerRespType createVerRespType() { return new VerRespType(); } /** * Create an instance of {@link OthrStdyMatType } * */ public OthrStdyMatType createOthrStdyMatType() { return new OthrStdyMatType(); } /** * Create an instance of {@link SampProcType } * */ public SampProcType createSampProcType() { return new SampProcType(); } /** * Create an instance of {@link SourcesType } * */ public SourcesType createSourcesType() { return new SourcesType(); } /** * Create an instance of {@link SumDscrType } * */ public SumDscrType createSumDscrType() { return new SumDscrType(); } /** * Create an instance of {@link VersionType } * */ public VersionType createVersionType() { return new VersionType(); } /** * Create an instance of {@link FileDscrType } * */ public FileDscrType createFileDscrType() { return new FileDscrType(); } /** * Create an instance of {@link FileTypeType } * */ public FileTypeType createFileTypeType() { return new FileTypeType(); } /** * Create an instance of {@link GrantNoType } * */ public GrantNoType createGrantNoType() { return new GrantNoType(); } /** * Create an instance of {@link SerInfoType } * */ public SerInfoType createSerInfoType() { return new SerInfoType(); } /** * Create an instance of {@link LocationType } * */ public LocationType createLocationType() { return new LocationType(); } /** * Create an instance of {@link AnlyUnitType } * */ public AnlyUnitType createAnlyUnitType() { return new AnlyUnitType(); } /** * Create an instance of {@link GeogCoverType } * */ public GeogCoverType createGeogCoverType() { return new GeogCoverType(); } /** * Create an instance of {@link BiblCitType } * */ public BiblCitType createBiblCitType() { return new BiblCitType(); } /** * Create an instance of {@link CollDateType } * */ public CollDateType createCollDateType() { return new CollDateType(); } /** * Create an instance of {@link KeywordType } * */ public KeywordType createKeywordType() { return new KeywordType(); } /** * Create an instance of {@link AltTitlType } * */ public AltTitlType createAltTitlType() { return new AltTitlType(); } /** * Create an instance of {@link WeightType } * */ public WeightType createWeightType() { return new WeightType(); } /** * Create an instance of {@link TimePrdType } * */ public TimePrdType createTimePrdType() { return new TimePrdType(); } /** * Create an instance of {@link PType } * */ public PType createPType() { return new PType(); } /** * Create an instance of {@link ProdPlacType } * */ public ProdPlacType createProdPlacType() { return new ProdPlacType(); } /** * Create an instance of {@link DistrbtrType } * */ public DistrbtrType createDistrbtrType() { return new DistrbtrType(); } /** * Create an instance of {@link VerStmtType } * */ public VerStmtType createVerStmtType() { return new VerStmtType(); } /** * Create an instance of {@link DepDateType } * */ public DepDateType createDepDateType() { return new DepDateType(); } /** * Create an instance of {@link AccsPlacType } * */ public AccsPlacType createAccsPlacType() { return new AccsPlacType(); } /** * Create an instance of {@link DistStmtType } * */ public DistStmtType createDistStmtType() { return new DistStmtType(); } /** * Create an instance of {@link DeposReqType } * */ public DeposReqType createDeposReqType() { return new DeposReqType(); } /** * Create an instance of {@link DepositrType } * */ public DepositrType createDepositrType() { return new DepositrType(); } /** * Create an instance of {@link DataCollType } * */ public DataCollType createDataCollType() { return new DataCollType(); } /** * Create an instance of {@link CaseQntyType } * */ public CaseQntyType createCaseQntyType() { return new CaseQntyType(); } /** * Create an instance of {@link TitlStmtType } * */ public TitlStmtType createTitlStmtType() { return new TitlStmtType(); } /** * Create an instance of {@link GeogUnitType } * */ public GeogUnitType createGeogUnitType() { return new GeogUnitType(); } /** * Create an instance of {@link DataAccsType } * */ public DataAccsType createDataAccsType() { return new DataAccsType(); } /** * Create an instance of {@link VarQntyType } * */ public VarQntyType createVarQntyType() { return new VarQntyType(); } /** * Create an instance of {@link LablType } * */ public LablType createLablType() { return new LablType(); } /** * Create an instance of {@link SetAvailType } * */ public SetAvailType createSetAvailType() { return new SetAvailType(); } /** * Create an instance of {@link UniverseType } * */ public UniverseType createUniverseType() { return new UniverseType(); } /** * Create an instance of {@link CatgryType } * */ public CatgryType createCatgryType() { return new CatgryType(); } /** * Create an instance of {@link TxtType } * */ public TxtType createTxtType() { return new TxtType(); } /** * Create an instance of {@link MethodType } * */ public MethodType createMethodType() { return new MethodType(); } /** * Create an instance of {@link DimensnsType } * */ public DimensnsType createDimensnsType() { return new DimensnsType(); } /** * Create an instance of {@link ResInstruType } * */ public ResInstruType createResInstruType() { return new ResInstruType(); } /** * Create an instance of {@link SumStatType } * */ public SumStatType createSumStatType() { return new SumStatType(); } /** * Create an instance of {@link RangeType } * */ public RangeType createRangeType() { return new RangeType(); } /** * Create an instance of {@link DisclaimerType } * */ public DisclaimerType createDisclaimerType() { return new DisclaimerType(); } /** * Create an instance of {@link SerNameType } * */ public SerNameType createSerNameType() { return new SerNameType(); } /** * Create an instance of {@link QstnLitType } * */ public QstnLitType createQstnLitType() { return new QstnLitType(); } /** * Create an instance of {@link SubjectType } * */ public SubjectType createSubjectType() { return new SubjectType(); } /** * Create an instance of {@link ProducerType } * */ public ProducerType createProducerType() { return new ProducerType(); } /** * Create an instance of {@link CollModeType } * */ public CollModeType createCollModeType() { return new CollModeType(); } /** * Create an instance of {@link RelMatType } * */ public RelMatType createRelMatType() { return new RelMatType(); } /** * Create an instance of {@link CodeBook } * */ public CodeBook createCodeBook() { return new CodeBook(); } /** * Create an instance of {@link TimeMethType } * */ public TimeMethType createTimeMethType() { return new TimeMethType(); } /** * Create an instance of {@link InvalrngType } * */ public InvalrngType createInvalrngType() { return new InvalrngType(); } /** * Create an instance of {@link ContactType } * */ public ContactType createContactType() { return new ContactType(); } /** * Create an instance of {@link UseStmtType } * */ public UseStmtType createUseStmtType() { return new UseStmtType(); } /** * Create an instance of {@link OtherMatType } * */ public OtherMatType createOtherMatType() { return new OtherMatType(); } /** * Create an instance of {@link CatValuType } * */ public CatValuType createCatValuType() { return new CatValuType(); } /** * Create an instance of {@link ParTitlType } * */ public ParTitlType createParTitlType() { return new ParTitlType(); } /** * Create an instance of {@link VarType } * */ public VarType createVarType() { return new VarType(); } /** * Create an instance of {@link ProdStmtType } * */ public ProdStmtType createProdStmtType() { return new ProdStmtType(); } /** * Create an instance of {@link QstnType } * */ public QstnType createQstnType() { return new QstnType(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = NationType.class) public JAXBElement<TxtType> createNationTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, NationType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = SampProcType.class) public JAXBElement<TxtType> createSampProcTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, SampProcType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = AnlyUnitType.class) public JAXBElement<TxtType> createAnlyUnitTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, AnlyUnitType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = GeogCoverType.class) public JAXBElement<TxtType> createGeogCoverTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, GeogCoverType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = GeogUnitType.class) public JAXBElement<TxtType> createGeogUnitTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, GeogUnitType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = UniverseType.class) public JAXBElement<TxtType> createUniverseTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, UniverseType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = ResInstruType.class) public JAXBElement<TxtType> createResInstruTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, ResInstruType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = CollModeType.class) public JAXBElement<TxtType> createCollModeTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, CollModeType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link CitationType } * {@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "citation", scope = RelMatType.class) public JAXBElement<CitationType> createRelMatTypeCitation(CitationType value) { return new JAXBElement<CitationType>(_OthRefsTypeCitation_QNAME, CitationType.class, RelMatType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link TxtType }{@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "txt", scope = TimeMethType.class) public JAXBElement<TxtType> createTimeMethTypeTxt(TxtType value) { return new JAXBElement<TxtType>(_NationTypeTxt_QNAME, TxtType.class, TimeMethType.class, value); } /** * Create an instance of {@link JAXBElement }{@code <}{@link QstnLitType } * {@code >} * */ @XmlElementDecl(namespace = "http://www.icpsr.umich.edu/DDI", name = "qstnLit", scope = QstnType.class) public JAXBElement<QstnLitType> createQstnTypeQstnLit(QstnLitType value) { return new JAXBElement<QstnLitType>(_QstnTypeQstnLit_QNAME, QstnLitType.class, QstnType.class, value); } }
cosminrentea/roda
src/main/java/ro/roda/ddi/ObjectFactory.java
Java
gpl-3.0
19,407
package com.zhonghuasheng.spring4.aop; import org.springframework.stereotype.Service; @Service public class NoAnnotationUserService { public void register(User user) { System.out.println(user.toString()); } }
zhonghuasheng/JAVA
spring4/src/main/java/com/zhonghuasheng/spring4/aop/NoAnnotationUserService.java
Java
gpl-3.0
239
/* * Nightfall - Real-time strategy game * * Copyright (c) 2008 Marcus Klang, Alexander Toresson and Leonard Wickmark * * This file is part of Nightfall. * * Nightfall is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Nightfall is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Nightfall. If not, see <http://www.gnu.org/licenses/>. */ #include "matrix4x4.h" #include "vector3d.h" #include <cmath> namespace Utilities { Matrix4x4::Matrix4x4() { Identity(); } Matrix4x4::Matrix4x4(float matrix[4][4]) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { this->matrix[i][j] = matrix[i][j]; } } } Matrix4x4::~Matrix4x4() { } Matrix4x4& Matrix4x4::operator =(const Matrix4x4& a) { Set(a.matrix); return *this; } void Matrix4x4::Identity() { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { matrix[i][j] = i == j ? 1.0f : 0.0f; } } } void Matrix4x4::Zero() { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { matrix[i][j] = 0.0f; } } } void Matrix4x4::Set(const float a[4][4]) { memcpy(this->matrix, a, sizeof(this->matrix)); } void Matrix4x4::MulBy(const Matrix4x4& a) { float newmat[4][4]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { newmat[j][i] = 0.0f; for (int q = 0; q < 4; q++) { newmat[j][i] += matrix[q][i] * a.matrix[j][q]; } } } Set(newmat); } Matrix4x4 Matrix4x4::operator *(const Matrix4x4& a) const { Matrix4x4 newmat = *this; newmat.MulBy(a); return newmat; } Vector3D Matrix4x4::operator *(const Vector3D& a) const { Vector3D newvec; newvec.x = a.x * matrix[0][0] + a.y * matrix[1][0] + a.z * matrix[2][0] + matrix[3][0]; newvec.y = a.x * matrix[0][1] + a.y * matrix[1][1] + a.z * matrix[2][1] + matrix[3][1]; newvec.z = a.x * matrix[0][2] + a.y * matrix[1][2] + a.z * matrix[2][2] + matrix[3][2]; return newvec; } Matrix4x4 Matrix4x4::TranslationMatrix(float x, float y, float z) { Matrix4x4 m; m.matrix[3][0] = x; m.matrix[3][1] = y; m.matrix[3][2] = z; return m; } Matrix4x4 Matrix4x4::ScaleMatrix(float x, float y, float z) { Matrix4x4 m; m.matrix[0][0] = x; m.matrix[1][1] = y; m.matrix[2][2] = z; return m; } Matrix4x4 Matrix4x4::RotateXMatrix(float radians) { Matrix4x4 m; float c = cos(-radians), s = sin(-radians); m.matrix[1][1] = c; m.matrix[1][2] = -s; m.matrix[2][1] = s; m.matrix[2][2] = c; return m; } Matrix4x4 Matrix4x4::RotateYMatrix(float radians) { Matrix4x4 m; float c = cos(-radians), s = sin(-radians); m.matrix[0][0] = c; m.matrix[0][2] = s; m.matrix[2][0] = -s; m.matrix[2][2] = c; return m; } Matrix4x4 Matrix4x4::RotateZMatrix(float radians) { Matrix4x4 m; float c = cos(-radians), s = sin(-radians); m.matrix[0][0] = c; m.matrix[0][1] = -s; m.matrix[1][0] = s; m.matrix[1][1] = c; return m; } Matrix4x4 Matrix4x4::RotateMatrix(float radians, float x, float y, float z) { Matrix4x4 m; float c = cos(-radians), s = sin(-radians), t = 1 - c; float tx = t * x, ty = t * y, tz = t * z; float txy = tx * y, txz = tx * z, tyz = ty * z; float sx = s * x, sy = s * y, sz = s * z; m.matrix[0][0] = tx * x + c; m.matrix[0][1] = txy - sz; m.matrix[0][2] = txz + sy; m.matrix[1][0] = txy + sz; m.matrix[1][1] = ty * y + c; m.matrix[1][2] = tyz - sx; m.matrix[2][0] = txz - sy; m.matrix[2][1] = tyz + sx; m.matrix[2][2] = tz * z + c; return m; } void Matrix4x4::Translate(float x, float y, float z) { MulBy(TranslationMatrix(x, y, z)); } void Matrix4x4::Translate(Vector3D v) { MulBy(TranslationMatrix(v.x, v.y, v.z)); } void Matrix4x4::RotateX(float radians) { MulBy(RotateXMatrix(radians)); } void Matrix4x4::RotateY(float radians) { MulBy(RotateYMatrix(radians)); } void Matrix4x4::RotateZ(float radians) { MulBy(RotateZMatrix(radians)); } void Matrix4x4::Rotate(float radians, float x, float y, float z) { MulBy(RotateMatrix(radians, x, y, z)); } void Matrix4x4::Rotate(float radians, Vector3D v) { MulBy(RotateMatrix(radians, v.x, v.y, v.z)); } void Matrix4x4::Scale(float x, float y, float z) { MulBy(ScaleMatrix(x, y, z)); } void Matrix4x4::Scale(float amount) { MulBy(ScaleMatrix(amount, amount, amount)); } void Matrix4x4::Scale(Vector3D v) { MulBy(ScaleMatrix(v.x, v.y, v.z)); } void Matrix4x4::Apply() { glLoadMatrixf((GLfloat*)matrix); } std::ostream& operator << (std::ostream& os, const Matrix4x4& a) { for (int i = 0; i < 4; i++) { os << (i ? " {" : "{{"); for (int j = 0; j < 4; j++) { std::cout << a.matrix[i][j]; os << (j == 3 ? "}" : ", "); } os << (i == 3 ? "}" : ",") << std::endl; } return os; } }
eulex/nightfall
src/matrix4x4.cpp
C++
gpl-3.0
5,265
<?php /*--------------------- / / forms.processor.php / / ---------------------*/ namespace modular\CMS\Forms; include("../../config/site-init.php"); use modular\CMS\Environment\EnvironmentHelper; use modular\CMS\Forms\Forms; use modular\CMS\Forms\FormFields; use modular\CMS\Forms\FormProcessor; use modular\CMS\Modules\Tags\Tags; use modular\CMS\Modules\Category\Category; use modular\CMS\Pages\Pages; use modular\CMS\Lib\flourish\fGrammar; use modular\CMS\Lib\flourish\fRequest; use modular\CMS\Lib\flourish\fSession; use modular\CMS\Lib\flourish\fURL; // Figure out where stuff is coming from $form_uid = fRequest::get('form_uid'); $referrer = fURL::get(); $object_uid = fRequest::get('obj'); $request_token = fRequest::get('request_token'); $form_request_token = fSession::get("request_token[" . $form_uid . "]"); // CSRF prevention token if($form_request_token === $request_token) { // Instantiate the controller $processor = new FormsProcessor($form_uid); // Get field names $column_list = $processor->getAllFields(); // Array to put the things in the things $data_array = array(); $exclusions = array( 'row_uid', 'page_uid', 'object_uid', 'form_uid', "row_id", "id", "uid", "row_created", "created", "status", 'object_cat_uid', 'object_tags_uid', "published", "sent", "emaildate", "row_viewed", "row_viewdate", "row_sent", "row_emaildate", "row_created", "row_updated", "row_published", "row_status" ); // Iterate through the columns list (each list item is an array) foreach($column_list as $column_array) { $column_name = str_replace($processor->prefix . '_', '', $column_array['Field']); if(!in_array(strtolower($column_name), $exclusions)) { $data_array[$column_name] = addslashes(strip_tags(fRequest::get($column_name))); $data_email = preg_match('/email/i', $data_array[$column_name]); } } $result = $processor->createNewRow($form_request_token, $data_array); if($result > 0) { // If the form is set to send a confirmation email, we'll send one.' if($processor->form_confirmation) { // Check to see if a confirmation email is provided, otherwise default to site default email. $recipient = isset($processor->form_confirmation_email) ? $processor->form_confirmation_email : EnvironmentHelper::$environmentDefaultEmail; // Send the confirmation email. $sendmail = $processor->sendConfirmationEmail($data_array, $recipient); // If email sends, update the DB row if($sendmail) { $processor->updateRowStatus(); } } // If the form is set to email the user a confirmation on submission, do so. // This requires an email field in the form (but so far, nothing to force that yet). if($processor->form_confirmation_user) { $processor->sendUserConfirmationEmail($data_array, $data_email); } } } else { $result = false; } header('Content-type: application/json'); echo json_encode($result); ?>
factorone/Modular-CMS
src/CMS/Forms/forms.processor.php
PHP
gpl-3.0
2,969
U8this::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. config.serve_static_assets = true config.static_cache_control = "public, max-age=3600" # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr end
csbrooks6/u8this
config/environments/test.rb
Ruby
gpl-3.0
1,560
Ext.define('Onlineshopping.onlineshopping.shared.shop.model.authentication.UserAccessLevelModel', { "extend": "Ext.data.Model", "fields": [{ "name": "primaryKey", "type": "string", "defaultValue": "" }, { "name": "userAccessLevelId", "type": "string", "defaultValue": "" }, { "name": "userAccessLevel", "type": "int", "defaultValue": "" }, { "name": "levelName", "type": "string", "defaultValue": "" }, { "name": "levelDescription", "type": "string", "defaultValue": "" }, { "name": "levelHelp", "type": "string", "defaultValue": "" }, { "name": "levelIcon", "type": "string", "defaultValue": "" }, { "name": "versionId", "type": "int", "defaultValue": "" }, { "name": "entityAudit", "reference": "EntityAudit" }, { "name": "primaryDisplay", "type": "string", "defaultValue": "" }] });
applifireAlgo/OnlineShopEx
onlineshopping/src/main/webapp/app/onlineshopping/shared/shop/model/authentication/UserAccessLevelModel.js
JavaScript
gpl-3.0
1,135
/* * Gamegine - Game compatibility API and creation library for Bukkit * Copyright (C) 2013-2014 Stealth2800 <stealth2800@stealthyone.com> * Website: <http://stealthyone.com/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.stealthyone.mcb.gamegine.players; import com.stealthyone.mcb.gamegine.api.Gamegine; import com.stealthyone.mcb.gamegine.api.games.Game; import com.stealthyone.mcb.gamegine.api.players.GamePlayer; import com.stealthyone.mcb.gamegine.api.players.PlayerManager.PlayerGameResponse; import lombok.RequiredArgsConstructor; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import java.util.UUID; @RequiredArgsConstructor public class GgPlayer implements GamePlayer { private final UUID playerUuid; public Player getPlayer() { return Bukkit.getPlayer(playerUuid); } @Override public UUID getUuid() { return playerUuid; } @Override public boolean isInGame() { return Gamegine.getInstance().getPlayerManager().isPlayerInGame(getPlayer()); } @Override public PlayerGameResponse setGame(Game game) { return Gamegine.getInstance().getPlayerManager().setPlayerGame(getPlayer(), game); } }
Gamegine/Gamegine
src/main/java/com/stealthyone/mcb/gamegine/players/GgPlayer.java
Java
gpl-3.0
1,817
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using CustomSteamTools.Utils; using Newtonsoft.Json; using UltimateUtil; using UltimateUtil.UserInteraction; namespace CustomSteamTools.Commands { [TradeCommand] public class CmdSettings : ITradeCommand { public string[] Aliases => new string[] { "settings", "options" }; public string Description => "Change or list the application settings."; public string RegistryName => "settings"; public string Syntax => "settings {list | settingName} [value]"; public void RunCommand(CommandHandler sender, List<string> args) { if (args.IsEmpty()) { VersatileIO.Error("Syntax: " + Syntax); return; } Type settingsType = typeof(Settings); List<PropertyInfo> props = new List<PropertyInfo>(); foreach (PropertyInfo p in settingsType.GetProperties()) { if (!p.HasAttribute<JsonIgnoreAttribute>()) { props.Add(p); } } if (args[0].EqualsIgnoreCase("list")) { VersatileIO.Success("Available Settings:"); foreach (PropertyInfo p in props) { object val = p.GetValue(Settings.Instance); VersatileIO.Info(" {0} ({1}): {2}", p.Name, p.PropertyType.Name, val.ToString()); SettingAttribute satt = p.GetCustomAttribute<SettingAttribute>(); if (satt != null) { VersatileIO.WriteLine(" - " + satt.Meaning, ConsoleColor.Gray); } } } else { PropertyInfo affectedProp = null; foreach (PropertyInfo p in props) { if (p.Name.EqualsIgnoreCase(args[0])) { affectedProp = p; } } if (affectedProp == null) { VersatileIO.Error("No setting found by the name {0}.", args[0]); return; } if (args.Count == 1) { object val = affectedProp.GetValue(Settings.Instance); VersatileIO.Info(" {0} ({1}): {2}", affectedProp.Name, affectedProp.PropertyType.Name, val.ToString()); SettingAttribute satt = affectedProp.GetCustomAttribute<SettingAttribute>(); if (satt != null) { VersatileIO.WriteLine(" - " + satt.Meaning, ConsoleColor.Gray); } } else { Type pType = affectedProp.PropertyType; try { object val = Convert.ChangeType(args[1], pType); affectedProp.SetValue(Settings.Instance, val); } catch (FormatException) { VersatileIO.Error("Invalid {0}: {1}.", pType.Name, args[1]); return; } catch (InvalidCastException) { VersatileIO.Error("Cannot convert from 'string' to '{0}'.", pType.Name); return; } } } } } }
einsteinsci/custom-steam-tools
CustomSteamTools/CustomSteamTools/Commands/CmdSettings.cs
C#
gpl-3.0
2,681
// ==UserScript== // @name GBI Ref App Styling // @namespace http://tampermonkey.net/ // @version 0.1 // @description try to take over the world! // @author You // @match https://ref.groupbycloud.com/* // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js // ==/UserScript== jQuery(document).ready(function ($) { 'use strict'; $('head').append('<link rel="stylesheet" type="text/css" href="https://rawgit.com/jatkinson10/tampermonkey/master/css/ref.groupbycloud.css">'); $('td[style]').removeAttr('style'); $('table').each(function (){ $(this).replaceWith( $(this).html() .replace(/<tbody/gi, "<section") .replace(/<tr/gi, "<div class='row'") .replace(/<\/tr>/gi, "</div>") .replace(/<td width="160" valign="top"/gi, "<div class='col _25'") .replace(/<\/td>/gi, "</div>") .replace(/<td/gi, "<div class='col'") .replace(/<\/td>/gi, "</div>") .replace(/<\/tbody/gi, "<\/section") ); }); });
jatkinson10/tampermonkey
js/ref.groupbycloud.com_tm.js
JavaScript
gpl-3.0
1,097
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_51) on Tue Aug 11 17:51:05 CDT 2015 --> <title>Uses of Class org.fhaes.fhrecorder.view.EventTable.Columns</title> <meta name="date" content="2015-08-11"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.fhaes.fhrecorder.view.EventTable.Columns"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/fhaes/fhrecorder/view/class-use/EventTable.Columns.html" target="_top">Frames</a></li> <li><a href="EventTable.Columns.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.fhaes.fhrecorder.view.EventTable.Columns" class="title">Uses of Class<br>org.fhaes.fhrecorder.view.EventTable.Columns</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">EventTable.Columns</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.fhaes.fhrecorder.view">org.fhaes.fhrecorder.view</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.fhaes.fhrecorder.view"> <!-- --> </a> <h3>Uses of <a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">EventTable.Columns</a> in <a href="../../../../../org/fhaes/fhrecorder/view/package-summary.html">org.fhaes.fhrecorder.view</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../org/fhaes/fhrecorder/view/package-summary.html">org.fhaes.fhrecorder.view</a> that return <a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">EventTable.Columns</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static <a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">EventTable.Columns</a></code></td> <td class="colLast"><span class="typeNameLabel">EventTable.Columns.</span><code><span class="memberNameLink"><a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html#valueOf-java.lang.String-">valueOf</a></span>(java.lang.String&nbsp;name)</code> <div class="block">Returns the enum constant of this type with the specified name.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">EventTable.Columns</a>[]</code></td> <td class="colLast"><span class="typeNameLabel">EventTable.Columns.</span><code><span class="memberNameLink"><a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html#values--">values</a></span>()</code> <div class="block">Returns an array containing the constants of this enum type, in the order they are declared.</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../org/fhaes/fhrecorder/view/EventTable.Columns.html" title="enum in org.fhaes.fhrecorder.view">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/fhaes/fhrecorder/view/class-use/EventTable.Columns.html" target="_top">Frames</a></li> <li><a href="EventTable.Columns.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
petebrew/fhaes
fhaes/Javadoc/org/fhaes/fhrecorder/view/class-use/EventTable.Columns.html
HTML
gpl-3.0
7,420
// ###################### | ############################################################# // CLASS ................ | SOFTWARE DEVELOPMENT CAPSTONE (C868) ........................ // ASSIGNMENT ........... | C# PERFORMANCE ASSESSMENT ................................... // TASK ................. | EZP1 TASK 2: SOFTWARE APPLICATION AND DOCUMENTATION ......... // ###################### | ############################################################# // WGU STUDENT .......... | Mark K Ewer ................................................. // STUDENT ID ........... | 001094518 ................................................... // DEGREE PROGRAM ....... | B.S. in Software Development ................................ // ENROLLED ON .......... | Feb 1, 2019 ................................................. // MENTOR ............... | Becky Stovall ............................................... // PHONE ................ | (904) 238-7347 .............................................. // TIME ZONE ............ | Eastern Time ................................................ // EMAIL ................ | MEwer@wgu.edu or Mark@3w3r.com .............................. // WEB SITE ............. | http://www.markewer.com ..................................... // ###################### | ############################################################# namespace Ewer.Cqrs.Ntfs.Events { using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using Ewer.Cqrs.Events; using Ewer.Cqrs.Extensions; /// <summary> /// Writes a reference to each event with it's global sequence number and link to /// event file. Reading can be done concurrently. Writes/Recovers must be /// sequential. /// </summary> internal class GlobalSequenceIndex : IDisposable { public const int SizeofSeqRecord = 8 + 1 + 255 + 8; private readonly string _seqFilePath; private BinaryWriter _writer; public GlobalSequenceIndex(string basePath, bool dropEvents) { _seqFilePath = Path.Combine(basePath, "seq.idx"); if (dropEvents && File.Exists(_seqFilePath)) File.Delete(_seqFilePath); OpenWriter(); } public void DetectCorruptionAndRecover(DataStore store, long lastCommittedGlobalSequenceNumber) { var numberOfRecords = _writer.BaseStream.Length / SizeofSeqRecord; var expectedNumberOfRecords = lastCommittedGlobalSequenceNumber + 1; if (expectedNumberOfRecords == numberOfRecords) return; _writer.Dispose(); foreach (var orphan in Read(long.MaxValue, lastCommittedGlobalSequenceNumber + 1)) { store.Truncate(orphan.AggregateRootId, orphan.LocalSequenceNumber); } using (var stream = new FileStream(_seqFilePath, FileMode.Open, FileAccess.Write, FileShare.Read, 1024, FileOptions.None)) { stream.SetLength(expectedNumberOfRecords * SizeofSeqRecord); stream.Flush(); } OpenWriter(); } public void Dispose() { _writer.Dispose(); } public IEnumerable<GlobalSequenceRecord> Read(long lastCommittedGlobalSequenceNumber, long offset) { using (var readStream = new FileStream(_seqFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, 100 * SizeofSeqRecord, FileOptions.None)) using (var reader = new BinaryReader(readStream, Encoding.ASCII)) { readStream.Seek(offset * SizeofSeqRecord, SeekOrigin.Begin); while (readStream.Position + SizeofSeqRecord <= readStream.Length) { var record = new GlobalSequenceRecord { GlobalSequenceNumber = reader.ReadInt64(), AggregateRootId = ReadFixedLengthString(reader), LocalSequenceNumber = reader.ReadInt64(), }; if (record.GlobalSequenceNumber > lastCommittedGlobalSequenceNumber) break; yield return record; } } } public string ReadFixedLengthString(BinaryReader reader) { var length = reader.ReadByte(); var str = Encoding.UTF8.GetString(reader.ReadBytes(length)); reader.ReadBytes(255 - length); return str; } public void Write(IEnumerable<EventData> events) { Write(from @event in events select new GlobalSequenceRecord { GlobalSequenceNumber = @event.GetGlobalSequenceNumber(), AggregateRootId = @event.GetAggregateRootId(), LocalSequenceNumber = @event.GetSequenceNumber(), }); } public void Write(IEnumerable<GlobalSequenceRecord> records) { foreach (var record in records) { _writer.Write(record.GlobalSequenceNumber); var keyAsBytes = Encoding.UTF8.GetBytes(record.AggregateRootId); var length = keyAsBytes.Length; Array.Resize(ref keyAsBytes, 255); _writer.Write((byte)length); _writer.Write(keyAsBytes); _writer.Write(record.LocalSequenceNumber); } _writer.Flush(); } private void OpenWriter() { _writer = new BinaryWriter( new FileStream(_seqFilePath, FileMode.Append, FileAccess.Write, FileShare.Read, 100 * SizeofSeqRecord, FileOptions.None), Encoding.ASCII, leaveOpen: false); } public class GlobalSequenceRecord { public string AggregateRootId { get; set; } public long GlobalSequenceNumber { get; set; } public long LocalSequenceNumber { get; set; } } } }
MarkEwer/DomainMachine
Construction/Ewer.Cqrs/Ntfs/Events/GlobalSequenceIndex.cs
C#
gpl-3.0
6,146
class BookingPayment include ActiveModel::Validations attr_reader :booking def initialize(booking, token) @booking = booking @token = token @event = booking.event @user = booking.user end def save @customer = Stripe::Customer.create(email: user.email, card: token) Payment.create!(booking: booking, customer_reference: customer.id, charge_reference: charge.id) rescue Stripe::CardError => e errors.add(:base, e.message) false rescue => e Rails.logger.error("BookingPayment failed for #{user.email} for event [#{event.id}]") Rails.logger.error(e.inspect) errors.add(:base, I18n.t("failure.generic")) false end private attr_reader :token, :event, :user, :customer def charge Stripe::Charge.create( customer: customer.id, amount: event.price_in_pennies, description: event.title, currency: event.currency ) end end
whatweate/whatweate
app/models/booking_payment.rb
Ruby
gpl-3.0
938
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>SigPack: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); </script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="sp.png"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">SigPack </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacesp.html">sp</a></li><li class="navelem"><a class="el" href="classsp_1_1_i_i_r__filt.html">IIR_filt</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">sp::IIR_filt&lt; T1, T2, T3 &gt; Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a033d49e2188e41cf4962ab564f7c8f5c">a</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a724b945ba5e575e3ffa3adb5b82cdb48">a_buf</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#ae00c806f731d892829191a122a1a6811">a_cur_p</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a1386e87d7bf6d18f7f4ea84def2855bb">b</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#abdcb0f475617452b158a5e74a9fb18f3">b_buf</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a07fdd197f55e0c529e6437e06249bc21">b_cur_p</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#afee32a34b810f27154d13a6898bf67a7">clear</a>(void)</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a97e513891ad46ce92e14563c0d1cc27e">filter</a>(const arma::Col&lt; T1 &gt; &amp;in)</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a5049d36219530673432b21d95c903d2c">IIR_filt</a>()</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#ab060ce79c6da3410d17207170c0f1118">M</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#aeb5b949dde67cf16c997b9a3309c7dcc">N</a></td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">private</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#ada68a6cf91f30a4bf1326040e6819114">operator()</a>(const T1 &amp;in)</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a40beddb04fa249b3db6f7576b6c12152">set_coeffs</a>(const arma::Col&lt; T2 &gt; &amp;_b, const arma::Col&lt; T2 &gt; &amp;_a)</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#a1f5d3244e11f2d6b341910fc0f5100de">update_coeffs</a>(const arma::Col&lt; T2 &gt; &amp;_b, const arma::Col&lt; T2 &gt; &amp;_a)</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html#af17e81e0c79f9d97aba071d38e02b4f0">~IIR_filt</a>()</td><td class="entry"><a class="el" href="classsp_1_1_i_i_r__filt.html">sp::IIR_filt&lt; T1, T2, T3 &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Wed Aug 9 2017 10:56:51 for SigPack by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
SpaceHAUC-Beam-Steering/Recursive-Least-Square
source/sig/doc/doxy/html/classsp_1_1_i_i_r__filt-members.html
HTML
gpl-3.0
9,447
// Copyright (c) 2014 Daniel Boerlage and Philip Xu // Distributed under the GNU GPL software license, see the accompanying // file LICENSE or http://www.gnu.org/licenses/gpl-3.0.html package implicitplot.equations; import java.util.Iterator; /** * @author Daniel Boerlage */ public class Function extends ParseTree { private final String type; public Function(String type) { super(); this.type = type; } @Override public double evaluate(double var1, double var2) { switch(type.toLowerCase()) { case "neg": case "negative": return - children[0].evaluate(var1, var2); case "plus": case "sum": double sum = 0d; for(ParseTree p : children) sum += p.evaluate(var1, var2); return sum; case "minus": case "subtract": return children[0].evaluate(var1, var2) - children[1].evaluate(var1, var2); case "diff": case "difference": return Math.abs(children[0].evaluate(var1, var2) - children[1].evaluate(var1, var2)); case "mult": case "multiply": double product = 1d; for(ParseTree p : children) product *= p.evaluate(var1, var2); return product; case "div": case "divide": return children[0].evaluate(var1, var2) / children[1].evaluate(var1, var2); case "mod": case "modulus": case "modulo": return children[0].evaluate(var1, var2) % children[1].evaluate(var1, var2); case "pow": case "power": return Math.pow(children[0].evaluate(var1, var2), children[1].evaluate(var1, var2)); case "abs": case "absolute": return Math.abs(children[0].evaluate(var1, var2)); case "sqrt": case "squareroot": return Math.sqrt(children[0].evaluate(var1, var2)); case "exp": case "exponential": return Math.exp(children[0].evaluate(var1, var2)); case "log": case "ln": case "logarithm": return Math.log(children[0].evaluate(var1, var2)); case "log2": return Math.log(children[0].evaluate(var1, var2)) / 0.69314718056; // natural logartim of 2 case "log10": return Math.log10(children[0].evaluate(var1, var2)); case "sin": case "sine": return Math.sin(children[0].evaluate(var1, var2)); case "cos": case "cosine": return Math.cos(children[0].evaluate(var1, var2)); case "tan": case "tangent": return Math.tan(children[0].evaluate(var1, var2)); case "asin": case "arcsin": return Math.asin(children[0].evaluate(var1, var2)); case "acos": case "arccos": return Math.acos(children[0].evaluate(var1, var2)); case "atan": case "arctan": return Math.atan(children[0].evaluate(var1, var2)); case "atan2": return Math.atan2(children[0].evaluate(var1, var2), children[1].evaluate(var1, var2)); case "sinh": return Math.sinh(children[0].evaluate(var1, var2)); case "cosh": return Math.cosh(children[0].evaluate(var1, var2)); case "tanh": return Math.tanh(children[0].evaluate(var1, var2)); case "cbrt": case "cuberoot": return Math.cbrt(children[0].evaluate(var1, var2)); case "ceil": case "ceiling": return Math.ceil(children[0].evaluate(var1, var2)); case "floor": case "entier": case "int": case "integer": return Math.floor(children[0].evaluate(var1, var2)); case "expm1": return Math.expm1(children[0].evaluate(var1, var2)); case "hypot": return Math.hypot(children[0].evaluate(var1, var2), children[1].evaluate(var1, var2)); case "max": case "maximum": double max = Double.NEGATIVE_INFINITY; for(ParseTree p : children) max = Math.max(max, p.evaluate(var1, var2)); return max; case "min": case "minimum": double min = Double.POSITIVE_INFINITY; for(ParseTree p : children) min = Math.min(min, p.evaluate(var1, var2)); return min; case "random": return Math.random(); case "round": return Math.rint(children[0].evaluate(var1, var2)); case "sign": case "singum": return Math.signum(children[0].evaluate(var1, var2)); case "sq": case "square": return Math.pow(children[0].evaluate(var1, var2), 2); case "deg": case "degrees": case "todegrees": return Math.toDegrees(children[0].evaluate(var1, var2)); case "rad": case "radians": case "toradians": return Math.toRadians(children[0].evaluate(var1, var2)); case "rect": case "between": double x = children[0].evaluate(var1, var2); if(x > children[1].evaluate(var1, var2) && x < children[2].evaluate(var1, var2)) return 1d; return 0d; // change to undef later? case "mag": case "magnitude": sum = 0d; for(ParseTree p : children) sum += Math.pow(p.evaluate(var1, var2), 2); return Math.sqrt(sum); case "avg": case "average": sum = 0d; for(ParseTree p : children) sum += p.evaluate(var1, var2); return sum / children.length; } return Double.NaN; } }
DanielBoerlage/Implicit-Plotter
src/implicitplot/equations/Function.java
Java
gpl-3.0
5,963
// Sniper.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<Windows.h> int _tmain(int argc, _TCHAR* argv[]) { DWORD procId; HWND handle = FindWindow(NULL, argv[1]); if (!handle) return 0; DWORD threadId = GetWindowThreadProcessId(handle, &procId); HMODULE hMod2 = LoadLibrary(L"Spy.dll"); if (hMod2) OutputDebugString(_T("HookProc loaded")); //get method address to be given t setwindowhookex HOOKPROC method = (HOOKPROC)GetProcAddress(hMod2, "LocalHook"); HHOOK hk = SetWindowsHookEx(WH_GETMESSAGE, method, hMod2, threadId); Sleep(1000); //the dll will get loaded only when it recieves this message BOOL bFlag = PostThreadMessage(threadId, WM_PAINT, NULL, NULL); DWORD err = GetLastError(); Sleep(1000); BOOL d = UnhookWindowsHookEx(hk); return 0; }
arunsatyarth/CSRoot
Sniper/Sniper.cpp
C++
gpl-3.0
823
/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * OnOneSideViolations.java * Copyright (C) 2015 University of Waikato, Hamilton, NZ */ package adams.data.spc; import gnu.trove.list.array.TIntArrayList; /** <!-- globalinfo-start --> * Flags a data point as violation if it is the start of consecutive sequence (of specified minimum length) of points that are all on one side. * <br><br> <!-- globalinfo-end --> * <!-- options-start --> * <pre>-logging-level &lt;OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST&gt; (property: loggingLevel) * &nbsp;&nbsp;&nbsp;The logging level for outputting errors and debugging output. * &nbsp;&nbsp;&nbsp;default: WARNING * </pre> * * <pre>-min-points &lt;int&gt; (property: minPoints) * &nbsp;&nbsp;&nbsp;The minimum number of points that have to be on one side. * &nbsp;&nbsp;&nbsp;default: 7 * &nbsp;&nbsp;&nbsp;minimum: 1 * </pre> * <!-- options-end --> * * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision$ */ public class OnOneSideViolations extends AbstractViolationFinder { private static final long serialVersionUID = 6050852088287348188L; /** the minimum number of data points on one side before flagging as violation. */ protected int m_MinPoints; /** * Returns a string describing the object. * * @return a description suitable for displaying in the gui */ @Override public String globalInfo() { return "Flags a data point as violation if it is the start of consecutive " + "sequence (of specified minimum length) of points that are all on one side."; } /** * Adds options to the internal list of options. */ @Override public void defineOptions() { super.defineOptions(); m_OptionManager.add( "min-points", "minPoints", 7, 1, null); } /** * Sets the minimum number of points that have to be on one side. * * @param value the minimum number of points */ public void setMinPoints(int value) { if (value >= 1) { m_MinPoints = value; reset(); } else { getLogger().warning("Minimum number of points must be 1, provided: " + value); } } /** * Returns whether to produce mean or variation data. * * @return true if to generate variation data */ public int getMinPoints() { return m_MinPoints; } /** * Returns the tip text for this property. * * @return tip text for this property suitable for * displaying in the GUI or for listing the options. */ public String minPointsTipText() { return "The minimum number of points that have to be on one side."; } /** * Performs the finding. * * @param data the data to check * @param limits the limits for the data * @return the indices of the violations */ protected int[] doFind(double[] data, Limits[] limits) { TIntArrayList result; int i; int n; boolean mixed; result = new TIntArrayList(); for (i = 0; i < data.length - m_MinPoints; i++) { mixed = false; for (n = 0; n < m_MinPoints - 1; n++) { if (limits.length == data.length) { if ((data[n] - limits[n].getCenter()) * (data[n + 1] - limits[n].getCenter()) < 0) { mixed = true; break; } } else { if ((data[n] - limits[0].getCenter()) * (data[n + 1] - limits[0].getCenter()) < 0) { mixed = true; break; } } } if (!mixed) result.add(i); } return result.toArray(); } }
waikato-datamining/adams-base
adams-visualstats/src/main/java/adams/data/spc/OnOneSideViolations.java
Java
gpl-3.0
4,128
/* demoquest - An adventure game demo with parallax scrolling * Copyright (C) 2017 Peter Rogers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ var Events = require("./events"); var Utils = require("./utils"); // Object cache for holding a (PIXI) rendered texture, to be used as the dialog // box background. Generating a texture takes a noticable amount of time to // do at runtime. So this is nice to cache globally to use across all // dialog instances. var CachedTexture = new (class { makeTexture(colour) { if (colour !== undefined && this.colour !== colour) { this.texture = Utils.makeSolidColourTexture(colour, 10, 10); this.colour = colour; } return this.texture; } }); /**********/ /* Dialog */ /**********/ function Dialog(width, height, stage, options) { this.container = new PIXI.Container(); this.viewWidth = width; this.viewHeight = height; this.options = options; this.messages = []; this.stage = stage; var mgr = new Events.EventManager(); this.onOpening = mgr.hook("opening"); this.onClosed = mgr.hook("closed"); this.onClosing = mgr.hook("closing"); this.onRedraw = mgr.hook("redraw"); this.onUpdate = mgr.hook("update"); this.dispatch = mgr.dispatcher(); this.state = "idle"; let texture = CachedTexture.makeTexture(options.background); this.bg = new PIXI.Sprite(texture); this.container.addChild(this.bg); } Dialog.prototype.isShown = function() { return this.state === "shown"; } Dialog.prototype.showMessage = function(msg) { if (this.state !== "idle") { // Already showing a message. Add it to the queue for later this.messages.push(msg); return; } var pad = this.viewHeight*0.02; var fontSize = this.viewHeight*0.05; var text = new PIXI.Text(msg, { fontSize: fontSize, wordWrap: true, fontStyle: "italic", fill: this.options.fill, wordWrapWidth: this.viewWidth-2*pad }); text.x = pad; text.y = pad; this.bg.scale.set( this.viewWidth/this.bg.texture.width, (text.height+2*pad)/this.bg.texture.height); this.container.children = []; this.container.addChild(this.bg); this.container.addChild(text); //this.container.addChild(bg); //this.container.addChild(text); // Now position everything, a little offset from the bottom /*bg.y = this.viewHeight-bg.height-(this.viewHeight*0.03); text.x = pad; text.y = bg.y+pad;*/ this.desty = this.viewHeight-this.bg.height-(this.viewHeight*0.03); this.container.y = this.viewHeight+5; this.show(); } Dialog.prototype.show = function() { if (this.state !== "idle") return; this.state = "showing"; this.delay = 0; this.stage.addChild(this.container); // Have the dialog box slide into view from below this.dispatch("update", dt => { if (this.delay > 0) { this.delay -= dt; return true; } this.container.y -= 0.9*this.viewHeight*dt; if (this.container.y < this.desty) { this.container.y = this.desty; this.state = "shown"; this.dispatch("redraw"); return false; } return true; }); this.dispatch("opening"); } Dialog.prototype.hide = function(delay) { if (this.state !== "shown") return; this.state = "hiding"; // Have the dialog box slide off screen this.dispatch("closing"); this.dispatch("update", dt => { if (delay > 0) { delay -= dt; return true; } this.container.y += (0.75*this.viewHeight)*dt; if (this.container.y > this.viewHeight) { this.container.parent.removeChild(this.container); this.state = "idle"; if (this.messages.length > 0) { // Show the next message this.showMessage(this.messages.shift()); } else { this.dispatch("closed"); } this.dispatch("redraw"); return false; } return true; }); } Dialog.prototype.handleResize = function(width, height) { this.viewWidth = width; this.viewHeight = height; // TODO - handle resize when a message is displayed currently } /* Returns a promise that resolves once the dialog is closed */ Dialog.prototype.closed = function() { return new Promise( (resolve, reject) => { let closedEvent = this.onClosed(() => { closedEvent.remove(); resolve(); }); }, err => { console.log("Error closing dialog: " + err); } ); } module.exports = Dialog;
parogers/demoquest
src/dialog.js
JavaScript
gpl-3.0
4,967
#include "common.h" #define DEBUG_FLAG SEAFILE_DEBUG_HTTP #include "log.h" #include <ccnet.h> #include "seafile-object.h" #include "seafile-crypt.h" #include "seafile.h" #include "utils.h" #include "seafile-session.h" #include "httpserver.h" #include <archive.h> #include <archive_entry.h> #include <iconv.h> #ifdef WIN32 #define S_IFLNK 0120000 /* Symbolic link */ #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK) #endif typedef struct { struct archive *a; SeafileCrypt *crypt; const char *top_dir_name; gboolean is_windows; time_t mtime; char store_id[37]; int repo_version; } PackDirData; static char * do_iconv (char *fromcode, char *tocode, char *in) { iconv_t conv; size_t inlen, outlen, len; char out[1024]; char *pin = in; char *pout = out; conv = iconv_open (tocode, fromcode); if (conv == (iconv_t)-1) { return NULL; } inlen = strlen (in); outlen = sizeof(out); len = iconv (conv, &pin, &inlen, &pout, &outlen); iconv_close (conv); if (len == -1) { return NULL; } outlen = sizeof(out) - outlen; return g_strndup(out, outlen); } static int add_file_to_archive (PackDirData *data, const char *parent_dir, SeafDirent *dent) { struct archive *a = data->a; struct SeafileCrypt *crypt = data->crypt; gboolean is_windows = data->is_windows; const char *top_dir_name = data->top_dir_name; struct archive_entry *entry = NULL; Seafile *file = NULL; char *pathname = NULL; char buf[64 * 1024]; int len = 0; int n = 0; int idx = 0; BlockHandle *handle = NULL; BlockMetadata *bmd = NULL; char *blk_id = NULL; uint32_t remain = 0; EVP_CIPHER_CTX ctx; gboolean enc_init = FALSE; char *dec_out = NULL; int dec_out_len = -1; int ret = 0; pathname = g_build_filename (top_dir_name, parent_dir, dent->name, NULL); file = seaf_fs_manager_get_seafile (seaf->fs_mgr, data->store_id, data->repo_version, dent->id); if (!file) { ret = -1; goto out; } entry = archive_entry_new (); /* File name fixup for WinRAR */ if (is_windows && seaf->windows_encoding) { char *win_file_name = do_iconv ("UTF-8", seaf->windows_encoding, pathname); if (!win_file_name) { seaf_warning ("Failed to convert file name to %s\n", seaf->windows_encoding); ret = -1; goto out; } archive_entry_copy_pathname (entry, win_file_name); g_free (win_file_name); } else { archive_entry_set_pathname (entry, pathname); } /* FIXME: 0644 should be set when upload files in repo-mgr.c */ archive_entry_set_mode (entry, dent->mode | 0644); archive_entry_set_size (entry, file->file_size); archive_entry_set_mtime (entry, data->mtime, 0); n = archive_write_header (a, entry); if (n != ARCHIVE_OK) { seaf_warning ("archive_write_header error: %s\n", archive_error_string(a)); ret = -1; goto out; } /* Read data of this entry block by block */ while (idx < file->n_blocks) { blk_id = file->blk_sha1s[idx]; handle = seaf_block_manager_open_block (seaf->block_mgr, data->store_id, data->repo_version, blk_id, BLOCK_READ); if (!handle) { seaf_warning ("Failed to open block %s\n", blk_id); ret = -1; goto out; } bmd = seaf_block_manager_stat_block_by_handle (seaf->block_mgr, handle); if (!bmd) { seaf_warning ("Failed to stat block %s\n", blk_id); ret = -1; goto out; } remain = bmd->size; g_free (bmd); if (crypt) { if (seafile_decrypt_init (&ctx, crypt->version, crypt->key, crypt->iv) < 0) { seaf_warning ("Failed to init decrypt.\n"); ret = -1; goto out; } enc_init = TRUE; } while (remain != 0) { n = seaf_block_manager_read_block (seaf->block_mgr, handle, buf, sizeof(buf)); if (n <= 0) { seaf_warning ("failed to read block %s\n", blk_id); ret = -1; goto out; } remain -= n; /* OK, We're read some data of this block */ if (crypt == NULL) { /* not encrypted */ len = archive_write_data (a, buf, n); if (len <= 0) { seaf_warning ("archive_write_data returned %d\n", len); ret = -1; goto out; } } else { /* an encrypted block */ dec_out = g_new (char, n + 16); if (!dec_out) { seaf_warning ("Failed to alloc memory.\n"); ret = -1; goto out; } int r = EVP_DecryptUpdate (&ctx, (unsigned char *)dec_out, &dec_out_len, (unsigned char *)buf, n); /* EVP_DecryptUpdate returns 1 on success, 0 on failure */ if (r != 1) { seaf_warning ("Decrypt block %s failed.\n", blk_id); ret = -1; goto out; } if (dec_out_len > 0) { len = archive_write_data (a, dec_out, dec_out_len); if (len <= 0) { seaf_warning ("archive_write_data returned %d\n", len); ret = -1; goto out; } } /* If it's the last piece of a block, call decrypt_final() * to decrypt the possible partial block. */ if (remain == 0) { r = EVP_DecryptFinal_ex (&ctx, (unsigned char *)dec_out, &dec_out_len); if (r != 1) { seaf_warning ("Decrypt block %s failed.\n", blk_id); ret = -1; goto out; } if (dec_out_len != 0) { len = archive_write_data (a, dec_out, dec_out_len); if (len <= 0) { seaf_warning ("archive_write_data returned %d\n", len); ret = -1; goto out; } } } g_free (dec_out); dec_out = NULL; } } seaf_block_manager_close_block (seaf->block_mgr, handle); seaf_block_manager_block_handle_free (seaf->block_mgr, handle); handle = NULL; /* turn to next block */ idx++; } out: g_free (pathname); if (entry) archive_entry_free (entry); if (file) seafile_unref (file); if (handle) { seaf_block_manager_close_block (seaf->block_mgr, handle); seaf_block_manager_block_handle_free(seaf->block_mgr, handle); } if (crypt != NULL && enc_init) EVP_CIPHER_CTX_cleanup (&ctx); g_free (dec_out); return ret; } static int archive_dir (PackDirData *data, const char *root_id, const char *dirpath) { SeafDir *dir = NULL; SeafDirent *dent; GList *ptr; char *subpath = NULL; int ret = 0; dir = seaf_fs_manager_get_seafdir (seaf->fs_mgr, data->store_id, data->repo_version, root_id); if (!dir) { seaf_warning ("failed to get dir %s\n", root_id); goto out; } for (ptr = dir->entries; ptr; ptr = ptr->next) { dent = ptr->data; if (S_ISREG(dent->mode)) { ret = add_file_to_archive (data, dirpath, dent); } else if (S_ISLNK(dent->mode)) { if (archive_version_number() >= 3000001) { /* Symlink in zip arhive is not supported in earlier version * of libarchive */ ret = add_file_to_archive (data, dirpath, dent); } } else if (S_ISDIR(dent->mode)) { subpath = g_build_filename (dirpath, dent->name, NULL); ret = archive_dir (data, dent->id, subpath); g_free (subpath); } if (ret < 0) { goto out; } } out: if (dir) seaf_dir_free (dir); return ret; } char *pack_dir (const char *store_id, int repo_version, const char *dirname, const char *root_id, SeafileCrypt *crypt, gboolean is_windows) { struct archive *a = NULL; char *tmpfile_name = NULL ; char *ret = NULL; int fd = -1; PackDirData *data = NULL; fd = g_file_open_tmp ("seafile-XXXXXX.zip", &tmpfile_name, NULL); if (fd < 0) { goto out; } a = archive_write_new (); archive_write_set_compression_none (a); archive_write_set_format_zip (a); archive_write_open_fd (a, fd); data = g_new0 (PackDirData, 1); data->crypt = crypt; data->is_windows = is_windows; data->a = a; data->top_dir_name = dirname; data->mtime = time(NULL); memcpy (data->store_id, store_id, 36); data->repo_version = repo_version; if (archive_dir (data, root_id, "") < 0) { g_debug ("failed to archive_dir\n"); goto out; } if (archive_write_finish(a) < 0) { goto out; } ret = g_strdup (tmpfile_name); out: if (data) g_free (data); if (fd > 0) close (fd); if (!ret && tmpfile_name) { /* zip failed: remove tmp file */ g_unlink (tmpfile_name); } g_free (tmpfile_name); return ret; }
Chilledheart/seafile
httpserver/pack-dir.c
C
gpl-3.0
10,520
/* KDXplore provides KDDart Data Exploration and Management Copyright (C) 2015,2016,2017 Diversity Arrays Technology, Pty Ltd. KDXplore may be redistributed and may be modified under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. KDXplore is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with KDXplore. If not, see <http://www.gnu.org/licenses/>. */ package com.diversityarrays.kdcompute.db; @SuppressWarnings("nls") public class PluginCollection { public String pluginGroup; public java.util.Date lastUpdated; public int version; public String author; public String contact; public String[] plugins; public PluginCollection() {} @Override public String toString() { StringBuilder sb = new StringBuilder("PluginCollection["); sb.append("version=").append(version) .append("grp=").append(pluginGroup) .append("\n\tupdated").append(lastUpdated) .append("\n\tby ").append(author) .append("\n\tvia ").append(contact); if (plugins != null) { sb.append("\n plugins: ").append(plugins.length); for (String p : plugins) { sb.append("\n\t").append(p); } } sb.append("]"); return sb.toString(); } }
kddart/kdxplore
kdxapp_trialdesign/src/main/java/com/diversityarrays/kdcompute/db/PluginCollection.java
Java
gpl-3.0
1,705
var searchData= [ ['humidity',['Humidity',['../a00004.html#afc87e0fad26178d122954b0a266ce996',1,'HomeGenie::Automation::Scripting::ModulesManager']]] ];
sanyaade-iot/HomeGenie-Docs
html/docs/doxy/search/properties_3.js
JavaScript
gpl-3.0
155
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> <TS version="2.1" language="it" sourcelanguage="en"> <context> <name>LocaleDialog</name> <message> <source>Select application language:</source> <translation>Seleziona la lingua dell&apos;applicazione:</translation> </message> <message> <source>&lt;System Language&gt;</source> <translation>&lt;Lingua di sistema&gt;</translation> </message> <message> <source>Note</source> <translation>Note</translation> </message> <message> <source>Please restart this application for the change in language to take effect.</source> <translation>Per favore è necessario riavviare l&apos;applicazione affinché il cambio di lingua abbia effetto.</translation> </message> </context> <context> <name>Report</name> <message> <source>Time Sheet Report</source> <translation>Rapporto ore lavorate</translation> </message> <message> <source>Name:</source> <translation>Nome:</translation> </message> <message> <source>Company:</source> <translation>Ditta:</translation> </message> <message> <source>Address:</source> <translation>Indirizzo:</translation> </message> <message> <source>Phone:</source> <translation>Telefono:</translation> </message> <message> <source>Fax:</source> <translation>Fax:</translation> </message> <message> <source>Email:</source> <translation>Email:</translation> </message> <message> <source>Website:</source> <translation>Sito web:</translation> </message> <message> <source>N/A</source> <translation>N/A</translation> </message> <message> <source>Prepend currency symbol</source> <translation>Anteponi simbolo valuta</translation> </message> <message> <source>Hourly rate:</source> <translation>Tasso orario:</translation> </message> <message> <source>Tax rate:</source> <translation>percentuale di tasse:</translation> </message> <message> <source>Currency symbol:</source> <translation>Simbolo valuta:</translation> </message> <message> <source>Contact Information</source> <translation>Informazioni contatto</translation> </message> <message> <source>Data</source> <translation>Data</translation> </message> <message> <source>Preview</source> <translation>Anteprima</translation> </message> <message> <source>Export</source> <translation>Esporta</translation> </message> <message> <source>Print</source> <translation>Stampa</translation> </message> <message> <source>Web Page (*.html *.htm)</source> <translation>pagina web (*.html, *.htm)</translation> </message> <message> <source>iCalendar (*.ics)</source> <translation>iCalendar (*.ics)</translation> </message> <message> <source>Outlook CSV (*.csv)</source> <translation>Outlook CSV (*.csv)</translation> </message> <message> <source>Export Report</source> <translation>Esporta Report</translation> </message> <message> <source>View Reports</source> <translation>Visualizza Report</translation> </message> <message> <source>Create Report</source> <translation>Crea Report</translation> </message> <message> <source>Phone: %1</source> <translation>Telefono: %1</translation> </message> <message> <source>Fax: %1</source> <translation>Fax: %1</translation> </message> <message> <source>Hours</source> <translation>Ore</translation> </message> <message> <source>Subtotal</source> <translation>Subtotale</translation> </message> <message> <source>Taxes</source> <translation>Tasse</translation> </message> <message> <source>Total</source> <translation>Totale</translation> </message> </context> <context> <name>Session</name> <message numerus="yes"> <source>%n hour(s)</source> <translation> <numerusform>%n ora</numerusform> <numerusform>%n ore</numerusform> </translation> </message> <message> <source>%L1 hours</source> <translation>%L1 ore</translation> </message> </context> <context> <name>SessionDelegate</name> <message> <source>Error</source> <translation>Errore</translation> </message> <message> <source>Session conflicts with other sessions.</source> <translation>La sessone è in conflitto con altre sessioni</translation> </message> </context> <context> <name>SessionDialog</name> <message> <source>Add Session</source> <translation>Aggiungi sessione</translation> </message> <message> <source>Date:</source> <translation>Data:</translation> </message> <message> <source>Start:</source> <translation>Inizio:</translation> </message> <message> <source>Stop:</source> <translation>Fine:</translation> </message> <message> <source>Task:</source> <translation>Compito:</translation> </message> <message> <source>Edit Session</source> <translation>Modifica sessione</translation> </message> </context> <context> <name>SessionModel</name> <message> <source>Total</source> <translation>Totale</translation> </message> <message> <source>Date</source> <translation>Data</translation> </message> <message> <source>Start</source> <translation>Start</translation> </message> <message> <source>Stop</source> <translation>Stop</translation> </message> <message> <source>Task</source> <translation>Compito </translation> </message> <message> <source>Hours</source> <translation>Ore</translation> </message> <message> <source>Daily</source> <translation>Giornaliero</translation> </message> <message> <source>Weekly</source> <translation>Settimanale</translation> </message> <message> <source>Monthly</source> <translation>Mensile</translation> </message> <message> <source>Report</source> <translation>Report</translation> </message> </context> <context> <name>Window</name> <message> <source>00:00:00</source> <translation>00:00:00</translation> </message> <message> <source>Start</source> <translation>Inizio</translation> </message> <message> <source>Stop</source> <translation>Fine</translation> </message> <message> <source>Cancel</source> <translation>Cancella</translation> </message> <message> <source>&amp;Minimize</source> <translation>Minimizza</translation> </message> <message> <source>&amp;Project</source> <translation>&amp;Progetto</translation> </message> <message> <source>&amp;Add</source> <translation>&amp;Aggiungi</translation> </message> <message> <source>Ctrl+Shift+N</source> <translation>Ctrl+Shift+N</translation> </message> <message> <source>&amp;Remove</source> <translation>&amp;Rimuovi</translation> </message> <message> <source>Ctrl+Shift+Delete</source> <translation>Ctrl+Shift+Canc</translation> </message> <message> <source>&amp;Quit</source> <translation>&amp;Esci</translation> </message> <message> <source>Ctrl+Q</source> <translation>Ctrl+Q</translation> </message> <message> <source>&amp;Session</source> <translation>&amp;Sessione</translation> </message> <message> <source>&amp;Edit</source> <translation>&amp;Modifica</translation> </message> <message> <source>Ctrl+Delete</source> <translation>Ctrl+Canc</translation> </message> <message> <source>S&amp;ettings</source> <translation>&amp;Impostazioni</translation> </message> <message> <source>Columns</source> <translation>Colonne</translation> </message> <message> <source>&amp;Decimal Totals</source> <translation>Totali &amp;Decimali</translation> </message> <message> <source>&amp;Inline Editing</source> <translation>&amp;Modifica in linea</translation> </message> <message> <source>Application &amp;Language...</source> <translation>&amp;Lingua...</translation> </message> <message> <source>&amp;Help</source> <translation>&amp;Aiuto</translation> </message> <message> <source>&amp;About</source> <translation>&amp;A proposito</translation> </message> <message> <source>About &amp;Qt</source> <translation>A proposito delle &amp;Qt</translation> </message> <message> <source>Project</source> <translation>Progetto</translation> </message> <message> <source>Timer</source> <translation>Tempo</translation> </message> <message> <source>Show all</source> <translation>Mostra tutto</translation> </message> <message> <source>Show only unbilled</source> <translation>Mostra solo occorrenze non fatturate</translation> </message> <message> <source>Show only this year</source> <translation>Mostra solo occorrenze di quest&apos;anno</translation> </message> <message> <source>Show only this month</source> <translation>Mostra solo occorrenze di questo mese</translation> </message> <message> <source>Show only this week</source> <translation>Mostra solo occorrenze di questa settimana</translation> </message> <message> <source>Copyright &amp;copy; 2008-%1 Graeme Gott</source> <translation>Copyright &amp;copy; 2008-%1 Graeme Gott</translation> </message> <message> <source>Released under the &lt;a href=%1&gt;GPL 3&lt;/a&gt; license</source> <translation>Rilasciata sotto licenza &lt;a href=%1&gt;GPL 3&lt;/a&gt; </translation> </message> <message> <source>Session conflicts with other sessions.</source> <translation>La sessione è in conflitto con altre sessioni.</translation> </message> <message> <source>&amp;Restore</source> <translation>&amp;Ripristina</translation> </message> <message> <source>Unable to read time data.</source> <translation>Impossibile leggere i dati relativi alla temporizzazione</translation> </message> <message> <source>Untitled</source> <translation>Senza titolo</translation> </message> <message> <source>Unable to write time data.</source> <translation>Impossibile leggere i dati relativi alla temporizzazione.</translation> </message> <message> <source>There are timers running. Stop timers and quit?</source> <translation>Ci sono dei timer in esecuzione. Fermare i timer e chiudere l&apos;applicazione?</translation> </message> <message> <source>About</source> <translation>A proposito</translation> </message> <message> <source>A program to help track spent time</source> <translation>Un programma per aiutarvi a tenere traccia del tempo speso</translation> </message> <message> <source>Question</source> <translation>Domande</translation> </message> <message> <source>&amp;Create Report...</source> <translation>&amp;Crea Report...</translation> </message> <message> <source>View R&amp;eports</source> <translation>Visualizza R&amp;eports</translation> </message> <message> <source>Cancel this session?</source> <translation>Cancella questa sessione?</translation> </message> <message> <source>Add Project</source> <translation>Aggiungi Progetto</translation> </message> <message> <source>Enter project name:</source> <translation>Inserisci nome progetto:</translation> </message> <message> <source>Error</source> <translation>Errore</translation> </message> <message> <source>Unable to create time data location.</source> <translation>Impossibile creare la posizione dei dati temporali.</translation> </message> <message> <source>Unable to move time data location.</source> <translation>Impossibile spostare la posizione dei dati temporali.</translation> </message> <message> <source>A project with that name already exists.</source> <translation>Un progetto con quel nome esiste già.</translation> </message> <message> <source>Remove selected project?</source> <translation>Rimuovi il progetto selezionato?</translation> </message> <message> <source>Remove selected session?</source> <translation>Rimuovi la sessione selezionata?</translation> </message> <message numerus="yes"> <source>%n timer(s) running</source> <translation> <numerusform>%n orologio partito</numerusform> <numerusform>%n orologi partito</numerusform> </translation> </message> <message> <source>Kapow Punch Clock</source> <translation>Kapow Punch Clock</translation> </message> <message> <source>&amp;Close to Tray</source> <translation type="unfinished"></translation> </message> </context> <context> <name>main</name> <message> <source>Punch clock program</source> <translation type="unfinished"></translation> </message> <message> <source>Store settings as INI format in specified file.</source> <translation>Memorizza le impostazioni come formato INI nel file specificato.</translation> </message> <message> <source>file</source> <translation>file</translation> </message> <message> <source>Do not create automatic backups of time data.</source> <translation>Non creare backup automatici dei dati temporali.</translation> </message> <message> <source>The time data file to use.</source> <translation>Il file di dati temporali da utilizzare.</translation> </message> </context> </TS>
gottcode/kapow
translations/kapow_it.ts
TypeScript
gpl-3.0
14,944
import React, { Component, PropTypes } from 'react' import { connect } from 'react-redux' import { bindActionCreators } from 'redux' import { requestGetNotifications, requestDeleteNotification } from './NotificationActions' import { getNotifications } from './NotificationReducer' import NotificationList from './components/NotificationList/NotificationList' // Import Style import styles from './Notification.css' class Notification extends Component { constructor(props) { super(props) this.state = {} } componentDidMount() { this.props.getNotifications() } render() { return ( <div className={styles.notification}> <NotificationList notifications={this.props.notifications} deleteNotification={this.props.deleteNotification} >Replies</NotificationList> <NotificationList notifications={[]} deleteNotification={this.props.deleteNotification} >Followed Links</NotificationList> </div> ) } } const mapStateToProps = (state) => { return { notifications: getNotifications(state) } } const mapDispatchToProps = (dispatch) => { return { getNotifications: bindActionCreators(requestGetNotifications, dispatch), deleteNotification: bindActionCreators(requestDeleteNotification, dispatch) } } Notification.propTypes = { notifications: PropTypes.arrayOf(PropTypes.object).isRequired, getNotifications: PropTypes.func.isRequired, deleteNotification: PropTypes.func.isRequired } export default connect( mapStateToProps, mapDispatchToProps )(Notification)
caleb272/ProjectAccent
client/modules/Notification/Notification.js
JavaScript
gpl-3.0
1,601
@echo off setlocal echo. echo WARNING: YOU ARE GOING TO DO A BRUTE FORCE REINTEGRATION pause echo. echo I hope you know what you're doing pause if .%1.==.. goto usage if not .%2.==.. set client_flag=-c %2 if .%2.==.pause. set pause_end=pause if .%3.==.pause. set pause_end=pause if .%4.==.pause. set pause_end=pause set to_main_mergeflags=-at if .%2.==.mutex. set to_main_mergeflags=-at if .%3.==.mutex. set to_main_mergeflags=-at if .%4.==.mutex. set to_main_mergeflags=-at set dir=from_main p4 %client_flag% info | grep "Client name" | grep -q "main" if not errorlevel 1 set dir=to_main if .%dir%.==.to_main. set reverse_flag=-r if .%dir%.==.to_main. set from_to=to if .%dir%.==.to_main. set merge_flags=%to_main_mergeflags% if .%dir%.==.from_main. set from_to=from if .%dir%.==.from_main. set merge_flags=-at echo Integrate %from_to% main, client: p4 %client_flag% info | grep "Client name" | sed "s/Client name: / /" echo Using branchspec: echo %1 echo. echo. echo Checking if integration needed... p4 %client_flag% integrate %reverse_flag% -n -f -d -i -b %1 ... 2>&1 | grep -q "All revision(s) already integrated" if not errorlevel 1 goto nothing_to_do echo. echo Starting integration... p4 %client_flag% opened 2>&1 | grep -q "File(s) not opened on this client" if not errorlevel 1 goto prep_changelist echo. echo WARNING: You have files opened on this client. It is recommended you submit echo changes prior to doing an integraton. echo. pause :prep_changelist p4 %client_flag% opened 2>&1 | grep -q "edit default" if errorlevel 1 goto integrate echo. echo Moving files in default changelist to new changelist... p4 %client_flag% change -o | sed -e "s/<enter description here>/Pre-merge default/g" | p4 %client_flag% change -i :integrate echo. echo Syncing... p4 %client_flag% sync echo. echo Integrating... p4 %client_flag% integrate %reverse_flag% -f -d -i -b %1 ... p4 %client_flag% opened 2>&1 | grep -q "integrate default" if errorlevel 1 goto nofiles echo. echo Creating new changlist, description "Forced reintegration %from_to% main (%1)" p4 %client_flag% change -o | sed -e "s/<enter description here>/Forced reintegration %from_to% main (%1)/g" | p4 %client_flag% change -i echo. echo Resolving... p4 %client_flag% resolve -n 2>&1 | grep -q "No file(s) to resolve." if not errorlevel 1 goto end p4 %client_flag% resolve %merge_flags% p4 %client_flag% resolve -at .../*.lib p4 %client_flag% resolve -at .../*.exe p4 %client_flag% resolve -at .../*.dll echo. echo. echo Pause carefully examine results before submitting echo. echo. pause p4 %client_flag% resolve -n 2>&1 | grep -q "No file(s) to resolve." if not errorlevel 1 goto end echo. echo. echo ** The following files still require resolving: echo. p4 %client_flag% resolve -n | sed -e "s/ - merging.*//g" goto end :nothing_to_do echo All revision(s) already integrated. goto end :usage echo p4mf [branch] [clientname] echo Merge from specified branch goto end :nofiles Echo no files to integrate? :end echo Done. %pause_end%
RaisingTheDerp/raisingthebar
root/devtools/bin/p4reint.bat
Batchfile
gpl-3.0
3,042
java -jar -server -Dcom.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump=false -Dfile.encoding=UTF-8 -Xms256m -Xmx1024m -XX:MaxPermSize=512M -XX:-HeapDumpOnOutOfMemoryError -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC target/project-1.0-SNAPSHOT.jar %1 %2
diegolovison/master-degree
heuristic_and_meta-heuristic_search/project/run.cmd
Batchfile
gpl-3.0
370
# Teacher Quiz - Python Code - Elizabeth Tweedale import csv, random def askName(): # askName function returns the name of the student print("Welcome to the Super Python Quiz!") yourName = input("What is your name? ") print ("Hello",str(yourName)) return yourName def getQuestions(): # getQuestions reads in the questions from a CSV file questions = [] # this creates an empty list for adding the questions to with open("SuperPythonQuiz.csv", mode="r", encoding="utf-8") as myFile: myQuiz = csv.reader(myFile) for row in myQuiz: questions.append(row) return questions def askQuestion(question,score): # askQuestion prints the question and choices to the screen then checks the answer print(question[0]) # print the question - this is in the [0] position of the row for eachChoice in question[1:-1]: # print each choice from [1] to the last position [-1] print("{0:>5}{1}".format("", eachChoice)) answer = input("Please select an answer: ") # get the student's answer if answer == question[-1]: # check if the answer matches the last position in the question, the correct answer print("Correct!") # if it's correct, tell the user and add one to the score score += 1 else: # if it's incorrect, tell the user what the correct answer was print("Incorrect, the correct answer was {0}.".format(question[-1])) return score # return the score def recordScore(studentName, score): with open("QuizResults.txt", mode="a+",encoding="utf-8") as myFile: # note the '+' sign after the a means if the file does not exist, then create it myFile.write(str(studentName) + "," + str(score) + "\n") # write name,score to the file # "\n" will add a new line to the file so that it's ready for the next name def main(): studentName = askName() # call the askName function questions = getQuestions() # call the getQuestions function score = 0 # initialise the score to 0 number = len(questions) # use the number to keep track of the total number of questions - which is the length of the 'questions' list for eachQuestion in range(number): # reppeat for each question question = random.choice(questions) # choose a random question from the questions list score = askQuestion(question,score) # ask the question and update the score questions.remove(question) # remove the current question from the list so that you don't ask it again print("Your final score is:", score, "out of:", number) # tell the user what their final score is recordScore(studentName, score) # call the recordScore function main()
elizabethtweedale/HowToCode2
SuperSkill-08-Teacher/Teacher-Quiz.py
Python
gpl-3.0
3,594
<head> <title>Fresh House</title> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.2/semantic.min.css"></link> </head> <body> <div id="render-target" style="height: 100%"> </div> </body>
prisma-ninja/freshorder
client/main.html
HTML
gpl-3.0
224
#pragma once #include "stdafx.h" using namespace irr; using namespace video; using namespace System; namespace IrrlichtLime { namespace Video { [Flags] /// <summary> /// Enumeration values for enabling/disabling color planes for rendering. /// </summary> public enum class ColorPlane { /// <summary> /// No color enabled. /// </summary> None = ECP_NONE, /// <summary> /// Alpha enabled. /// </summary> Alpha = ECP_ALPHA, /// <summary> /// Red enabled. /// </summary> Red = ECP_RED, /// <summary> /// Green enabled. /// </summary> Green = ECP_GREEN, /// <summary> /// Blue enabled. /// </summary> Blue = ECP_BLUE, /// <summary> /// All colors, no alpha. /// </summary> RGB = ECP_RGB, /// <summary> /// All planes enabled. /// </summary> All = ECP_ALL }; } // end namespace Video } // end namespace IrrlichtLime
Traderain/Wolven-kit
WolvenKit.IrrlichtLime/ColorPlane.h
C
gpl-3.0
884
/* * AC - A source-code copy detector * * For more information please visit: http://github.com/manuel-freire/ac2 * * **************************************************************************** * * This file is part of AC, version 2.x * * AC is free software: you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * AC is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with AC. If not, see <http://www.gnu.org/licenses/>. */ package es.ucm.fdi.clover.model; import es.ucm.fdi.clover.event.HierarchyChangeEvent; import es.ucm.fdi.clover.event.StructureChangeEvent; import org.jdom2.Element; /** * A clustering engine understands how to build and update a ClusteringHierarchy. * It can also be asked to provide the importance of a vertex based on * focus distance. The idea is that ClusteringEngines are application-specific, * while ClusteringHierarchies are not. * * @author mfreire */ public interface ClusteringEngine { /** * Serialization support: save the state of the clustering (interesting * for quick restore of inner state; user-modified clusterings and the like) */ void save(Element e); /** * Serialization support: restore the clustering's state */ void restore(Element e); /** * Create a new hierarchy from the given base graph, starting at the * given rootVertex */ Cluster createHierarchy(BaseGraph base, Object rootVertex); /** * Update a hierarchy from the given BaseGraph (which has already been * updated with the changes in the sce), currently rooted at root, * and store the results in the provided hce. * Return the new root. */ Cluster updateHierarchy(Cluster root, BaseGraph base, StructureChangeEvent sce, HierarchyChangeEvent hce); }
manuel-freire/ac2
clover/src/main/java/es/ucm/fdi/clover/model/ClusteringEngine.java
Java
gpl-3.0
2,177