code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
var ScriptHelper = require('../lib/index.js');
// create an instance
var helper = ScriptHelper({
root: __dirname + '/scripts'
});
// 1-4 different ways to load your scriptfiles
// 5 retrieve code and shasum
var i = 0;
function next() {
i++;
switch (i) {
case 1:
// load the entire root directory
helper.loadDir(function (err, files) {
if (err) throw err;
console.log('Loaded script files in root directory:', files);
next();
});
break;
case 2:
// load the entire root directory
helper.loadDir('subdir', function (err, files) {
if (err) throw err;
console.log('Loaded script files in subdir directory:', files);
next();
});
break
case 3:
// load a single file
helper.load('test', function (err, code) {
if (err) throw err;
console.log('Code in test3.lua:', code);
next();
});
break;
case 4:
// load multiple files
helper.load('test2', 'test3', function (err, code) {
if (err) throw err;
console.log('Code in test3.lua:', code);
next();
});
break;
case 5:
// get a scripts code and its shasum
var code = helper.code('test');
var shasum = helper.shasum('test');
console.log('Assembled code of test.lua:');
console.log(code);
console.log('\n\nShasum of test.lua:', shasum);
next();
break;
}
}
next(); | klovadis/redis-lua-helper | example/index.js | JavaScript | mit | 1,345 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="he" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>CreateCoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2014 The CreateCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation>
זוהי תוכנה ניסיונית.
מופצת תחת רישיון התוכנה MIT/X11, ראה את הקובץ המצורף COPYING או http://www.opensource.org/licenses/mit-license.php.
המוצר הזה כולל תוכנה שפותחה ע"י פרויקט OpenSSL לשימוש בתיבת הכלים OpenSSL (http://www.openssl.org/) ותוכנה קריפטוגרפית שנכתבה ע"י אריק יאנג ([email protected]) ותוכנת UPnP שנכתבה ע"י תומס ברנרד.</translation>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>לחץ לחיצה כפולה לערוך כתובת או תוית</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>יצירת כתובת חדשה</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>העתק את הכתובת המסומנת ללוח העריכה</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-46"/>
<source>These are your CreateCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation>העתק כתובת</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a CreateCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>מחק את הכתובת שנבחרה מהרשימה</translation>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified CreateCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&מחק</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation>העתק תוית</translation>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation>עריכה</translation>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>קובץ מופרד בפסיקים (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>תוית</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>כתובת</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(ללא תוית)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>שיח סיסמא</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>הכנס סיסמה</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>סיסמה חדשה</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>חזור על הסיסמה החדשה</translation>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>For staking only</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>הכנס את הסיסמה החדשה לארנק. <br/>אנא השתמש בסיסמה המכילה <b>10 תוים אקראיים או יותר</b>, או <b>שמונה מילים או יותר</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>הצפן ארנק</translation>
</message>
<message>
<location line="+7"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>הפעולה הזו דורשת את סיסמת הארנק שלך בשביל לפתוח את הארנק.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>פתיחת ארנק</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>הפעולה הזו דורשת את סיסמת הארנק שלך בשביל לפענח את הארנק.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>פענוח ארנק</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>שינוי סיסמה</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>הכנס את הסיסמות הישנה והחדשה לארנק.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>אשר הצפנת ארנק</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>האם אתה בטוח שברצונך להצפין את הארנק?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>חשוב! כל גיבוי קודם שעשית לארנק שלך יש להחליף עם קובץ הארנק המוצפן שזה עתה נוצר. מסיבות אבטחה, גיבויים קודמים של קובץ הארנק הלא-מוצפן יהפכו לחסרי שימוש ברגע שתתחיל להשתמש בארנק החדש המוצפן.</translation>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>זהירות: מקש Caps Lock מופעל!</translation>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation>הארנק הוצפן</translation>
</message>
<message>
<location line="-58"/>
<source>CreateCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>הצפנת הארנק נכשלה</translation>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>הצפנת הארנק נכשלה עקב שגיאה פנימית. הארנק שלך לא הוצפן.</translation>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation>הסיסמות שניתנו אינן תואמות.</translation>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation>פתיחת הארנק נכשלה</translation>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>הסיסמה שהוכנסה לפענוח הארנק שגויה.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>פענוח הארנק נכשל</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>סיסמת הארנק שונתה בהצלחה.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+282"/>
<source>Sign &message...</source>
<translation>חתום על הודעה</translation>
</message>
<message>
<location line="+251"/>
<source>Synchronizing with network...</source>
<translation>מסתנכרן עם הרשת...</translation>
</message>
<message>
<location line="-319"/>
<source>&Overview</source>
<translation>&סקירה</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>הצג סקירה כללית של הארנק</translation>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation>&פעולות</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>דפדף בהיסטוריית הפעולות</translation>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation>י&ציאה</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>סגור תוכנה</translation>
</message>
<message>
<location line="+6"/>
<source>Show information about CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>אודות Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>הצג מידע על Qt</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&אפשרויות</translation>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation>הצפן ארנק</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>גיבוי ארנק</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>שנה סיסמא</translation>
</message>
<message numerus="yes">
<location line="+259"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-256"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Send coins to a CreateCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Modify configuration options for CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation>גיבוי הארנק למקום אחר</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>שנה את הסיסמה להצפנת הארנק</translation>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation>חלון ניפוי</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>פתח את לוח הבקרה לאבחון וניפוי</translation>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation>אמת הודעה...</translation>
</message>
<message>
<location line="-202"/>
<source>CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation>ארנק</translation>
</message>
<message>
<location line="+180"/>
<source>&About CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>הצג / הסתר</translation>
</message>
<message>
<location line="+9"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>&File</source>
<translation>&קובץ</translation>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation>ה&גדרות</translation>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation>&עזרה</translation>
</message>
<message>
<location line="+12"/>
<source>Tabs toolbar</source>
<translation>סרגל כלים טאבים</translation>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation>[רשת-בדיקה]</translation>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>CreateCoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+75"/>
<source>%n active connection(s) to CreateCoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="-312"/>
<source>About CreateCoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about CreateCoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+297"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation>עדכני</translation>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation>מתעדכן...</translation>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation>פעולה שנשלחה</translation>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation>פעולה שהתקבלה</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>תאריך: %1
כמות: %2
סוג: %3
כתובת: %4</translation>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid CreateCoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>הארנק <b>מוצפן</b> וכרגע <b>פתוח</b></translation>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>הארנק <b>מוצפן</b> וכרגע <b>נעול</b></translation>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation><numerusform>%n שעה</numerusform><numerusform>%n שעות</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation><numerusform>%n יום</numerusform><numerusform>%n ימים</numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. CreateCoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation>אזעקת רשת</translation>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation>כמות:</translation>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation>בייטים:</translation>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation>כמות:</translation>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation>קדימות:</translation>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation>תשלום:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation>לא</translation>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation>לאחר עמלה:</translation>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation>שינוי:</translation>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation>(מחק)(בחר) הכל</translation>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation>מצב עץ</translation>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation>מצר רשימה</translation>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation>כמות</translation>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation>כתובת</translation>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation>תאריך</translation>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation>אישורים</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation>מאושר</translation>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation>קדימות</translation>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation>העתק כתובת</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>העתק תוית</translation>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation>העתק כמות</translation>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation>העתק מזהה פעולה</translation>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation>העתק כמות</translation>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation>העתק מחיר</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>העתק קדימות</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation>הכי גבוה</translation>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation>גבוה</translation>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation>בנוני גבוה</translation>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation>בינוני</translation>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation>בינוני - נמוך</translation>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation>נמוך</translation>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation>הכי נמוך</translation>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation>כן</translation>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation>(ללא תוית)</translation>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation>עודף מ־%1 (%2)</translation>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation>(עודף)</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>ערוך כתובת</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>ת&וית</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&כתובת</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation>כתובת חדשה לקבלה</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>כתובת חדשה לשליחה</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>ערוך כתובת לקבלה</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>ערוך כתובת לשליחה</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>הכתובת שהכנסת "%1" כבר נמצאת בפנקס הכתובות.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid CreateCoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>פתיחת הארנק נכשלה.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>יצירת מפתח חדש נכשלה.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>CreateCoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>אפשרויות</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>ראשי</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>שלם &עמלת פעולה</translation>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start CreateCoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start CreateCoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation>רשת</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the CreateCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>מיפוי פורט באמצעות UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the CreateCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>כתובת IP של פרוקסי:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>פורט:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>הפורט של הפרוקסי (למשל 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>גרסת SOCKS:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>גרסת SOCKS של הפרוקסי (למשל 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>חלון</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>הצג סמל מגש בלבד לאחר מזעור החלון.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>מ&זער למגש במקום לשורת המשימות</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>מזער את התוכנה במקום לצאת ממנה כשהחלון נסגר. כשאפשרות זו פעילה, התוכנה תיסגר רק לאחר בחירת יציאה מהתפריט.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>מזער בעת סגירה</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>תצוגה</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>שפת ממשק המשתמש:</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting CreateCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>יחידת מדידה להצגת כמויות:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>בחר את ברירת המחדל ליחידת החלוקה אשר תוצג בממשק ובעת שליחת מטבעות.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show CreateCoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>הצג כתובות ברשימת הפעולות</translation>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>אישור</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>ביטול</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation>ברירת מחדל</translation>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting CreateCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>כתובת הפרוקסי שסופקה אינה תקינה.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>טופס</translation>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the CreateCoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation>ארנק</translation>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation>היתרה הזמינה הנוכחית</translation>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation>לא בשל:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>מאזן שנכרה וטרם הבשיל</translation>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation>סך הכול:</translation>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation>סך כל היתרה הנוכחית שלך</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>פעולות אחרונות</b></translation>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation>לא מסונכרן</translation>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>שם ממשק</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation>N/A</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>גרסת ממשק</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>מידע</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>משתמש ב-OpenSSL גרסה</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>זמן אתחול</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>רשת</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>מספר חיבורים</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>שרשרת הבלוקים</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>מספר הבלוקים הנוכחי</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>מספר כולל משוער של בלוקים</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>זמן הבלוק האחרון</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>פתח</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the CreateCoin-Qt help message to get a list with possible CreateCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>לוח בקרה</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>תאריך בניה</translation>
</message>
<message>
<location line="-104"/>
<source>CreateCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>CreateCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>קובץ יומן ניפוי</translation>
</message>
<message>
<location line="+7"/>
<source>Open the CreateCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>נקה לוח בקרה</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the CreateCoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>השתמש בחיצים למעלה ולמטה כדי לנווט בהיסטוריה, ו- <b>Ctrl-L</b> כדי לנקות את המסך.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>הקלד <b>help</b> בשביל סקירה של הפקודות הזמינות.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>שלח מטבעות</translation>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation>ה</translation>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation>נבחר אוטומאטית</translation>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation>אין מספיק כספים!</translation>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation>כמות:</translation>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation>בייטים:</translation>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation>כמות:</translation>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 BOST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation>קדימות:</translation>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation>תשלום:</translation>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation>לאחר עמלה:</translation>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation>שלח למספר מקבלים בו-זמנית</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>הוסף מקבל</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>נקה הכל</translation>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation>יתרה:</translation>
</message>
<message>
<location line="+16"/>
<source>123.456 BOST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>אשר את פעולת השליחה</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>שלח</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter a CreateCoin address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation>העתק כמות</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>העתק כמות</translation>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation>העתק מחיר</translation>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation>העתק קדימות</translation>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>אשר שליחת מטבעות</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>כתובת המקבל אינה תקינה, אנא בדוק שנית.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>הכמות לשלם חייבת להיות גדולה מ-0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>הכמות עולה על המאזן שלך.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>הכמות הכוללת, ובכללה עמלת פעולה בסך %1, עולה על המאזן שלך.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>כתובת כפולה נמצאה, ניתן לשלוח לכל כתובת רק פעם אחת בכל פעולת שליחה.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid CreateCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation>(ללא תוית)</translation>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>כ&מות:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>שלם &ל:</translation>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>הכנס תוית לכתובת הזאת כדי להכניס לפנקס הכתובות</translation>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation>ת&וית:</translation>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>הדבר כתובת מהלוח</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a CreateCoin address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>חתימות - חתום או אמת הודעה</translation>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation>חתום על הו&דעה</translation>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>אתה יכול לחתום על הודעות עם הכתובות שלך כדי להוכיח שהן בבעלותך. היזהר לא לחתום על משהו מעורפל, שכן התקפות פישינג עשויות לגרום לך בעורמה למסור את זהותך. חתום רק על אמרות מפורטות לחלוטין שאתה מסכים עימן.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation>הדבק כתובת מהלוח</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>הכנס כאן את ההודעה שעליך ברצונך לחתום</translation>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation>העתק את החתימה הנוכחית ללוח המערכת</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this CreateCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation>אפס את כל שדות החתימה על הודעה</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>נקה הכל</translation>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation>אמת הודעה</translation>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>הכנס למטה את הכתובת החותמת, ההודעה (ודא שאתה מעתיק מעברי שורה, רווחים, טאבים וכו' באופן מדויק) והחתימה כדי לאמת את ההודעה. היזהר לא לפרש את החתימה כיותר ממה שמופיע בהודעה החתומה בעצמה, כדי להימנע מליפול קורבן למתקפת איש-באמצע.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified CreateCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation>אפס את כל שדות אימות הודעה</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a CreateCoin address (e.g. Sjz75uKHzUQJnSdzvpiigEGxseKkDhQToX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>לחץ "חתום על ההודעה" כדי לחולל חתימה</translation>
</message>
<message>
<location line="+3"/>
<source>Enter CreateCoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>הכתובת שהוכנסה אינה תקינה.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>אנא בדוק את הכתובת ונסה שנית.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>הכתובת שהוכנסה אינה מתייחסת למפתח.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>פתיחת הארנק בוטלה.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>המפתח הפרטי עבור הכתובת שהוכנסה אינו זמין.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>החתימה על ההודעה נכשלה.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>ההודעה נחתמה.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>לא ניתן לפענח את החתימה.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>אנא בדוק את החתימה ונסה שנית.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>החתימה לא תואמת את תקציר ההודעה.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>אימות ההודעה נכשל.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>ההודעה אומתה.</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation>פתוח עד %1</translation>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation>%1/מנותק</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/ממתין לאישור</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 אישורים</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>מצב</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>, הופץ דרך צומת אחד</numerusform><numerusform>, הופץ דרך %n צמתים</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>תאריך</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>מקור</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>נוצר</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>מאת</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>אל</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>כתובת עצמית</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>תוית</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>זיכוי</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>מבשיל בעוד בלוק אחד</numerusform><numerusform>מבשיל בעוד %n בלוקים</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>לא התקבל</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>חיוב</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>עמלת פעולה</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>כמות נקיה</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>הודעה</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>הערה</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>זיהוי פעולה</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>מידע ניפוי</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>פעולה</translation>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation>קלטים</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>כמות</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>אמת</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>שקר</translation>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation>, טרם שודר בהצלחה</translation>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation>לא ידוע</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>פרטי הפעולה</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>חלונית זו מציגה תיאור מפורט של הפעולה</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation>תאריך</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>סוג</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>כתובת</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>כמות</translation>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation>פתוח עד %1</translation>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation>מאושר (%1 אישורים)</translation>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation><numerusform>פתח למשך בלוק %n יותר</numerusform><numerusform>פתח למשך %n בלוקים נוספים</numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>הבלוק הזה לא נקלט על ידי אף צומת אחר, וכנראה לא יתקבל!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>נוצר אך לא התקבל</translation>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation>התקבל עם</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>התקבל מאת</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>נשלח ל</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>תשלום לעצמך</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>נכרה</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(n/a)</translation>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>מצב הפעולה. השהה את הסמן מעל שדה זה כדי לראות את מספר האישורים.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>התאריך והשעה בה הפעולה הזאת התקבלה.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>סוג הפעולה.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>כתובת היעד של הפעולה.</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>הכמות שהתווספה או הוסרה מהיתרה.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation>הכל</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>היום</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>השבוע</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>החודש</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>החודש שעבר</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>השנה</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>טווח...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>התקבל עם</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>נשלח ל</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>לעצמך</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>נכרה</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>אחר</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>הכנס כתובת או תוית לחפש</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>כמות מזערית</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>העתק כתובת</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>העתק תוית</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>העתק כמות</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation>העתק מזהה פעולה</translation>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>ערוך תוית</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>הצג פרטי פעולה</translation>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>קובץ מופרד בפסיקים (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>מאושר</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>תאריך</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>סוג</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>תוית</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>כתובת</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>כמות</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>מזהה</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>טווח:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>אל</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>CreateCoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation>שימוש:</translation>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or CreateCoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation>רשימת פקודות</translation>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation>קבל עזרה עבור פקודה</translation>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation>אפשרויות:</translation>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: CreateCoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: CreateCoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>ציין תיקיית נתונים</translation>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>קבע את גודל המטמון של מסד הנתונים במגהבייט (ברירת מחדל: 25)</translation>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>החזק לכל היותר <n> חיבורים לעמיתים (ברירת מחדל: 125)</translation>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>התחבר לצומת כדי לדלות כתובות עמיתים, ואז התנתק</translation>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation>ציין את הכתובת הפומבית שלך</translation>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>סף להתנתקות מעמיתים הנוהגים שלא כהלכה (ברירת מחדל: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>מספר שניות למנוע מעמיתים הנוהגים שלא כהלכה מלהתחבר מחדש (ברירת מחדל: 86400)</translation>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>אירעה שגיאה בעת הגדרת פורט RPC %u להאזנה ב-IPv4: %s</translation>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>קבל פקודות משורת הפקודה ו- JSON-RPC</translation>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>רוץ ברקע כדימון וקבל פקודות</translation>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation>השתמש ברשת הבדיקה</translation>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>קבל חיבורים מבחוץ (ברירת מחדל: 1 ללא -proxy או -connect)</translation>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>אירעה שגיאה בעת הגדרת פורט RPC %u להאזנה ב-IPv6, נסוג ל-IPv4: %s</translation>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>אזהרה: -paytxfee נקבע לערך מאד גבוה! זוהי עמלת הפעולה שתשלם אם אתה שולח פעולה.</translation>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong CreateCoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation>אזהרה: שגיאה בקריאת wallet.dat! כל המתפחות נקראו באופן תקין, אך נתוני הפעולות או ספר הכתובות עלולים להיות חסרים או שגויים.</translation>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation>אזהרה: קובץ wallet.dat מושחת, המידע חולץ! קובץ wallet.dat המקורח נשמר כ - wallet.{timestamp}.bak ב - %s; אם המאזן או הפעולות שגויים עליך לשחזר גיבוי.</translation>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation>נסה לשחזר מפתחות פרטיים מקובץ wallet.dat מושחת.</translation>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation>אפשרויות יצירת בלוק:</translation>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation>התחבר רק לצמתים המצוינים</translation>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>גלה את כתובת ה-IP העצמית (ברירת מחדל: 1 כשמאזינים וללא -externalip)</translation>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>האזנה נכשלה בכל פורט. השתמש ב- -listen=0 אם ברצונך בכך.</translation>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>חוצץ קבלה מירבי לכל חיבור, <n>*1000 בתים (ברירת מחדל: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>חוצץ שליחה מירבי לכל חיבור, <n>*1000 בתים (ברירת מחדל: 1000)</translation>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>התחבר רק לצמתים ברשת <net> (IPv4, IPv6 או Tor)</translation>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation>אפשרויות SSL: (ראה את הויקי של ביטקוין עבור הוראות הגדרת SSL)</translation>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>שלח מידע דיבאג ועקבה לקונסולה במקום לקובץ debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>קבע את גודל הבלוק המינימלי בבתים (ברירת מחדל: 0)</translation>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>כווץ את קובץ debug.log בהפעלת הקליינט (ברירת מחדל: 1 ללא -debug)</translation>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>ציין הגבלת זמן לחיבור במילישניות (ברירת מחדל: 5000)</translation>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>השתמש ב-UPnP כדי למפות את הפורט להאזנה (ברירת מחדל: 0)</translation>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>השתמש ב-UPnP כדי למפות את הפורט להאזנה (ברירת מחדל: 1 בעת האזנה)</translation>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation>שם משתמש לחיבורי JSON-RPC</translation>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>אזהרה: הגרסה הזאת מיושנת, יש צורך בשדרוג!</translation>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation>קובץ wallet.dat מושחת, החילוץ נכשל</translation>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation>סיסמה לחיבורי JSON-RPC</translation>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=CreateCoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "CreateCoin Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>אפשר חיבורי JSON-RPC מכתובת האינטרנט המצוינת</translation>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>שלח פקודות לצומת ב-<ip> (ברירת מחדל: 127.0.0.1)</translation>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>בצע פקודה זו כשהבלוק הטוב ביותר משתנה (%s בפקודה יוחלף בגיבוב הבלוק)</translation>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation>בצע פקודה כאשר פעולת ארנק משתנה (%s ב cmd יוחלף ב TxID)</translation>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation>שדרג את הארנק לפורמט העדכני</translation>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>קבע את גודל המאגר ל -<n> (ברירת מחדל: 100)</translation>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>סרוק מחדש את שרשרת הבלוקים למציאת פעולות חסרות בארנק</translation>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>השתמש ב-OpenSSL (https( עבור חיבורי JSON-RPC</translation>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation>קובץ תעודת שרת (ברירת מחדל: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>מפתח פרטי של השרת (ברירת מחדל: server.pem)</translation>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation>הודעת העזרה הזו</translation>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. CreateCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-98"/>
<source>CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>לא מסוגל לקשור ל-%s במחשב זה (הקשירה החזירה שגיאה %d, %s)</translation>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>אפשר בדיקת DNS עבור -addnode, -seednode ו- -connect</translation>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation>טוען כתובות...</translation>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>שגיאה בטעינת הקובץ wallet.dat: הארנק מושחת</translation>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of CreateCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart CreateCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation>שגיאה בטעינת הקובץ wallet.dat</translation>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation>כתובת -proxy לא תקינה: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>רשת לא ידועה צוינה ב- -onlynet: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>התבקשה גרסת פרוקסי -socks לא ידועה: %i</translation>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>לא מסוגל לפתור כתובת -bind: '%s'</translation>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>לא מסוגל לפתור כתובת -externalip: '%s'</translation>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>כמות לא תקינה עבור -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation>כמות לא תקינה</translation>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation>אין מספיק כספים</translation>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation>טוען את אינדקס הבלוקים...</translation>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>הוסף צומת להתחברות ונסה לשמור את החיבור פתוח</translation>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. CreateCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation>טוען ארנק...</translation>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation>לא יכול להוריד דרגת הארנק</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation>לא יכול לכתוב את כתובת ברירת המחדל</translation>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation>סורק מחדש...</translation>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation>טעינה הושלמה</translation>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation>להשתמש באפשרות %s</translation>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation>שגיאה</translation>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>עליך לקבוע rpcpassword=yourpassword בקובץ ההגדרות:
%s
אם הקובץ אינו קיים, צור אותו עם הרשאות קריאה לבעלים בלבד.</translation>
</message>
</context>
</TS> | createcoin/CreateCoin | src/qt/locale/bitcoin_he.ts | TypeScript | mit | 121,079 |
import React from "react";
import Layout from "../components/layouts";
const Index = (props) => (
<Layout {...props}>
<div className="content-container">
<h1 className="page-title">Kristoffer Hedstrom</h1>
<div className="page-intro">
Kris Hedstrom is an interactive designer and developer. Currently in
Zürich, Switzerland.
</div>
</div>
</Layout>
);
export default Index;
| kristofferh/kristoffer | src/pages/index.js | JavaScript | mit | 424 |
// Copyright (c) Timm Krause. All rights reserved. See LICENSE file in the project root for license information.
namespace AspNet.Identity.OracleProvider.Tests.IntegrationTests.Stores
{
using System;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Oracle.ManagedDataAccess.Client;
[TestClass]
public class RoleStoreTests
{
private RoleStore _roleStore;
[TestInitialize]
public void TestInitialize()
{
var oracleDataContext = new OracleDataContext(new OracleConnection(Configuration.ConnectionString));
_roleStore = new RoleStore(oracleDataContext);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public async Task CreateWithNullRoleShouldThrow()
{
await _roleStore.CreateAsync(null);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public async Task DeleteAsyncWithNullRoleShouldThrow()
{
await _roleStore.DeleteAsync(null);
}
[TestMethod]
public async Task DeleteAsyncShouldDeleteRole()
{
var role = new IdentityRole(GetNewRandomName());
await _roleStore.CreateAsync(role);
await _roleStore.DeleteAsync(role);
var retrievedRole = await _roleStore.FindByIdAsync(role.Id);
Assert.IsNull(retrievedRole);
}
private string GetNewRandomName()
{
return Guid.NewGuid().ToString().Replace("-", string.Empty);
}
}
}
| timmkrause/AspNet.Identity.OracleProvider | src/AspNet.Identity.OracleProvider.Tests/IntegrationTests/Stores/RoleStoreTests.cs | C# | mit | 1,626 |
# Import required modules
import sys, time
from PySide.QtGui import *
from PySide.QtCore import *
from PySide.QtGui import QApplication, QWidget, QIcon
# import ipdb
# Our main window class
class SampleWindow(QWidget):
# Constructor function
def __init__(self):
super(SampleWindow, self).__init__()
self.initGUI()
def initGUI(self):
self.setWindowTitle("Sample Window")
self.setGeometry(600, 600, 700, 150)
self.setMinimumHeight(100)
self.setMinimumWidth(250)
self.setMaximumHeight(200)
self.setMaximumWidth(800)
appIcon = QIcon("icon.png")
self.setWindowIcon(appIcon)
print("Sample Window show in the GUI\n")
self.setIconModes()
self.show()
def setIconModes(self):
# ipdb.set_trace()
myIcon1 = QIcon('icon.png')
myLabel1 = QLabel('sample', self)
pixmap1 = myIcon1.pixmap(60, 60, QIcon.Active, QIcon.On)
myLabel1.setPixmap(pixmap1)
myLabel1.setToolTip('Active Icon')
myLabel1.show()
myIcon2 = QIcon('icon.png')
myLabel2 = QLabel('sample', self)
pixmap2 = myIcon2.pixmap(60, 60, QIcon.Disabled, QIcon.Off)
myLabel2.setToolTip('Disabled Icon')
myLabel2.setPixmap(pixmap2)
myLabel2.move(70, 0)
myLabel2.show()
myIcon3 = QIcon('icon.png')
myLabel3 = QLabel('sample', self)
myLabel3.setToolTip('Selected Icon')
pixmap3 = myIcon3.pixmap(60, 60, QIcon.Selected, QIcon.On)
myLabel3.setPixmap(pixmap3)
myLabel3.move(140, 0)
myLabel3.show()
if __name__ == '__main__':
# Exception Handling
try:
myApp = QApplication(sys.argv)
myWindow = SampleWindow()
QCoreApplication.processEvents()
time.sleep(3)
myWindow.resize(300, 300)
myWindow.setWindowTitle("Sample Window Resized")
myWindow.repaint()
myApp.exec_()
sys.exit(0)
except NameError:
print("Name Error:", sys.exc_info()[1])
except SystemExit:
print("Closing Window...")
except Exception:
print (sys.exc_info()[1])
| mandeeps708/pyside_practice | icons_with_tooltip.py | Python | mit | 2,166 |
define(
['view/RenderedView', 'view/UserList', 'view/UserPermissionsEditor', 'util/Util', 'data/Link', 'text!tmpl/Permissions.html'],
function (RenderedView, UserList, UserPermissionsEditor, Util, Link, tmpl) {
var This = RenderedView.extend({
template: _.template( tmpl ),
initialize: function() {
this.render();
this.modelObject = this.options.model;
this.type = this.options.type;
this.$users = $(".users",this.el);
this.$permissions = $(".permissions",this.el);
this.userList = new UserList();
this.$users.append(this.userList.el);
this.userPermissionsEditor = new UserPermissionsEditor({type:this.type,showRemove:true});
this.$permissions.append(this.userPermissionsEditor.el);
$(this.userList).on("UserSelected",$.proxy(this.userSelected,this))
.on("UserSelected",Util.debugEvent);
$(".add-user",this.el).click($.proxy(this.addUserClicked,this));
Link.getCurrentUser().asap($.proxy(function() {
this.setModel(this.options.model);
},this));
},
addUserClicked : function(e) {
e.preventDefault();
var email = prompt("Enter the user's email address");
var self = this;
if (!email) return;
Link.addUserByEmail({modelId:this.modelObject.id,email:email}).post().done(function() {
Link.getListedUsers({modelId:self.modelObject.id}).pull();
}).fail(function(data) {
consolelog(data);
alert("User not found!");
});
},
setModel : function(modelObject) {
this.modelObject = modelObject;
this.userPermissionsEditor.setModel(modelObject);
Link.loadAll([
["getUserAccess",{modelId:this.modelObject.id,userId:Link.getCurrentUser().getData().id}],
["getListedUsers",{modelId:this.modelObject.id}]
],$.proxy(this.usersLoaded,this),true);
},
usersLoaded : function() {
var users = Link.getListedUsers(this.modelObject.id).getData();
this.userList.setUsers(users);
this.userPermissionsEditor.loadUser(null);
},
userSelected : function(event,userId,user) {
Link.getUserAccess(this.modelObject.id,user.id).invalidate().loadOnce($.proxy(function(link) {
var currentUser = Link.getCurrentUser().getData();
var owner = _.groupBy(Link.getUserAccess(this.modelObject.id,currentUser.id).getData(),"name")["OWNER"] != null;
var canEditPermissions = true;
if (currentUser.id == user.id) canEditPermissions = false;
if (user.email == "guest") canEditPermissions = false;
if (owner) canEditPermissions = true;
if (currentUser.email == "root") canEditPermissions = true;
this.userPermissionsEditor.loadUser(user,canEditPermissions);
},this));
}
});
$.extend(This,{
});
return This;
}
)
| julianh2o/Podbase | public/javascripts/view/Permissions.js | JavaScript | mit | 2,807 |
/* GoomwWM, Get out of my way, Window Manager!
MIT/X11 License
Copyright (c) 2012 Sean Pringle <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define _GNU_SOURCE
#include "version.h"
#include "goomwwm.h"
#include "proto.h"
#include "util.c"
#include "box.c"
#include "textbox.c"
#include "winlist.c"
#include "rule.c"
#include "window.c"
#include "monitor.c"
#include "client.c"
#include "ewmh.c"
#include "tag.c"
#include "menu.c"
#include "handle.c"
#include "grab.c"
#include "cli.c"
#include "wm.c"
int main(int argc, char *argv[])
{
int i;
// catch help request
if (find_arg(argc, argv, "-help") >= 0
|| find_arg(argc, argv, "--help") >= 0
|| find_arg(argc, argv, "-h") >= 0)
{
fprintf(stderr, "See the man page or visit http://github.com/seanpringle/goomwwm\n");
return EXIT_SUCCESS;
}
// catch version request
if (find_arg(argc, argv, "-version") >= 0
|| find_arg(argc, argv, "--version") >= 0
|| find_arg(argc, argv, "-v") >= 0)
{
fprintf(stderr, "%s\n", VERSION);
return EXIT_SUCCESS;
}
if(!(display = XOpenDisplay(0)))
{
fprintf(stderr, "cannot open display!\n");
return EXIT_FAILURE;
}
signal(SIGCHLD, catch_exit);
screen = DefaultScreenOfDisplay(display);
screen_id = DefaultScreen(display);
root = DefaultRootWindow(display);
// X atom values
for (i = 0; i < ATOMS; i++) atoms[i] = XInternAtom(display, atom_names[i], False);
for (i = 0; i < GATOMS; i++) gatoms[i] = XInternAtom(display, gatom_names[i], False);
for (i = 0; i < NETATOMS; i++) netatoms[i] = XInternAtom(display, netatom_names[i], False);
return find_arg(argc, argv, "-cli") >= 0 ? cli_main(argc, argv): wm_main(argc, argv);
}
| seanpringle/goomwwm | goomwwm.c | C | mit | 2,660 |
var server = require('./support/server'),
request = require('supertest'),
should = require('should');
describe('req', function() {
describe('.accepts(type)', function() {
it('should return true when Accept is not present', function(done) {
var app = server();
app.before(function(req, res){
res.send(req.accepts('json') ? 'yes' : 'no');
});
app.on('ready', function() {
request(app)
.get('/foo/bar')
.end(function(err, res){
res.text.should.equal('yes');
done();
});
});
app.create();
});
it('should return true when Accept is present', function(done) {
var app = server();
app.before(function(req, res){
res.send(req.accepts('json') ? 'yes' : 'no');
});
app.on('ready', function() {
request(app)
.get('/foo/bar')
.set('Accept', 'application/json')
.end(function(err, res){
res.text.should.equal('yes');
done();
});
});
app.create();
});
it('should return false otherwise', function(done) {
var app = server();
app.before(function(req, res){
res.send(req.accepts('json') ? 'yes' : 'no');
});
app.on('ready', function() {
request(app)
.get('/foo/bar')
.set('Accept', 'text/html')
.end(function(err, res){
res.text.should.equal('no');
done();
});
});
app.create();
});
});
}); | School-Yard/Recess | test/req.accepts.js | JavaScript | mit | 1,526 |
var searchData=
[
['none',['None',['../d5/d76/Options_8h.html#a3c5d18364f664b5ad98e2ad610875cb5ac9d3e887722f2bc482bcca9d41c512af',1,'Options.h']]]
];
| forstermatth/Class-Scheduler | refman/search/enumvalues_6e.js | JavaScript | mit | 152 |
'use strict';
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = (function () {
// Init module configuration options
var applicationModuleName = 'mean';
var applicationModuleVendorDependencies = ['ngResource',
'ngAnimate', 'ngMessages', 'ui.router', 'ui.bootstrap', 'ui.utils', 'angularFileUpload' ,'uiGmapgoogle-maps'];
// Add a new vertical module
var registerModule = function (moduleName, dependencies) {
// Create angular module
angular.module(moduleName, dependencies || []);
// Add the module to the AngularJS configuration file
angular.module(applicationModuleName).requires.push(moduleName);
};
return {
applicationModuleName: applicationModuleName,
applicationModuleVendorDependencies: applicationModuleVendorDependencies,
registerModule: registerModule
};
})();
| Matt-Webb/mean-athlete-ukof | modules/core/client/app/config.js | JavaScript | mit | 874 |
import { Color } from 'gl2d/struct/color';
import * as $ from 'jquery';
import 'spectrum-colorpicker';
export type OnColorSet = (color: Color) => any;
export class ColorSetter {
private unconfirmedAlpha: number;
private constructor (
public input: JQuery,
public onColorSet: OnColorSet,
public alpha: number,
){ this.unconfirmedAlpha = alpha; }
static create(id: string, initialColor: string, onColorSet: OnColorSet){
let input = $('#' + id);
let color = Color.fromArgbString(initialColor);
let setter = new ColorSetter(input, onColorSet, color.a / 0xff);
input.spectrum({
color: initialColor,
flat: false,
showInput: false,
showInitial: false,
allowEmpty: false,
showAlpha: true,
disabled: false,
showPalette: true,
showPaletteOnly: true,
togglePaletteOnly: true,
showSelectionPalette: false,
clickoutFiresChange: true,
hideAfterPaletteSelect: true,
preferredFormat: "rgb",
palette: [
["#000", "#444", "#666", "#999", "#ccc", "#eee", "#f3f3f3", "#fff"],
["#f00", "#f90", "#ff0", "#0f0", "#0ff", "#00f", "#90f", "#f0f"],
["#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#9fc5e8", "#b4a7d6", "#d5a6bd"],
["#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6fa8dc", "#8e7cc3", "#c27ba0"],
["#c00", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3d85c6", "#674ea7", "#a64d79"],
["#900", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#0b5394", "#351c75", "#741b47"],
["#600", "#783f04", "#7f6000", "#274e13", "#0c343d", "#073763", "#20124d", "#4c1130"]
],
change: function (tinycolor) {
if (tinycolor) {
// Override alpha (in case of palette selection)
setter.confirmAlpha();
tinycolor.setAlpha(setter.alpha);
// Extract color
let argb = tinycolor.toHex8String();
let color = Color.fromArgbString(argb);
setter.setColor(color);
}
},
hide: function (tinycolor) {
setter.denyAlpha();
}
})
input.on("dragstop.spectrum", function (e, tinyColor) {
// Value will be confirmed if change event is called; denied if hide event is called.
setter.unconfirmedAlpha = tinyColor.getAlpha();
});
onColorSet(color);
return setter;
}
confirmAlpha(){
this.alpha = this.unconfirmedAlpha;
}
denyAlpha(){
this.unconfirmedAlpha = this.alpha;
}
setRandomColor(){
let color = Color.random();
color.a = (this.alpha * 0xff) | 0;
this.setColor(color);
}
setColor(color: Color){
let { input, onColorSet } = this;
input.spectrum("set", color.toArgbString());
onColorSet(color);
}
}
| wjheesen/vector-art | src/ts/setter/color.ts | TypeScript | mit | 3,151 |
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {
DOWN_ARROW,
END,
ENTER,
HOME,
LEFT_ARROW,
PAGE_DOWN,
PAGE_UP,
RIGHT_ARROW,
UP_ARROW,
SPACE,
} from '@angular/cdk/keycodes';
import {
AfterContentInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
Inject,
Input,
Optional,
Output,
ViewChild,
ViewEncapsulation,
} from '@angular/core';
import {DateAdapter, MAT_DATE_FORMATS, MatDateFormats} from '@angular/material/core';
import {Directionality} from '@angular/cdk/bidi';
import {MatCalendarBody, MatCalendarCell} from './calendar-body';
import {createMissingDateImplError} from './datepicker-errors';
/**
* An internal component used to display a single year in the datepicker.
* @docs-private
*/
@Component({
moduleId: module.id,
selector: 'mat-year-view',
templateUrl: 'year-view.html',
exportAs: 'matYearView',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MatYearView<D> implements AfterContentInit {
/** The date to display in this year view (everything other than the year is ignored). */
@Input()
get activeDate(): D { return this._activeDate; }
set activeDate(value: D) {
let oldActiveDate = this._activeDate;
const validDate =
this._getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
if (this._dateAdapter.getYear(oldActiveDate) !== this._dateAdapter.getYear(this._activeDate)) {
this._init();
}
}
private _activeDate: D;
/** The currently selected date. */
@Input()
get selected(): D | null { return this._selected; }
set selected(value: D | null) {
this._selected = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
this._selectedMonth = this._getMonthInCurrentYear(this._selected);
}
private _selected: D | null;
/** The minimum selectable date. */
@Input()
get minDate(): D | null { return this._minDate; }
set minDate(value: D | null) {
this._minDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
}
private _minDate: D | null;
/** The maximum selectable date. */
@Input()
get maxDate(): D | null { return this._maxDate; }
set maxDate(value: D | null) {
this._maxDate = this._getValidDateOrNull(this._dateAdapter.deserialize(value));
}
private _maxDate: D | null;
/** A function used to filter which dates are selectable. */
@Input() dateFilter: (date: D) => boolean;
/** Emits when a new month is selected. */
@Output() readonly selectedChange: EventEmitter<D> = new EventEmitter<D>();
/** Emits the selected month. This doesn't imply a change on the selected date */
@Output() readonly monthSelected: EventEmitter<D> = new EventEmitter<D>();
/** Emits when any date is activated. */
@Output() readonly activeDateChange: EventEmitter<D> = new EventEmitter<D>();
/** The body of calendar table */
@ViewChild(MatCalendarBody, {static: false}) _matCalendarBody: MatCalendarBody;
/** Grid of calendar cells representing the months of the year. */
_months: MatCalendarCell[][];
/** The label for this year (e.g. "2017"). */
_yearLabel: string;
/** The month in this year that today falls on. Null if today is in a different year. */
_todayMonth: number | null;
/**
* The month in this year that the selected Date falls on.
* Null if the selected Date is in a different year.
*/
_selectedMonth: number | null;
constructor(private _changeDetectorRef: ChangeDetectorRef,
@Optional() @Inject(MAT_DATE_FORMATS) private _dateFormats: MatDateFormats,
@Optional() public _dateAdapter: DateAdapter<D>,
@Optional() private _dir?: Directionality) {
if (!this._dateAdapter) {
throw createMissingDateImplError('DateAdapter');
}
if (!this._dateFormats) {
throw createMissingDateImplError('MAT_DATE_FORMATS');
}
this._activeDate = this._dateAdapter.today();
}
ngAfterContentInit() {
this._init();
}
/** Handles when a new month is selected. */
_monthSelected(month: number) {
const normalizedDate =
this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
this.monthSelected.emit(normalizedDate);
const daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);
this.selectedChange.emit(this._dateAdapter.createDate(
this._dateAdapter.getYear(this.activeDate), month,
Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
}
/** Handles keydown events on the calendar body when calendar is in year view. */
_handleCalendarBodyKeydown(event: KeyboardEvent): void {
// TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
// disabled ones from being selected. This may not be ideal, we should look into whether
// navigation should skip over disabled dates, and if so, how to implement that efficiently.
const oldActiveDate = this._activeDate;
const isRtl = this._isRtl();
switch (event.keyCode) {
case LEFT_ARROW:
this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
break;
case RIGHT_ARROW:
this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
break;
case UP_ARROW:
this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -4);
break;
case DOWN_ARROW:
this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 4);
break;
case HOME:
this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate,
-this._dateAdapter.getMonth(this._activeDate));
break;
case END:
this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate,
11 - this._dateAdapter.getMonth(this._activeDate));
break;
case PAGE_UP:
this.activeDate =
this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
break;
case PAGE_DOWN:
this.activeDate =
this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
break;
case ENTER:
case SPACE:
this._monthSelected(this._dateAdapter.getMonth(this._activeDate));
break;
default:
// Don't prevent default or focus active cell on keys that we don't explicitly handle.
return;
}
if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
this.activeDateChange.emit(this.activeDate);
}
this._focusActiveCell();
// Prevent unexpected default actions such as form submission.
event.preventDefault();
}
/** Initializes this year view. */
_init() {
this._selectedMonth = this._getMonthInCurrentYear(this.selected);
this._todayMonth = this._getMonthInCurrentYear(this._dateAdapter.today());
this._yearLabel = this._dateAdapter.getYearName(this.activeDate);
let monthNames = this._dateAdapter.getMonthNames('short');
// First row of months only contains 5 elements so we can fit the year label on the same row.
this._months = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]].map(row => row.map(
month => this._createCellForMonth(month, monthNames[month])));
this._changeDetectorRef.markForCheck();
}
/** Focuses the active cell after the microtask queue is empty. */
_focusActiveCell() {
this._matCalendarBody._focusActiveCell();
}
/**
* Gets the month in this year that the given Date falls on.
* Returns null if the given Date is in another year.
*/
private _getMonthInCurrentYear(date: D | null) {
return date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate) ?
this._dateAdapter.getMonth(date) : null;
}
/** Creates an MatCalendarCell for the given month. */
private _createCellForMonth(month: number, monthName: string) {
let ariaLabel = this._dateAdapter.format(
this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1),
this._dateFormats.display.monthYearA11yLabel);
return new MatCalendarCell(
month, monthName.toLocaleUpperCase(), ariaLabel, this._shouldEnableMonth(month));
}
/** Whether the given month is enabled. */
private _shouldEnableMonth(month: number) {
const activeYear = this._dateAdapter.getYear(this.activeDate);
if (month === undefined || month === null ||
this._isYearAndMonthAfterMaxDate(activeYear, month) ||
this._isYearAndMonthBeforeMinDate(activeYear, month)) {
return false;
}
if (!this.dateFilter) {
return true;
}
const firstOfMonth = this._dateAdapter.createDate(activeYear, month, 1);
// If any date in the month is enabled count the month as enabled.
for (let date = firstOfMonth; this._dateAdapter.getMonth(date) == month;
date = this._dateAdapter.addCalendarDays(date, 1)) {
if (this.dateFilter(date)) {
return true;
}
}
return false;
}
/**
* Tests whether the combination month/year is after this.maxDate, considering
* just the month and year of this.maxDate
*/
private _isYearAndMonthAfterMaxDate(year: number, month: number) {
if (this.maxDate) {
const maxYear = this._dateAdapter.getYear(this.maxDate);
const maxMonth = this._dateAdapter.getMonth(this.maxDate);
return year > maxYear || (year === maxYear && month > maxMonth);
}
return false;
}
/**
* Tests whether the combination month/year is before this.minDate, considering
* just the month and year of this.minDate
*/
private _isYearAndMonthBeforeMinDate(year: number, month: number) {
if (this.minDate) {
const minYear = this._dateAdapter.getYear(this.minDate);
const minMonth = this._dateAdapter.getMonth(this.minDate);
return year < minYear || (year === minYear && month < minMonth);
}
return false;
}
/**
* @param obj The object to check.
* @returns The given object if it is both a date instance and valid, otherwise null.
*/
private _getValidDateOrNull(obj: any): D | null {
return (this._dateAdapter.isDateInstance(obj) && this._dateAdapter.isValid(obj)) ? obj : null;
}
/** Determines whether the user has the RTL layout direction. */
private _isRtl() {
return this._dir && this._dir.value === 'rtl';
}
}
| jelbourn/material2 | src/material/datepicker/year-view.ts | TypeScript | mit | 10,760 |
The MIT License (MIT)
Copyright (c) 2014 Mark Stiles
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| markstiles/SitecoreTestStar | LICENSE.md | Markdown | mit | 1,078 |
# 快排
## 笔记
## 练习解答
* [ ] [2.3.1](./2.3.1/main.go)
* [ ] [2.3.2](./2.3.2/main.go)
* [ ] [2.3.3](./2.3.3/main.go)
* [ ] [2.3.4](./2.3.4/main.go)
* [ ] [2.3.5](./2.3.5/main.go)
* [ ] [2.3.6](./2.3.6/main.go)
* [ ] [2.3.7](./2.3.7/main.go)
* [ ] [2.3.8](./2.3.8/main.go)
* [ ] [2.3.9](./2.3.9/main.go)
* [ ] [2.3.10](./2.3.10/main.go)
* [ ] [2.3.11](./2.3.11/main.go)
* [ ] [2.3.12](./2.3.12/main.go)
* [ ] [2.3.13](./2.3.13/main.go)
* [ ] [2.3.14](./2.3.14/main.go)
* [ ] [2.3.15](./2.3.15/main.go)
* [ ] [2.3.16](./2.3.16/main.go)
* [ ] [2.3.17](./2.3.17/main.go)
* [ ] [2.3.18](./2.3.18/main.go)
* [ ] [2.3.19](./2.3.19/main.go)
* [ ] [2.3.20](./2.3.20/main.go)
* [ ] [2.3.21](./2.3.21/main.go)
* [ ] [2.3.22](./2.3.22/main.go)
* [ ] [2.3.23](./2.3.23/main.go)
* [ ] [2.3.24](./2.3.24/main.go)
* [ ] [2.3.25](./2.3.25/main.go)
* [ ] [2.3.26](./2.3.26/main.go)
* [ ] [2.3.27](./2.3.27/main.go)
* [ ] [2.3.28](./2.3.28/main.go)
* [ ] [2.3.29](./2.3.29/main.go)
* [ ] [2.3.30](./2.3.30/main.go)
* [ ] [2.3.31](./2.3.31/main.go)
| aQuaYi/Algorithms-in-Golang | Solutions/Algorithms4E/2.Sorting/2.3.QuickSort/README.md | Markdown | mit | 1,042 |
<!DOCTYPE html>
<HTML><head><TITLE>Manpage of PERF\-STAT</TITLE>
<meta charset="utf-8">
<link rel="stylesheet" href="/css/main.css" type="text/css">
</head>
<body>
<header class="site-header">
<div class="wrap"> <div class="site-title"><a href="/manpages/index.html">linux manpages</a></div>
<div class="site-description">{"type":"documentation"}</div>
</div>
</header>
<div class="page-content"><div class="wrap">
<H1>PERF\-STAT</H1>
Section: Misc. Reference Manual Pages (1)<BR>Updated: 10/16/2012<BR><A HREF="#index">Index</A>
<A HREF="/manpages/index.html">Return to Main Contents</A><HR>
<A NAME="lbAB"> </A>
<H2>NAME</H2>
perf-stat - Run a command and gather performance counter statistics
<A NAME="lbAC"> </A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>perf stat</I> [-e <EVENT> | --event=EVENT] [-a] <command>
<I>perf stat</I> [-e <EVENT> | --event=EVENT] [-a] --- <command> [<options>]
</PRE>
<A NAME="lbAD"> </A>
<H2>DESCRIPTION</H2>
<P>
This command runs a command and gathers performance counter statistics from it.
<A NAME="lbAE"> </A>
<H2>OPTIONS</H2>
<P>
<command>...
<DL COMPACT><DT><DD>
Any command you can specify in a shell.
</DL>
<P>
-e, --event=
<DL COMPACT><DT><DD>
Select the PMU event. Selection can be a symbolic event name (use
<I>perf list</I>
to list all events) or a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a hexadecimal event descriptor.
</DL>
<P>
-i, --no-inherit
<DL COMPACT><DT><DD>
child tasks do not inherit counters
</DL>
<P>
-p, --pid=<pid>
<DL COMPACT><DT><DD>
stat events on existing process id
</DL>
<P>
-t, --tid=<tid>
<DL COMPACT><DT><DD>
stat events on existing thread id
</DL>
<P>
-a, --all-cpus
<DL COMPACT><DT><DD>
system-wide collection from all CPUs
</DL>
<P>
-c, --scale
<DL COMPACT><DT><DD>
scale/normalize counter values
</DL>
<P>
-r, --repeat=<n>
<DL COMPACT><DT><DD>
repeat command and print average + stddev (max: 100)
</DL>
<P>
-B, --big-num
<DL COMPACT><DT><DD>
print large numbers with thousands' separators according to locale
</DL>
<P>
-C, --cpu=
<DL COMPACT><DT><DD>
Count only on the list of CPUs provided. Multiple CPUs can be provided as a comma-separated list with no space: 0,1. Ranges of CPUs are specified with -: 0-2. In per-thread mode, this option is ignored. The -a option is still necessary to activate system-wide monitoring. Default is to count on all CPUs.
</DL>
<P>
-A, --no-aggr
<DL COMPACT><DT><DD>
Do not aggregate counts across all monitored CPUs in system-wide mode (-a). This option is only valid in system-wide mode.
</DL>
<P>
-n, --null
<DL COMPACT><DT><DD>
null run - doncqt start any counters
</DL>
<P>
-v, --verbose
<DL COMPACT><DT><DD>
be more verbose (show counter open errors, etc)
</DL>
<P>
-x SEP, --field-separator SEP
<DL COMPACT><DT><DD>
print counts using a CSV-style output to make it easy to import directly into spreadsheets. Columns are separated by the string specified in SEP.
</DL>
<P>
-G name, --cgroup name
<DL COMPACT><DT><DD>
monitor only in the container (cgroup) called "name". This option is available only in per-cpu mode. The cgroup filesystem must be mounted. All threads belonging to container "name" are monitored when they run on the monitored CPUs. Multiple cgroups can be provided. Each cgroup is applied to the corresponding event, i.e., first cgroup to first event, second cgroup to second event and so on. It is possible to provide an empty cgroup (monitor all the time) using, e.g., -G foo,,bar. Cgroups must have corresponding events, i.e., they always refer to events defined earlier on the command line.
</DL>
<P>
-o file, --output file
<DL COMPACT><DT><DD>
Print the output into the designated file.
</DL>
<P>
--append
<DL COMPACT><DT><DD>
Append to the output file designated with the -o option. Ignored if -o is not specified.
</DL>
<P>
--log-fd
<DL COMPACT><DT><DD>
Log output to fd, instead of stderr. Complementary to --output, and mutually exclusive with it. --append may be used here. Examples: 3>results perf stat --log-fd 3 --- $cmd 3>>results perf stat --log-fd 3 --append --- $cmd
</DL>
<A NAME="lbAF"> </A>
<H2>EXAMPLES</H2>
<P>
$ perf stat --- make -j
<P>
<DL COMPACT><DT><DD>
<PRE>
Performance counter stats for 'make -j':
</PRE>
</DL>
<P>
<DL COMPACT><DT><DD>
<PRE>
8117.370256 task clock ticks # 11.281 CPU utilization factor
678 context switches # 0.000 M/sec
133 CPU migrations # 0.000 M/sec
235724 pagefaults # 0.029 M/sec
24821162526 CPU cycles # 3057.784 M/sec
18687303457 instructions # 2302.138 M/sec
172158895 cache references # 21.209 M/sec
27075259 cache misses # 3.335 M/sec
</PRE>
</DL>
<P>
<DL COMPACT><DT><DD>
<PRE>
Wall-clock time elapsed: 719.554352 msecs
</PRE>
</DL>
<A NAME="lbAG"> </A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/manpages/index.html?1+perf-top">perf-top</A></B>(1), <B><A HREF="http://localhost/cgi-bin/man/man2html?1+perf-list">perf-list</A></B>(1)
<P>
<HR>
<A NAME="index"> </A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">OPTIONS</A><DD>
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/manpages/index.html">man2html</A>,
using the manual pages.<BR>
Time: 05:29:07 GMT, December 24, 2015
</div></div>
</body>
</HTML>
| yuweijun/yuweijun.github.io | manpages/man1/perf-stat.1.html | HTML | mit | 5,617 |
var _ = require('underscore');
var DeviationStream = require('standard-deviation-stream');
module.exports = {
calculate: function (walkingData) {
var i, entry, numbers, distanceMeters, total_meters, plus_5km_day_count, day_count,
max_in_a_day_meters, min_in_a_day_meters, top_day,
plus_10km_day_count, plus_20km_day_count;
numbers = new DeviationStream();
total_meters = 0;
max_in_a_day_meters = -Infinity;
min_in_a_day_meters = Infinity;
plus_5km_day_count = 0;
plus_10km_day_count = 0;
plus_20km_day_count = 0;
day_count = 0;
for (i = 0; i < walkingData.length; i++) {
entry = walkingData[i];
if (!entry.passesFilters) {
continue;
}
day_count++;
distanceMeters = entry.distanceMeters;
numbers.push(distanceMeters);
total_meters += distanceMeters;
if (distanceMeters > max_in_a_day_meters) {
max_in_a_day_meters = distanceMeters;
top_day = entry.dateRef;
}
min_in_a_day_meters = Math.min(min_in_a_day_meters, distanceMeters);
if (distanceMeters > 5000) {
plus_5km_day_count++;
}
if (distanceMeters > 10000) {
plus_10km_day_count++;
}
if (distanceMeters > 20000) {
plus_20km_day_count++;
}
}
return {
day_count: day_count,
plus_5km_day_count: plus_5km_day_count,
plus_10km_day_count: plus_10km_day_count,
plus_20km_day_count: plus_20km_day_count,
total_meters: total_meters,
avg_distance_in_a_day_meters: numbers.mean(),
avg_distance_in_a_day_std_dev_meters: numbers.standardDeviation(),
max_in_a_day_meters: max_in_a_day_meters,
min_in_a_day_meters: min_in_a_day_meters,
top_day: top_day
};
}
}; | lfac-pt/react-walking-data | src/store/metrics.js | JavaScript | mit | 1,648 |
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../test/dummy/config/environment", __FILE__)
require 'rspec/rails'
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
end
| huynhquancam/bootstrap_validator_rails | spec/rails_helper.rb | Ruby | mit | 1,977 |
(function() {
'use strict';
function Ipsum(numberParagraphs, wordCollection) {
var paragraphArray = [];
var numberWordsInParagraph;
var randomString;
if (wordCollection.length) {
for (var i = 0; i < numberParagraphs; i++) {
numberWordsInParagraph = this.getRandom(5, 10);
randomString = [];
for (var j = 0; j < numberWordsInParagraph; j++) {
randomString.push(wordCollection[this.getRandom(1, wordCollection.length)]);
}
if (randomString.length) {
paragraphArray.push(randomString.join(' '));
}
}
}
return paragraphArray;
}
// Returns a random number between min and max
Ipsum.prototype.getRandom = function(min, max) {
return (Math.round(Math.random() * (max - min) + min)) - 1;
};
window.Ipsum = Ipsum;
})(); | Marlena/ipsum | public/js/ipsum.js | JavaScript | mit | 840 |
#!python
#coding=utf-8
# Author : Simon Huang
# Mail : [email protected]
# Time : '2016-06-06 11:56:58'
#
__author__ = 'simon_huang'
__version__ = "0.0.1"
__date__ = "2016-06-06 11:57:22"
__maintainer__ = "simon_huang"
__email__ = "thelongestusernameofall#gmail.com"
__copyright__ = "Copyright 2015, " + __author__
__license__ = "MIT"
__status__ = "Prototype"
__credits__ = [""]
__description__= "Use IDAPython"
from idaapi import *
from idautils import *
from idc import *
import traceback
import os
import sys
dbgStrCmtor=None
#333333333333333333333333333333333333333333333333333333333333333333
TEA_algorithm_name = "<<TEA>>"
TEA_algorithm_SBox = [0x9e3779b9]
SHA256_algorithm_name="<<SHA256>>"
SHA256_algorithm_SBox = [
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,
0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,
0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,
0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,
0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,
0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,
0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,
]
SHA512_algorithm_name="<<SHA512>>"
SHA512_algorithm_SBox=[
0x428a2f98,0xd728ae22,0x71374491,0x23ef65cd,0xb5c0fbcf,0xec4d3b2f,0xe9b5dba5,0x8189dbbc,
0x3956c25b,0xf348b538,0x59f111f1,0xb605d019,0x923f82a4,0xaf194f9b,0xab1c5ed5,0xda6d8118,
0xd807aa98,0xa3030242,0x12835b01,0x45706fbe,0x243185be,0x4ee4b28c,0x550c7dc3,0xd5ffb4e2,
0x72be5d74,0xf27b896f,0x80deb1fe,0x3b1696b1,0x9bdc06a7,0x25c71235,0xc19bf174,0xcf692694,
0xe49b69c1,0x9ef14ad2,0xefbe4786,0x384f25e3,0x0fc19dc6,0x8b8cd5b5,0x240ca1cc,0x77ac9c65,
0x2de92c6f,0x592b0275,0x4a7484aa,0x6ea6e483,0x5cb0a9dc,0xbd41fbd4,0x76f988da,0x831153b5,
0x983e5152,0xee66dfab,0xa831c66d,0x2db43210,0xb00327c8,0x98fb213f,0xbf597fc7,0xbeef0ee4,
0xc6e00bf3,0x3da88fc2,0xd5a79147,0x930aa725,0x06ca6351,0xe003826f,0x14292967,0x0a0e6e70,
0x27b70a85,0x46d22ffc,0x2e1b2138,0x5c26c926,0x4d2c6dfc,0x5ac42aed,0x53380d13,0x9d95b3df,
0x650a7354,0x8baf63de,0x766a0abb,0x3c77b2a8,0x81c2c92e,0x47edaee6,0x92722c85,0x1482353b,
0xa2bfe8a1,0x4cf10364,0xa81a664b,0xbc423001,0xc24b8b70,0xd0f89791,0xc76c51a3,0x0654be30,
0xd192e819,0xd6ef5218,0xd6990624,0x5565a910,0xf40e3585,0x5771202a,0x106aa070,0x32bbd1b8,
0x19a4c116,0xb8d2d0c8,0x1e376c08,0x5141ab53,0x2748774c,0xdf8eeb99,0x34b0bcb5,0xe19b48a8,
0x391c0cb3,0xc5c95a63,0x4ed8aa4a,0xe3418acb,0x5b9cca4f,0x7763e373,0x682e6ff3,0xd6b2b8a3,
0x748f82ee,0x5defb2fc,0x78a5636f,0x43172f60,0x84c87814,0xa1f0ab72,0x8cc70208,0x1a6439ec,
0x90befffa,0x23631e28,0xa4506ceb,0xde82bde9,0xbef9a3f7,0xb2c67915,0xc67178f2,0xe372532b,
0xca273ece,0xea26619c,0xd186b8c7,0x21c0c207,0xeada7dd6,0xcde0eb1e,0xf57d4f7f,0xee6ed178,
0x06f067aa,0x72176fba,0x0a637dc5,0xa2c898a6,0x113f9804,0xbef90dae,0x1b710b35,0x131c471b,
0x28db77f5,0x23047d84,0x32caab7b,0x40c72493,0x3c9ebe0a,0x15c9bebc,0x431d67c4,0x9c100d4c,
0x4cc5d4be,0xcb3e42b6,0x597f299c,0xfc657e2a,0x5fcb6fab,0x3ad6faec,0x6c44198c,0x4a475817,
]
CRC32_algorithm_name="<<CRC32>>"
CRC32_algorithm_SBox=[
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
]
MD5_algorithm_name="<<MD5>>"
MD5_algorithm_SBox=[
0X67452301L,0XEFCDAB89L,0X98BADCFEL,0X10325476L
]
SHA1_algorithm_name="<<SHA1>>"
SHA1_algorithm_SBox=[
0x67452301,0xEFCDAB89,0x98BADCFE,0x10325476,0xC3D2E1F0
]
algorithmNameList = [
TEA_algorithm_name,SHA256_algorithm_name,SHA512_algorithm_name,SHA1_algorithm_name,CRC32_algorithm_name,MD5_algorithm_name
]
algorithmSBoxList = [
TEA_algorithm_SBox,SHA256_algorithm_SBox,SHA512_algorithm_SBox,SHA1_algorithm_SBox,CRC32_algorithm_SBox,MD5_algorithm_SBox
]
#jump operations
INST_JUMP = ['BLX','BL','BX','B','CBNZ','CBZ']
#arithmetic operations
INST_ADD = ['ADC','ADD']
INST_SUB = ['RSB','RSC','SBC','SUB']
INST_MUL = ['MUL','MLA'] # MLA multiple add
#Logical operations
INST_LOG = ['ORR','EOR','AND','BIC']
#Compare instructions
INST_CMP = ['CMN','CMP','TEQ','TST']
#interrupt instruction
INST_INT = ['SWI']
#Data move operations
INST_MOV = ['MOV',
'MRC',#协处理器
'MRS',#
'MSR',#
'MVN',
'LDC',#协处理器
'LDM',# rd为地址的内存块到寄存器组 ->
'LDR',#内存到寄存器
'MCR',
'CDP',
'STC',
'STM',#
'STR',
'SWP'
]
#the 0 opnd is the destination opnd
INST_MOV_TO = ['MOV','MVN','LDR']#'STM'
#the 0 opnd is the source, and the 1 opnd is destination
INST_MOV_BACK = ['STR']#'LDM'
#the 0 opnd is the source and destination of 1 opnd
INST_MOV_SWAP = ['SWP']
INST_SHIFT = ['LSL', 'LSR', 'ASR', 'ROR', 'RRX']
INST_DICT = {
'JUMP':INST_JUMP,
'ADD':INST_ADD,
'SUB':INST_SUB,
'MUL':INST_MUL,
'LOG':INST_LOG,
'CMP':INST_CMP,
'INT':INST_INT,
'MOV':INST_MOV,
'SHIFT':INST_SHIFT
}
INST_CONDITION = ['EQ',
'NE',
'VS',
'VC',
'HI',
'LS',
'PL',
'MI',
'CS',
'CC',
'GE',
'GT',
'LE',
'LT',
'AL',
'NV',
'FA',
'FD', # note that FD is not a condition in fact.
'EA',
'ED',
'S' # not a condition
]
REG_LIST = [] #R0-R15, R15=PC, R14=LR, R13=SP
for i in xrange(0,16):
REG_LIST.append('R'+str(i))
REG_LIST.append('PC')
REG_LIST.append('LR')
REG_LIST.append('SP')
PrintableCharList = range(32,127)
PrintableCharList.append(0x0d)
PrintableCharList.append(0x0a)
#333333333333333333333333333333333333333333333333333333333333333333
STR_PREFIX = "[STR]:"
FUNC_PREFIX = "[FUNC]:"
PARA_PREFIX = "[PARAMETER]:"
RTN_PREFIX="[RETURN]:"
splitChar = [',','[',']','+','-','(',')','#','!','=']
global symbolDict
strMaxLen=100
def waitAuto():
"""
wait for the finish of auto analysis
"""
#print "waiting for auto process done ... "
autoWait()
def introduction():
print("-----------------------------------------------------------------")
print("dbgStrCmtor: \r\n Author: Simon Huang \r\n Email: thelongestusernameofall#gmail.com\r\n")
print("ShortCut:\r\n\tStart: alt-2\r\n\tStep Into: `-1\r\n\tStep Over:`-2\r\n")
print("-----------------------------------------------------------------")
def init():
#print '[init]: ... '
global symbolDict
waitAuto()
introduction()
symbolDict = getDataSymbols()
def getDataSymbols():
#print 'waiting for symbol parsing done ..'
dataSectionKeywords = ['data']
symbolDict = {}
for ea in Segments():
segName = SegName(ea)
isDataSeg = False
for aKeyWord in dataSectionKeywords:
if aKeyWord in segName:
isDataSeg = True
if isDataSeg:
startEa = SegStart(ea)
endEa = SegEnd(ea)
aLocation = startEa
#for aLocation in xrange(startEa,endEa):
while aLocation<endEa:
lName = Name(aLocation)
if lName and len(lName.strip())>0:
symbolDict[lName.strip()] = aLocation
aLocation+=1
return symbolDict
def cleanMnem(instMnem):
""":type instMnem str"""
instMnem = instMnem.upper()
for aC in INST_CONDITION:
""":type aC str"""
if instMnem.endswith(aC):
instMnem.replace(aC,"")
return instMnem
def isANum(aStr):
""":type aStr str"""
try:
aStr = aStr.replace("#","").replace("=","").strip()
if aStr.lower().startswith("0x"):
intvalue = int(aStr,16)
return True
else:
intvalue = int(aStr,10)
return True
except Exception as e:
return False
def getANum(aStr):
""":type aStr str"""
intValue = -1
aStr = aStr.replace("#","").replace("=","").strip()
if aStr.lower().startswith("0x"):
intValue = int(aStr,16)
else:
intValue = int(aStr,10)
return intValue
def tokenizeOpnd(opndStrValue):
tokenList = []
aToken = ''
for achar in opndStrValue:
if achar==' ':
continue
if achar in splitChar:
if len(aToken) > 0:
tokenList.append(aToken)
tokenList.append(achar)
aToken = ''
else:
aToken+=achar
if len(aToken) > 0:
tokenList.append(aToken)
#print tokenList
return tokenList
def makeSuffixExp(tokenList):
suffixExp = []
operationStack = []
for aToken in tokenList:
if aToken in splitChar:
if aToken in ["(","["]:
operationStack.append(aToken)
elif aToken in [',','+','-']:
while 1:
if len(operationStack) == 0:
operationStack.append(aToken)
break
elif operationStack[-1] in [',','+','-']:
suffixExp.append(operationStack.pop())
else:
operationStack.append(aToken)
break
elif aToken==')':
while 1:
if len(operationStack) == 0:
break
elif operationStack[-1] != '(':
suffixExp.append(operationStack.pop())
else:
operationStack.pop()
break
elif aToken==']':
while 1:
if len(operationStack) == 0:
break
elif operationStack[-1] != '[':
suffixExp.append(operationStack.pop())
else:
operationStack.pop()
break
else:
suffixExp.append(aToken)
while 1:
if len(operationStack) > 0:
suffixExp.append(operationStack.pop())
else:
break
#print "suffixExp:",suffixExp
return suffixExp
def getOpndDataValue(opndStrValue):
""":type opndStrValue str"""
tokenList = tokenizeOpnd(opndStrValue)
suffixExp = makeSuffixExp(tokenList)
valueStack = []
odv = 0
for aToken in suffixExp:
tokenV = -1
if aToken not in ["+","-",","]:
if isANum(aToken):
tokenV = getANum(aToken)
elif aToken in REG_LIST:
tokenV = GetRegValue(aToken)
elif aToken in symbolDict:
tokenV = symbolDict[aToken]
elif aToken.lower().startswith("var_"):
try:
tokenV = int(aToken.lower().replace("var_","-0x"),16)
except Exception as e:
print e.message
traceback.print_exc()
pass
elif aToken.lower().startswith("dword_"):
try:
tokenV = int(aToken.lower().replace("dword_","0x"),16)
except Exception as e:
traceback.print_exc()
print e.message
pass
else:
print "UNDEFINED:" + aToken
pass
valueStack.append(tokenV)
elif aToken in ["+",","]:
oper_2 = valueStack.pop()
oper_1 = valueStack.pop()
valueStack.append(oper_1+oper_2)
elif aToken in ["-"]:
oper_2 = valueStack.pop()
oper_1 = 0
if len(valueStack)>0:
oper_1 = valueStack.pop()
valueStack.append(oper_1-oper_2)
assert len(valueStack)==1
odv = valueStack.pop()
odv = odv&0xffffffff
return odv
def getSourceData(instMnem,instOpndList):
if not instMnem or not instOpndList or len(instOpndList)==0:
return None
srcData = 0
idx = 1
if instMnem in INST_ADD:
if len(instOpndList) == 2:
srcData = getOpndDataValue(instOpndList[0]) + getOpndDataValue(instOpndList[1])
elif len(instOpndList) ==3:
srcData = getOpndDataValue(instOpndList[2]) + getOpndDataValue(instOpndList[1])
elif instMnem in INST_SUB :
if len(instOpndList) == 2:
srcData = getOpndDataValue(instOpndList[0]) - getOpndDataValue(instOpndList[1])
elif len(instOpndList) ==3:
srcData = getOpndDataValue(instOpndList[1]) - getOpndDataValue(instOpndList[2])
elif instMnem in INST_MUL:
if len(instOpndList) == 2:
srcData = getOpndDataValue(instOpndList[0]) *getOpndDataValue(instOpndList[1])
elif len(instOpndList) ==3:
srcData = getOpndDataValue(instOpndList[1]) *getOpndDataValue(instOpndList[2])
elif instMnem in INST_MOV_BACK:
srcData = getOpndDataValue(instOpndList[0])
elif instMnem in INST_MOV_TO:
srcData = getOpndDataValue(instOpndList[1])
elif instMnem in INST_MOV_SWAP: # only process the later opnd for simple
srcData = getOpndDataValue(instOpndList[1])
elif instMnem in INST_JUMP:
pass #process JMP instruction
return srcData
def updateSymbolDict(instLocation):
instName = Name(instLocation)
global symbolDict
if instName and len(instName.strip())>0 and instName.strip() not in symbolDict:
symbolDict[instName] = instLocation
def getAlgorithmName(memLocation):
#print "getAlgorithmName : ",memLocation
for i in xrange(0,len(algorithmSBoxList)):
if memLocation in algorithmSBoxList[i]:
return algorithmNameList[i]
return None
def readMemAsStr(memLocation):
i=0
strValue=None
tmpV = Byte(memLocation)
isAStr = True
if tmpV and tmpV in PrintableCharList:
strValue=chr(tmpV)
for i in xrange(1,strMaxLen):
tmpV = Byte(memLocation+i)
if tmpV==0:
break
if tmpV not in PrintableCharList:
isAStr = False
break
strValue += chr(tmpV)
possibleAlgorithmName = getAlgorithmName(memLocation)
if strValue:
#print isAStr,strValue
pass
if not isAStr:
strValue=None
if possibleAlgorithmName:
if not strValue:
strValue=possibleAlgorithmName
else:
strValue=strValue+"||"+possibleAlgorithmName
return strValue
def getMemLinkedList(memLocation):
""":type memLocation int"""
if not memLocation or memLocation == 0:
return None
memList = [memLocation]
#strList.append(readMemAsStr(memLocation))
nMemLocation = Dword(memLocation)
while nMemLocation and nMemLocation!=0xffffffff and nMemLocation not in memList:
memList.append(nMemLocation)
nMemLocation=Dword(nMemLocation)
return memList
def getMemLinkedStrList(memList):
if not memList:
return None
strList = []
for aMem in memList:
strList.append(readMemAsStr(aMem))
return strList
def getOldComment(memLocation):
oldCmt_rep = GetCommentEx(memLocation,1)
#print 'oldCmt_rep:',oldCmt_rep
oldCmt = GetCommentEx(memLocation,0)
#print 'oldCmt:',oldCmt
if not oldCmt:
oldCmt=oldCmt_rep
else:
if oldCmt_rep:
oldCmt = oldCmt + "\r\n"+oldCmt_rep
return oldCmt
def addComment(memLocation,commentStr):
#print 'addComment: location:',memLocation,"commentStr:",commentStr
oldCmt = getOldComment(memLocation)
#print "oldCtm:",oldCmt
""":type oldCmt str"""
cmtStr=""
if not oldCmt or not oldCmt.strip().startswith(STR_PREFIX):
if not oldCmt or len(oldCmt.strip())==0:
cmtStr=STR_PREFIX+commentStr
else:
cmtStr=STR_PREFIX+commentStr+"\r\n"+oldCmt
MakeRptCmt(memLocation,cmtStr)
else:
# if oldCmt.strip()!=(STR_PREFIX+commentStr).strip():
# cmtStr=oldCmt+"\r\n"+commentStr
# print "2.cmtStr:",cmtStr
# MakeRptCmt(memLocation,cmtStr)
oldCmts = oldCmt.split('\r\n')
""":type oldCmts list of str"""
isContain=False
for aOldCmt in oldCmts:
aOldCmt=aOldCmt.strip()
if aOldCmt.startswith(STR_PREFIX):
if aOldCmt==(STR_PREFIX+commentStr).strip():
isContain=True
break
elif aOldCmt==commentStr.strip():
isContain=True
break
if not isContain:
cmtStr=oldCmt.strip()+"\r\n"+commentStr
MakeRptCmt(memLocation,cmtStr)
def addComments(memList):
strList = getMemLinkedStrList(memList)
#print "strList",strList
i=len(memList)
cmtStr=None
while i>0:
i-=1
aMem = memList[i]
aStr = strList[i]
""":type aStr str"""
if aStr and len(aStr.strip())>0:
if not cmtStr or len(cmtStr.strip())==0:
cmtStr=aStr
else:
cmtStr=aStr+"->"+cmtStr
if cmtStr and len(cmtStr.strip())>0:
addComment(aMem,cmtStr)
#print cmtStr
return cmtStr
def isFuncStart(instLocation):
funcInnerOffset = GetFuncOffset(instLocation)
if not funcInnerOffset:
return False
if not "+" in funcInnerOffset:
return True
elif funcInnerOffset.endswith('+1'): #Thumb mode, Sometimes jump to functionStart + 1
return True
return False
def cmtFuncParameters(instLocatin, inst_mnem):
# if the function already be commented by this tool, no more comment should be done.
# function should be more considering its logic than its parameters each time.
oldCmt = getOldComment(instLocatin)
if oldCmt and FUNC_PREFIX in oldCmt:
return
if inst_mnem in INST_JUMP:
xrefObjList = [ref for ref in XrefsFrom(instLocatin,1)]
if len(xrefObjList) !=1:
print("[ERROR]: should be 1, something goes wrong"+"instLocation:"+str(instLocatin))
return
targetLocation = xrefObjList[0].to
if isFuncStart(targetLocation):
functionCmtStr = FUNC_PREFIX + "-"*20 + "\r\n" + PARA_PREFIX
for i in xrange(0,3):
R_value = GetRegValue("R"+str(i))
R_str = "R"+str(i)+"="+hex(R_value).replace("L","")+"="+str(R_value)
R_MemList = getMemLinkedList(R_value)
R_MemStrList = getMemLinkedStrList(R_MemList)
strAppend = ""
if R_MemStrList and len(R_MemStrList) > 1:
for aMemStr in R_MemStrList:
if aMemStr and len(aMemStr.strip())>0:
strAppend+=aMemStr + " -> "
R_str = R_str + " : " + strAppend + "\r\n"
functionCmtStr += R_str
#functionCmtStr += "[FUNC]:" + "-"*10
MakeComm(instLocatin,functionCmtStr) # maybe MakeRptCmt better?
def getPrevInstLocation(instLocation):
xrefsList = [ref for ref in XrefsTo(instLocation,0)]
if len(xrefsList) == 1:
xrefObj = xrefsList[0]
frmLocation = xrefObj.frm
return frmLocation
return None
def isPrevInstJmp(instLocation):
prevInstLocation = getPrevInstLocation(instLocation)
if not prevInstLocation:
return False
prev_inst_mnem = GetMnem(prevInstLocation)
prev_inst_mnem = cleanMnem(prev_inst_mnem)
if prev_inst_mnem in INST_JUMP:
oldCmt = getOldComment(prevInstLocation)
if oldCmt and FUNC_PREFIX in oldCmt and RTN_PREFIX not in oldCmt:
return True
return False
def cmtFuncReturn(instLocation):
oldCmt = getOldComment(instLocation)
if oldCmt and FUNC_PREFIX in oldCmt and RTN_PREFIX not in oldCmt:
oldCmt += "\r\n" + RTN_PREFIX + "\r\n"
i=0
R_value = GetRegValue("R"+str(i))
R_str = "R"+str(i)+"="+hex(R_value).replace("L","")+"="+str(R_value)
R_MemList = getMemLinkedList(R_value)
R_MemStrList = getMemLinkedStrList(R_MemList)
strAppend = ""
if R_MemStrList and len(R_MemStrList) > 1:
for aMemStr in R_MemStrList:
if aMemStr and len(aMemStr.strip())>0:
strAppend+=aMemStr + " -> "
R_str = R_str + " : " + strAppend
oldCmt += R_str +"\r\n"
oldCmt += FUNC_PREFIX + '-'*20
MakeComm(instLocation,oldCmt)
def analyzeInst(instLocation):
inst = GetDisasm(instLocation)
inst_mnem = GetMnem(instLocation)
inst_mnem = cleanMnem(inst_mnem)
updateSymbolDict(instLocation)
#print inst
opndList = []
i = 0
opnd = GetOpnd(instLocation,i)
while opnd and len(opnd)>0:
opndList.append(opnd)
i+=1
opnd = GetOpnd(instLocation,i)
#1. function parameters
if inst_mnem in INST_JUMP:
cmtFuncParameters(instLocation,inst_mnem)
#2. function return value
if isPrevInstJmp(instLocation):
prevInstLocation = getPrevInstLocation(instLocation)
cmtFuncReturn(prevInstLocation)
#3. String pointer comment and Hash function recognition
srcData = getSourceData(inst_mnem,opndList)
#print 'srcData:'+ hex(srcData)
if not srcData or srcData<0x1000:
return
memList = getMemLinkedList(srcData)
if not memList:
#print "memList: None"
return
#print "memList:",[hex(x)[0:-1] for x in memList]
cmtStr=addComments(memList)
#print "cmtStr",cmtStr
if cmtStr:
addComment(instLocation,cmtStr)
def myStepOver():
#
pc_value = GetRegValue("pc")
# cmt_str = GetCommentEx(pc_value,0)
# """:type cmt_str str"""
# analyzed = False
# if cmt_str:
# cmt_str = cmt_str.strip()
# if len(cmt_str) > 0:
# if cmt_str.startswith(STR_PREFIX):
# analyzed = True
# else:
# cmt_str = ""
# if not analyzed:
try:
analyzeInst(pc_value)
except Exception as e:
traceback.print_exc()
print e
request_step_over()
run_requests()
def myStepInto():
pc_value = GetRegValue("pc")
analyzeInst(pc_value)
try:
request_step_into() # causes internal error 40396 on version before 6.8
run_requests()
except Exception as e:
traceback.print_exc()
print e.message
def process():
#print '[process]: start'
# dbgStrCmtor = DbgStrCmtor()
# dbgStrCmtor.hook()
idaapi.add_hotkey("`+1",myStepInto)
idaapi.add_hotkey("`+2",myStepOver)
#print '[process]: done'
def finish():
#print "[finish]: ..."
pass
def main():
#print '__main__ start'
init()
process()
finish()
#print '__main__ done'
if __name__=="__main__":
main()
class DbgStrCmtorPlugin(idaapi.plugin_t):
flags=idaapi.PLUGIN_KEEP
comment="string commenter and encrypt function recognition"
help = "dbgStrCmtor: \r\n Author: Simon Huang \r\n Email: thelongestusernameofall#gmail.com\r\n"
wanted_name = "dbgStrCmtor"
wanted_hotkey = "Alt-2"
def init(self):
return idaapi.PLUGIN_OK
def run(self,arg):
main()
pass
def term(self):
pass
def PLUGIN_ENTRY():
return DbgStrCmtorPlugin() | thelongestusernameofall/dbgStrCmtor | dbgStrCmtor.py | Python | mit | 26,883 |
---
layout: default
title: cahier_de_texte
---
<h1>Cahier de texte</h1>
{% include category.html %}
| Marineflower/SitePC_Chaptal | categories/cahier_de_texte.html | HTML | mit | 102 |
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateServicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('services', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->unsignedInteger('team_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('services');
}
}
| onetribe/worshipplanner | database/migrations/2016_12_16_191741_create_services_table.php | PHP | mit | 680 |
namespace Akeneo.Consts
{
public class ResistanceUnits
{
public const string MilliOhm = "MILLIOHM";
public const string CentiOhm = "CENTIOHM";
public const string DeciOhm = "DECIOHM";
public const string Ohm = "OHM";
public const string DekaOhm = "DEKAOHM";
public const string HectOhm = "HECTOHM";
public const string KilOhm = "KILOHM";
public const string MegOhm = "MEGOHM";
}
} | pardahlman/akeneo-csharp | src/Akeneo/Consts/ResistanceUnits.cs | C# | mit | 399 |
FROM qixtand/debian-wheezy-buildpack
# skip installing gem documentation
RUN mkdir -p /usr/local/etc \
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /usr/local/etc/gemrc
ENV RUBY_MAJOR 2.1
ENV RUBY_VERSION 2.1.10
ENV RUBY_DOWNLOAD_SHA256 5be9f8d5d29d252cd7f969ab7550e31bbb001feb4a83532301c0dd3b5006e148
ENV RUBYGEMS_VERSION 2.6.13
# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
RUN set -ex \
\
&& buildDeps=" \
bison \
dpkg-dev \
libgdbm-dev \
ruby \
" \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/* \
\
&& wget -O ruby.tar.xz "https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz" \
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum -c - \
\
&& mkdir -p /usr/src/ruby \
&& tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1 \
&& rm ruby.tar.xz \
\
&& cd /usr/src/ruby \
\
# hack in "ENABLE_PATH_CHECK" disabling to suppress:
# warning: Insecure world writable dir
&& { \
echo '#define ENABLE_PATH_CHECK 0'; \
echo; \
cat file.c; \
} > file.c.new \
&& mv file.c.new file.c \
\
&& autoconf \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
--build="$gnuArch" \
--disable-install-doc \
--enable-shared \
&& make -j "$(nproc)" \
&& make install \
\
&& apt-get purge -y --auto-remove $buildDeps \
&& cd / \
&& rm -r /usr/src/ruby \
\
&& gem update --system "$RUBYGEMS_VERSION"
ENV BUNDLER_VERSION 1.15.4
RUN gem install bundler --version "$BUNDLER_VERSION"
# install things globally, for great justice
# and don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_PATH="$GEM_HOME" \
BUNDLE_BIN="$GEM_HOME/bin" \
BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
ENV PATH $BUNDLE_BIN:$PATH
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \
&& chmod 777 "$GEM_HOME" "$BUNDLE_BIN"
CMD [ "irb" ]
| qixtand/qixtand | debian/wheezy/ruby/2.1.10/Dockerfile | Dockerfile | mit | 2,045 |
/*
The MIT License (MIT)
This file is part of the Phoenard Arduino library
Copyright (c) 2014 Phoenard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "PHNSim.h"
#include<string.h>
// Initialize sim here
PHN_Sim sim;
void PHN_Sim::init() {
if (this->initialized) {
return;
}
// Initialize the SIM fields
Serial1.begin(SIM_BAUDRATE);
pinMode(SIM_PWRKEY_PIN, OUTPUT);
this->callStatus = SIM_CALL_STATUS_NONE;
this->latestInbox = -1;
this->bookOffset = 1;
this->bookSize = 10;
this->initialized = true;
this->callReady = false;
this->gpsReady = false;
}
void PHN_Sim::begin(bool resetRegisters) {
// Probe the SIM module, turn it on if needed
// The on check already initializes everything
init();
powerOnStart();
powerOnEnd();
// Reset common registers to guarantee proper operation
if (resetRegisters) {
reset();
}
}
void PHN_Sim::powerOnStart() {
if (!isOn()) {
digitalWrite(SIM_PWRKEY_PIN, HIGH);
}
}
void PHN_Sim::powerOnEnd() {
for (char c = 150; c && !sim.isOn(); c--) delay(10);
digitalWrite(SIM_PWRKEY_PIN, LOW);
}
void PHN_Sim::togglePower() {
if (isOn()) {
end();
} else {
powerOnStart();
powerOnEnd();
}
}
void PHN_Sim::end() {
// Turn the SIM off if it is currently on
if (isOn()) {
sendATCommand("AT+CPOWD=0");
}
}
void PHN_Sim::reset() {
//TODO: Does this preserve options such as volume?
// Reset to factory defaults
sendATCommand("AT&F");
// Turn on extended +CRING information
sendATCommand("AT+CRC=1");
// Turn on the incoming call information readout
sendATCommand("AT+CLIP=1");
// Automatically receive messages when SMS is received
sendATCommand("AT+CNMI=3,1");
}
bool PHN_Sim::isOn() {
return digitalRead(SIM_STATUS_PIN);
}
void PHN_Sim::update() {
init();
if (Serial1.available()) {
const int INPUT_BUFF_LEN = 100;
char inputBuffer[INPUT_BUFF_LEN+1];
int inputIndex = 0;
while (inputIndex < INPUT_BUFF_LEN && waitRead()) {
inputBuffer[inputIndex++] = Serial1.read();
}
inputBuffer[inputIndex] = 0;
// Debugging: log all incoming data
Serial.print("Update input: ");
Serial.println(inputBuffer);
// Find any commands in the received message
char* inputText;
for (int i = 0; i < inputIndex; i++) {
inputText = inputBuffer+i;
if (strstr(inputText, "NO CARRIER") == inputText) {
// No carrier call status update
callStatus = SIM_CALL_STATUS_NONE;
i += 9;
} else if (strstr(inputText, "BUSY") == inputText) {
// Busy call status update
callStatus = SIM_CALL_STATUS_BUSY;
i += 3;
} else if (strstr(inputText, "+CLIP: ") == inputText) {
// Caller information received.
// +CLIP: "+1234567890",145,"",,"",0
char* args[1];
if (getSimTextArgs(inputText+7, args, 1)) {
// Voice call
strcpy(incomingNumber, args[0]);
callStatus = SIM_CALL_STATUS_CALLED;
}
} else if (strstr(inputText, "+CMTI: ") == inputText) {
// +CMTI: "SM",11
// Text message received
// Read arguments
char* args[2];
if (getSimTextArgs(inputText+7, args, 2)) {
// Receiving a new text message
if (!strcmp(args[0], "SM")) {
latestInbox = atoi(args[1]) - 1;
}
}
} else if (strstr(inputText, "GPS Ready") == inputText) {
gpsReady = true;
} else if (strstr(inputText, "Call Ready") == inputText) {
callReady = true;
}
}
}
}
inline bool PHN_Sim::waitRead() {
return waitAvailable(Serial1, SIM_ATCOMMAND_TIMEOUT);
}
bool PHN_Sim::readToken(const char *token, unsigned long timeoutMS) {
uint16_t i = 0;
unsigned long startTime = millis();
while (token[i]) {
if ((millis() - startTime) >= timeoutMS) {
// Timeout
return false;
}
if (Serial1.available() && Serial1.read() != token[i++]) {
i = 0;
}
}
return true;
}
bool PHN_Sim::enterPuk(const char* puk, const char* newPin) {
// Build the enter puk+pin command
char pukPin[50];
String pukPinStr;
pukPinStr += puk;
pukPinStr += ",";
pukPinStr += newPin;
pukPinStr.toCharArray(pukPin, sizeof(pukPin));
return enterPin(pukPin);
}
bool PHN_Sim::enterPin(const char* pin) {
// Build the enter pin command
char command[50];
String commandStr;
commandStr += "AT+CPIN=";
commandStr += pin;
commandStr.toCharArray(command, sizeof(command));
if (sendATCommand(command) && (getPinStatus() == SIM_PIN_STATUS_READY)) {
return true;
}
return false;
}
int PHN_Sim::getPinStatus() {
char resp[30];
if (sendATCommand("AT+CPIN?", resp, 30)) {
// Read status
if (!strcmp(resp, "READY")) {
return SIM_PIN_STATUS_READY;
} else if (!strcmp(resp, "SIM PIN")) {
return SIM_PIN_STATUS_NEEDPIN;
} else if (!strcmp(resp, "SIM PUK")) {
return SIM_PIN_STATUS_NEEDPUK;
}
}
return SIM_PIN_STATUS_ERROR;
}
bool PHN_Sim::isSimCardInserted() {
char resp[20];
if (!sendATCommand("AT+CSMINS?", resp, sizeof(resp))) {
return false;
}
return resp[2] == '1';
}
void PHN_Sim::setDate(Date newDate) {
char command[50];
strcpy(command, "AT+CCLK=");
writeDate(command+8, newDate);
sendATCommand(command);
}
Date PHN_Sim::getDate() {
Date date;
char resp[40];
char* args[1];
if (sendATCommand("AT+CCLK?", resp, 40) && getSimTextArgs(resp, args, 1) == 1) {
date = readDate(args[0]);
}
return date;
}
int PHN_Sim::getRegStatus() {
char resp[50];
char *regArgs[2];
sendATCommand("AT+CREG?", resp, sizeof(resp));
if (getSimTextArgs(resp, regArgs, 2) == 2) {
return atoi(regArgs[1]);
}
return 0;
}
bool PHN_Sim::isConnected() {
int status = getRegStatus();
return (status == 1) || (status == 5);
}
bool PHN_Sim::readProvider(char* buffer, int bufferLength) {
char resp[50];
char *provArgs[3];
if (sendATCommand("AT+COPS?", resp, 50) && getSimTextArgs(resp, provArgs, 3) == 3) {
int len = min((int) (strlen(provArgs[2])+1), bufferLength);
memcpy(buffer, provArgs[2], len * sizeof(char));
buffer[len] = 0;
return true;
} else {
int len = min(bufferLength-1, 6);
memcpy(buffer, "No Sim", len);
buffer[len] = 0;
}
return false;
}
float PHN_Sim::readBatteryLevel() {
char resp[30];
char *args[3];
if (!sendATCommand("AT+CBC", resp, sizeof(resp))) {
return 0.0F;
}
if (getSimTextArgs(resp, args, 3) != 3) {
return 0.0;
}
return 0.01 * atoi(args[1]);
}
int PHN_Sim::readSignalLevel() {
char resp[30];
char *args[2];
if (!sendATCommand("AT+CSQ", resp, sizeof(resp))) {
return 0;
}
if (getSimTextArgs(resp, args, 2) != 2) {
return 0;
}
uint8_t raw = atoi(args[0]);
if (raw == 99) {
return 0;
} else if (raw == 0) {
return -115;
} else if (raw == 1) {
return -111;
} else if (raw == 31) {
return -52;
} else {
return map(raw, 2, 30, -110, -54);
}
}
void PHN_Sim::call(const char* address) {
// Set up the command to execute
int address_len = strlen(address);
char cmd[30] = "ATD";
memcpy(cmd+3, address, min(address_len, 30-5));
cmd[address_len+3] = ';';
cmd[address_len+4] = 0;
if (sendATCommand(cmd))
callStatus = SIM_CALL_STATUS_CALLING;
}
void PHN_Sim::endCall() {
sendATCommand("ATH");
callStatus = SIM_CALL_STATUS_NONE;
}
void PHN_Sim::rejectCall() {
sendATCommand("AT+GSMBUSY");
callStatus = SIM_CALL_STATUS_NONE;
}
void PHN_Sim::acceptCall() {
sendATCommand("ATA");
callStatus = SIM_CALL_STATUS_CALLING;
}
bool PHN_Sim::isCalled() {
return getCallStatus() == SIM_CALL_STATUS_CALLED;
}
int PHN_Sim::getCallStatus() {
update();
return callStatus;
}
const char* PHN_Sim::getIncomingNumber() {
update();
return incomingNumber;
}
void PHN_Sim::sendDTMF(char character) {
if (character) {
char command[9];
memcpy(command, "AT+VTS=", 7);
command[7] = character;
command[8] = 0;
sendATCommand(command, 0, 0, SIM_ATCOMMAND_DTFM_TIMEOUT);
}
}
bool PHN_Sim::setVolume(int level) {
char command[20];
memcpy(command, "AT+CLVL=", 8);
itoa(level, command+8, 10);
return sendATCommand(command);
}
int PHN_Sim::getMessageCount() {
// Response: +CPMS: <used_space>,<max_space>
char resp[50];
if (!sendATCommand("AT+CPMS=\"SM\"", resp, sizeof(resp))) {
return 0;
}
char* args[2];
if (getSimTextArgs(resp, args, 2) != 2) {
return false;
}
return atoi(args[0]);
}
int PHN_Sim::getMessageLimit() {
// Response: +CPMS: <used_space>,<max_space>
char resp[50];
if (!sendATCommand("AT+CPMS=\"SM\"", resp, sizeof(resp))) {
return 0;
}
char* args[2];
if (getSimTextArgs(resp, args, 2) != 2) {
return false;
}
return atoi(args[1]);
}
bool PHN_Sim::hasNewMessage() {
update();
return latestInbox != -1;
}
SimMessage PHN_Sim::getNewMessage() {
int idx = latestInbox;
latestInbox = -1;
return getMessage(idx);
}
void PHN_Sim::deleteMessage(int messageIndex) {
char command[15] = "AT+CMGD=";
itoa(messageIndex+1, command+8, 10);
strcat(command, ",0");
sendATCommand(command, 0, 0);
}
SimMessage PHN_Sim::getMessage(int messageIndex) {
// Put into text mode
sendATCommand("AT+CMGF=1");
// Set up a command to read the message
char command[13] = "AT+CMGR=";
char resp[400];
char *args[5];
itoa(messageIndex+1, command+8, 10);
sendATCommand(command, resp, 400);
// Allocate the message to return
SimMessage message;
// Split the response arguments
// If this fails, message will be left all-0
message.valid = getSimTextArgs(resp, args, 5) == 5;
if (message.valid) {
// Parse the text arguments
message.index = messageIndex;
message.read = !strcmp(args[0], "REC READ");
strcpy(message.sender.number, args[1]);
strcpy(message.sender.text, args[2]);
message.date = readDate(args[3]);
// If the entire message consists of HEX characters, convert to ASCII
char* msgText = args[4];
int msgLen = strlen(msgText);
bool allHex = (msgLen >= 2);
for (int i = 0; (i < msgLen) && allHex; i++) {
allHex = (msgText[i] >= 48) && (msgText[i] <= 70);
}
if (allHex) {
unsigned char data_ctr = 1;
char *buff = message.text-1;
for (int i = 0; i < msgLen; i++) {
// Skip every 2 first bytes
if (!(i & 0x2)) continue;
// Read the new byte
char c = msgText[i];
// Start of a new byte, increment and set to an initial 0x00
data_ctr++;
if (!(data_ctr & 0x1)) {
*(++buff) = 0x00;
}
// Convert the character into HEX, put it into the buffer
*buff <<= 4;
if (c & 0x40) {
c -= ('A' - '0') - 10;
}
*buff |= (c - '0') & 0xF;
// For 'weird' unreadable ASCII characters, replace with ???
if ((data_ctr & 0x1) && ((*buff >= 127) || (*buff <= 8))) {
*buff = '?';
}
}
// Make sure we null-terminate
*(++buff) = 0;
} else {
// Just copy it over
strcpy(message.text, msgText);
}
}
return message;
}
bool PHN_Sim::sendMessage(const char* receiverAddress, const char* messageText) {
char command[300];
int index;
// Set to text message mode
if (!sendATCommand("AT+CMGF=1")) {
return false;
}
// Write the message start command containing the receiver address
// No further response happens, use writeATCommand instead of sendATCommand
index = 0;
index += strcpy_count(command+index, "AT+CMGS=");
command[index++] = '"';
index += strcpy_count(command+index, receiverAddress);
command[index++] = '"';
command[index++] = '\r';
command[index++] = '\n';
command[index++] = 0;
if (!writeATCommand(command)) {
return false;
}
// Wait until the > token is read indicating SIM is ready for the message
readToken("\r\n> ", 100);
// Write the text message, with end token. Message is echo'd back by the SIM.
// Response includes '+CMGS: 70', where 70 is the index of the message
// We are discarding this response here
index = 0;
index += strcpy_count(command+index, messageText);
command[index++] = 0x1A;
command[index++] = 0;
return sendATCommand(command, 0, 0, SIM_ATCOMMAND_SENDTEXT_TIMEOUT);
}
bool PHN_Sim::setContactBook(const char* bookName) {
// Compose command to switch to a different contact book
char command[40];
int bookLen = strlen(bookName);
memcpy(command, "AT+CPBS=\"", 9);
memcpy(command+9, bookName, bookLen);
command[bookLen+9] = '\"';
command[bookLen+10] = 0;
if (!sendATCommand(command)) {
return false;
}
// Next, request the information about this book (ranges)
char resp[50];
if (!sendATCommand("AT+CPBR=?", resp, sizeof(resp))) {
return false;
}
char* args[3];
if (getSimTextArgs(resp, args, 3) != 3) {
return false;
}
// Verify that the ranges are correct, and parse them
char* recordRange = args[0];
char* recordMid = strchr(recordRange, '-');
if (recordMid == NULL) {
return false;
}
recordRange[strlen(recordRange)-1] = 0;
recordMid[0] = 0;
bookOffset = atoi(recordRange+1);
bookSize = atoi(recordMid+1) - bookOffset + 1;
bookNameLength = atoi(args[1]);
bookAddressLength = atoi(args[2]);
return true;
}
int PHN_Sim::getContactCount() {
// Response: +CPBS: "<storage>",<used>,<total>
char resp[50];
if (!sendATCommand("AT+CPBS?", resp, sizeof(resp))) {
return 0;
}
char* args[3];
if (getSimTextArgs(resp, args, 3) != 3) {
return false;
}
return atoi(args[1]);
}
SimContact PHN_Sim::getContact(int contactIndex) {
// Compose and send command to retrieve contact details
char resp[200];
char *args[4];
char command[13] = "AT+CPBR=";
itoa(contactIndex+this->bookOffset, command+8, 10);
// Parse details to a contact struct
SimContact contact;
contact.valid = sendATCommand(command, resp, 400) && getSimTextArgs(resp, args, 4) == 4;
if (contact.valid) {
contact.index = atoi(args[0])-this->bookOffset;
strcpy(contact.number, args[1]);
contact.type = atoi(args[2]);
strcpy(contact.text, args[3]);
}
return contact;
}
bool PHN_Sim::addContact(SimContact contact) {
return setContact(-1, contact);
}
bool PHN_Sim::setContact(int contactIndex, SimContact contact) {
//AT+CPBW=([index]),"[address]",[type],"[name]"
// Convert some things to a string array buffer
char idxPart[6];
char typePart[6];
if (contactIndex == -1) {
idxPart[0] = 0;
} else {
itoa(contactIndex+this->bookOffset, idxPart, 10);
}
itoa(contact.type, typePart, 10);
// Generate a list of Strings to concatenate
const int parts_count = 9;
const char* parts[parts_count];
parts[0] = "AT+CPBW=";
parts[1] = idxPart;
parts[2] = ",\"";
parts[3] = contact.number;
parts[4] = "\",";
parts[5] = typePart;
parts[6] = ",\"";
parts[7] = contact.text;
parts[8] = "\"";
// Concatenate into a single command and send
char command[100];
command[0] = 0;
for (int i = 0; i < parts_count; i++) {
strcat(command, parts[i]);
}
return sendATCommand(command);
}
bool PHN_Sim::deleteContact(int contactIndex) {
// Compose and send command to delete contact details
char command[13] = "AT+CPBW=";
itoa(contactIndex+this->bookOffset, command+8, 10);
return sendATCommand(command);
}
bool PHN_Sim::writeATCommand(const char* command) {
// Before executing anything, flush the serial with an update
update();
// Execute the command, retry as needed
uint8_t retryIdx, readIdx;
for (retryIdx = 0; retryIdx < SIM_ATCOMMAND_TRYCNT; retryIdx++) {
// Flush the incoming data
flushRead(Serial1);
// Write the command, wait for a response
Serial1.println(command);
if (!waitRead()) {
continue;
}
// Try reading back the echo from the SIM, and validate
readIdx = 0;
while (command[readIdx] && waitRead()) {
if (Serial1.read() != command[readIdx++]) {
readIdx = 0;
}
}
if (command[readIdx]) {
continue;
}
// Read the two newline characters (\r\n) as well
if (!waitRead() || Serial1.read() != '\r')
continue;
if (!waitRead() || Serial1.read() != '\n')
continue;
// Success!
return true;
}
return false;
}
bool PHN_Sim::sendATCommand(const char* command) {
return sendATCommand(command, 0, 0);
}
bool PHN_Sim::sendATCommand(const char* command, char* respBuffer, uint16_t respBufferLength) {
return sendATCommand(command, respBuffer, respBufferLength, SIM_ATCOMMAND_TIMEOUT);
}
bool PHN_Sim::sendATCommand(const char* command, char* respBuffer, uint16_t respBufferLength, long timeout) {
if (!writeATCommand(command)) {
// Failure to communicate the command
//Serial.println("Command got no response!");
return false;
}
// Prepare a buffer for storing the last bytes for checking for OK/ERROR status
const int statusBufferLen = 9;
char statusBuffer[statusBufferLen+1];
memset(statusBuffer, 0, sizeof(statusBuffer));
// Read the response from the command
uint16_t length = 0;
bool ok = false, error = false;
while (waitAvailable(Serial1, timeout)) {
// Shift data into the status buffer
memmove(statusBuffer, statusBuffer+1, statusBufferLen-1);
statusBuffer[statusBufferLen-1] = Serial1.read();
// Shift data into the response buffer if possible
if (length+1 < respBufferLength) {
respBuffer[length] = statusBuffer[statusBufferLen-1];
}
length++;
// Check whether an OK was received
if (!strncmp(statusBuffer+statusBufferLen-6,"\r\nOK\r\n",6)) {
length -= 6;
ok = true;
break;
}
// Check whether an ERROR was received
if (!strncmp(statusBuffer+statusBufferLen-9,"\r\nERROR\r\n",9)) {
length -= 9;
error = true;
break;
}
}
// Handle post-reading response buffer operations
if (respBufferLength) {
// Limit the length by buffer size
length = min(respBufferLength-1, length);
// Trim starting \r\n from the response
if (length >= 2 && !strncmp(respBuffer, "\r\n", 2)) {
length -= 2;
memmove(respBuffer, respBuffer+2, length);
}
// Trim everything before the first space from the response
uint16_t i;
for (i = 1; i < length; i++) {
if (respBuffer[i-1] == ' ') {
length -= i;
memmove(respBuffer, respBuffer+i, length);
break;
}
}
// Trim ending \r\n from the response
if (length >= 2 && !strncmp(respBuffer+length-2, "\r\n", 2)) {
length -= 2;
}
// Delimit end of String with a NULL character
respBuffer[length] = 0;
}
// Debug
if (!error && !ok) {
//Serial.println("NO RESULTCODE!");
}
return ok;
}
unsigned char PHN_Sim::getSimTextArgs(char *text, char **args, unsigned char maxArgs) {
unsigned char argCount = 0;
bool isInArg = false;
// Text format:
// 12,35,"hello world",12:23:23.55\r\nPayload
// Go by the characters, claiming arguments
while (argCount < maxArgs && *text) {
// Newline mode: everything after this is the payload data
if (*text == '\n') {
args[argCount++] = text+1;
break;
}
// Read quoted arguments fully
if (*text == '"') {
args[argCount++] = text+1;
while (*(++text) && (*text != '"'));
*(text++) = 0;
isInArg = true;
continue;
}
// Store newly acquired arguments
if (!isInArg) {
isInArg = true;
args[argCount++] = text;
continue;
}
// Waiting until the current argument is finished
if (*text == ',' || *text == '\r') {
*text = 0;
isInArg = false;
}
text++;
}
return argCount;
}
/*
* Date parsing logic
* Format: "14/06/28,20:58:18+00"
*/
Date PHN_Sim::readDate(char *text) {
// Skip the first "-character if available
if (*text == '\"') text++;
// Allocate a temporary copy to write in
char buff_arr[21];
char* buff = buff_arr;
memcpy(buff, text, 20);
// Read the first 6 arguments
Date date;
for (int i = 0; i < 6; i++) {
buff[2] = 0;
date[i] = atoi(buff);
buff += 3;
}
return date;
}
void PHN_Sim::writeDate(char* buffer, Date date) {
// Fill the buffer with the output format
strcpy(buffer, "\"00/00/00,00:00:00+00\"");
// Fill in the details
for (int i = 0; i < 6; i++) {
char valueText[4];
itoa(date[i], valueText, 10);
unsigned char len = strlen(valueText);
memcpy(buffer+3+i*3-len, valueText, len);
}
} | wrh3c/Phoenard | PHNSim.cpp | C++ | mit | 21,539 |
function Vector(x, y) {
this.set(x, y);
}
module.exports = Vector;
Vector.prototype.clone = function() {
return new Vector(this.x, this.y);
};
Vector.prototype.set = function(x, y) {
if (x != undefined) {
if (x instanceof Vector) {
this.x = x.x;
this.y = x.y;
} else {
this.x = x;
this.y = y;
}
} else {
this.x = 0;
this.y = 0;
}
return this;
};
Vector.prototype.add = function(x, y) {
if (x instanceof Vector) {
this.x += x.x;
this.y += x.y;
} else {
this.x += x;
this.y += y;
}
return this;
};
Vector.prototype.addDistance = function(n) {
var a = this.angle();
this.x += Math.sin(a) * n;
this.y += Math.cos(a) * n;
return this;
};
Vector.prototype.sub = function(x, y) {
if (x instanceof Vector) {
this.x -= x.x;
this.y -= x.y;
} else {
this.x -= x;
this.y -= y;
}
return this;
};
Vector.prototype.ceil = function() {
this.x = Math.ceil(this.x);
this.y = Math.ceil(this.y);
return this;
};
Vector.prototype.round = function() {
this.x = Math.round(this.x);
this.y = Math.round(this.y);
return this;
};
Vector.prototype.abs = function() {
return this.scale(
this.x < 0 ? -1 : 1,
this.y < 0 ? -1 : 1
);
};
Vector.prototype.floor = function() {
this.x = Math.floor(this.x);
this.y = Math.floor(this.y);
return this;
};
Vector.prototype.scale = function(xScale, yScale) {
this.x *= xScale;
this.y *= isNaN(yScale) ? xScale : yScale;
return this;
};
Vector.prototype.distanceTo = function(x, y) {
return Math.sqrt(this.sqDistanceTo(x, y));
};
Vector.prototype.sqDistanceTo = function(x, y) {
if (x instanceof Vector) {
return this.clone().sub(x).distanceSq();
} else {
return this.clone().sub(x, y).distanceSq();
}
};
Vector.prototype.angleTo = function(x, y) {
if (x instanceof Vector) {
return this.clone().sub(x).angle();
} else {
return this.clone().sub(x, y).angle();
}
};
Vector.prototype.turn = function(radians) {
// Counter-clockwise
var sin = Math.sin(radians);
var cos = Math.cos(radians);
return this.set(this.x * cos - this.y * sin,
this.y * sin - this.x * cos);
};
Vector.prototype.turnClockwise = function(radians) {
// Clockwise
var sin = Math.sin(radians);
var cos = Math.cos(radians);
return this.set(this.x * sin - this.y * cos,
this.y * cos - this.x * sin);
};
Vector.prototype.turnTo = function(radians) {
var len = this.distance();
this.x = len * Math.sin(radians);
this.y = len * Math.cos(radians);
};
Vector.prototype.flipY = function() {
return this.scale(1, -1);
};
Vector.prototype.flipX = function() {
return this.scale(-1, 1);
};
Vector.prototype.angle = function() {
return Math.atan2(this.x, this.y);
};
Vector.prototype.distanceSq = function() {
return this.x * this.x + this.y * this.y;
};
Vector.prototype.distance = function() {
return Math.sqrt(this.distanceSq());
};
Vector.prototype.negate = function() {
return this.scale(-1);
};
Vector.prototype.normalize = function() {
return this.scale(1 / this.distance());
};
Vector.prototype.toString = function() {
return "{ x: " + this.x + " y: " + this.y + " }";
};
| Faris90/lagario- | src/client/Ogar-master/Ogar-master/src/modules/Vector.js | JavaScript | mit | 3,442 |
# POJ
Codes are for POJ.
//这个仓库,是我用来放POJ的题目的我个人的解法的一个地方。
| UsinKou/POJ | README.md | Markdown | mit | 110 |
import { enabledLanguages, localizationData } from '../../../Intl/setup';
import { SWITCH_LANGUAGE } from './IntlActions';
const initLocale = global.navigator && global.navigator.language || 'fi';
const initialState = {
locale: initLocale,
enabledLanguages,
...(localizationData[initLocale] || {}),
};
const IntlReducer = (state = initialState, action) => {
switch (action.type) {
case SWITCH_LANGUAGE: {
const { type, ...actionWithoutType } = action; // eslint-disable-line
return { ...state, ...actionWithoutType };
}
default:
return state;
}
};
export const getIntl = state => state.intl;
export default IntlReducer;
| Muisti/muisti | client/modules/Intl/IntlReducer.js | JavaScript | mit | 666 |
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var index_1 = require("../config/index");
/*
* BROWSERS DIRECTIVES
* @CHROME @FIREFOX @IE @OPERA
*
*/
/*======== CHROME =========*/
var IsChrome = (function (_super) {
__extends(IsChrome, _super);
function IsChrome(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'chrome';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsChrome.prototype, "isChrome", {
set: function (grid_state) {
this.setGrid(this._state, 'browser');
},
enumerable: true,
configurable: true
});
return IsChrome;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsChrome.prototype, "isChrome", null);
IsChrome = __decorate([
core_1.Directive({
selector: '[isChrome]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsChrome);
exports.IsChrome = IsChrome;
/*======== FIREFOX =========*/
var IsFirefox = (function (_super) {
__extends(IsFirefox, _super);
function IsFirefox(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'firefox';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsFirefox.prototype, "isFirefox", {
set: function (grid_state) {
this.setGrid(this._state, 'browser');
},
enumerable: true,
configurable: true
});
return IsFirefox;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsFirefox.prototype, "isFirefox", null);
IsFirefox = __decorate([
core_1.Directive({
selector: '[isFirefox]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsFirefox);
exports.IsFirefox = IsFirefox;
/*======== SAFARI =========*/
var IsSafari = (function (_super) {
__extends(IsSafari, _super);
function IsSafari(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'safari';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsSafari.prototype, "isSafari", {
set: function (grid_state) {
this.setGrid(this._state, 'browser');
},
enumerable: true,
configurable: true
});
return IsSafari;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsSafari.prototype, "isSafari", null);
IsSafari = __decorate([
core_1.Directive({
selector: '[isSafari]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsSafari);
exports.IsSafari = IsSafari;
/*======== OPERA =========*/
var IsOpera = (function (_super) {
__extends(IsOpera, _super);
function IsOpera(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'opera';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsOpera.prototype, "isOpera", {
set: function (grid_state) {
this.setGrid(this._state, 'browser');
},
enumerable: true,
configurable: true
});
return IsOpera;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsOpera.prototype, "isOpera", null);
IsOpera = __decorate([
core_1.Directive({
selector: '[isOpera]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsOpera);
exports.IsOpera = IsOpera;
/*======== IE =========*/
var IsIE = (function (_super) {
__extends(IsIE, _super);
function IsIE(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'ie';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsIE.prototype, "isIE", {
set: function (grid_state) {
this.setGrid(this._state, 'browser');
},
enumerable: true,
configurable: true
});
return IsIE;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsIE.prototype, "isIE", null);
IsIE = __decorate([
core_1.Directive({
selector: '[isIE]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsIE);
exports.IsIE = IsIE;
var ShowItBrowser = (function (_super) {
__extends(ShowItBrowser, _super);
function ShowItBrowser(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(ShowItBrowser.prototype, "showItBrowser", {
set: function (grid_state) {
this.setGrid(grid_state, 'browser');
},
enumerable: true,
configurable: true
});
return ShowItBrowser;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], ShowItBrowser.prototype, "showItBrowser", null);
ShowItBrowser = __decorate([
core_1.Directive({
selector: '[showItBrowser]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], ShowItBrowser);
exports.ShowItBrowser = ShowItBrowser;
var HideItBrowser = (function (_super) {
__extends(HideItBrowser, _super);
function HideItBrowser(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._showWhenTrue = false;
return _this;
}
Object.defineProperty(HideItBrowser.prototype, "hideItBrowser", {
set: function (grid_state) {
this.setGrid(grid_state, 'browser');
},
enumerable: true,
configurable: true
});
return HideItBrowser;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], HideItBrowser.prototype, "hideItBrowser", null);
HideItBrowser = __decorate([
core_1.Directive({
selector: '[hideItBrowser]',
providers: [index_1.ResponsiveState]
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], HideItBrowser);
exports.HideItBrowser = HideItBrowser;
/*
* IE VERSIONS DIRECTIVES
* @IE9 @IE10 @IE11 @IE12
*
*/
var IsIE9 = (function (_super) {
__extends(IsIE9, _super);
function IsIE9(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'ie 9';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsIE9.prototype, "isIE9", {
set: function (grid_state) {
this.setGrid(this._state, 'ie');
},
enumerable: true,
configurable: true
});
return IsIE9;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsIE9.prototype, "isIE9", null);
IsIE9 = __decorate([
core_1.Directive({
selector: '[isIE9]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsIE9);
exports.IsIE9 = IsIE9;
var IsIE10 = (function (_super) {
__extends(IsIE10, _super);
function IsIE10(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'ie 10';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsIE10.prototype, "isIE10", {
set: function (grid_state) {
this.setGrid(this._state, 'ie');
},
enumerable: true,
configurable: true
});
return IsIE10;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsIE10.prototype, "isIE10", null);
IsIE10 = __decorate([
core_1.Directive({
selector: '[isIE10]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsIE10);
exports.IsIE10 = IsIE10;
var IsIE11 = (function (_super) {
__extends(IsIE11, _super);
function IsIE11(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'ie 11';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsIE11.prototype, "isIE11", {
set: function (grid_state) {
this.setGrid(this._state, 'ie');
},
enumerable: true,
configurable: true
});
return IsIE11;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsIE11.prototype, "isIE11", null);
IsIE11 = __decorate([
core_1.Directive({
selector: '[isIE11]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsIE11);
exports.IsIE11 = IsIE11;
var IsIE12 = (function (_super) {
__extends(IsIE12, _super);
function IsIE12(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._state = 'ie 12';
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(IsIE12.prototype, "isIE12", {
set: function (grid_state) {
this.setGrid(this._state, 'ie');
},
enumerable: true,
configurable: true
});
return IsIE12;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], IsIE12.prototype, "isIE12", null);
IsIE12 = __decorate([
core_1.Directive({
selector: '[isIE12]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], IsIE12);
exports.IsIE12 = IsIE12;
var ShowIEVersion = (function (_super) {
__extends(ShowIEVersion, _super);
function ShowIEVersion(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._showWhenTrue = true;
return _this;
}
Object.defineProperty(ShowIEVersion.prototype, "showIEVersion", {
set: function (grid_state) {
this.setGrid(grid_state, 'ie');
},
enumerable: true,
configurable: true
});
return ShowIEVersion;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], ShowIEVersion.prototype, "showIEVersion", null);
ShowIEVersion = __decorate([
core_1.Directive({
selector: '[showIEVersion]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], ShowIEVersion);
exports.ShowIEVersion = ShowIEVersion;
var HideIEVersion = (function (_super) {
__extends(HideIEVersion, _super);
function HideIEVersion(templateRef, viewContainer, _responsiveState) {
var _this = _super.call(this, templateRef, viewContainer, _responsiveState) || this;
_this._showWhenTrue = false;
return _this;
}
Object.defineProperty(HideIEVersion.prototype, "hideIEVersion", {
set: function (grid_state) {
this.setGrid(grid_state, 'ie');
},
enumerable: true,
configurable: true
});
return HideIEVersion;
}(index_1.RESPONSIVE_BASE));
__decorate([
core_1.Input(),
__metadata("design:type", Object),
__metadata("design:paramtypes", [Object])
], HideIEVersion.prototype, "hideIEVersion", null);
HideIEVersion = __decorate([
core_1.Directive({
selector: '[hideIEVersion]'
}),
__metadata("design:paramtypes", [core_1.TemplateRef,
core_1.ViewContainerRef,
index_1.ResponsiveState])
], HideIEVersion);
exports.HideIEVersion = HideIEVersion;
/*======== BrowserInfo =========*/
var BrowserInfo = (function () {
function BrowserInfo(_responsiveState, viewContainer) {
this._responsiveState = _responsiveState;
this.viewContainer = viewContainer;
this.browser = new core_1.EventEmitter();
}
Object.defineProperty(BrowserInfo.prototype, "browserInfo", {
set: function (grid_state) {
this.updateData(this.currentstate);
},
enumerable: true,
configurable: true
});
BrowserInfo.prototype.ngOnInit = function () {
var _this = this;
this._subscription = this._responsiveState.browserObserver.subscribe(this.updateData.bind(this), function (value) {
_this.currentstate = value;
});
};
BrowserInfo.prototype.ngOnDestroy = function () {
this._subscription.unsubscribe();
};
BrowserInfo.prototype.updateData = function (value) {
var update = this._ifValueChanged(this.noRepeat, value);
if (update) {
this.browser.emit(value);
}
};
BrowserInfo.prototype._ifValueChanged = function (oldValue, newValue) {
if (oldValue === newValue) {
return false;
}
else {
this.noRepeat = newValue;
return true;
}
};
return BrowserInfo;
}());
BrowserInfo = __decorate([
core_1.Directive({
selector: "browserInfo", inputs: ['browserInfo'], outputs: ['browser']
}),
__metadata("design:paramtypes", [index_1.ResponsiveState,
core_1.ViewContainerRef])
], BrowserInfo);
exports.BrowserInfo = BrowserInfo;
/*======== ieInfo =========*/
var IeInfo = (function () {
function IeInfo(_responsiveState, viewContainer) {
this._responsiveState = _responsiveState;
this.viewContainer = viewContainer;
this.ieVersion = new core_1.EventEmitter();
}
Object.defineProperty(IeInfo.prototype, "ieInfo", {
set: function (grid_state) {
this.updateData(this.currentstate);
},
enumerable: true,
configurable: true
});
IeInfo.prototype.ngOnInit = function () {
var _this = this;
this._subscription = this._responsiveState.browserObserver.subscribe(this.updateData.bind(this), function (value) {
_this.currentstate = value;
});
};
IeInfo.prototype.ngOnDestroy = function () {
this._subscription.unsubscribe();
};
IeInfo.prototype.updateData = function (value) {
var update = this._ifValueChanged(this.noRepeat, value);
if (update) {
this.ieVersion.emit(value);
}
};
IeInfo.prototype._ifValueChanged = function (oldValue, newValue) {
if (oldValue === newValue) {
return false;
}
else {
this.noRepeat = newValue;
return true;
}
};
return IeInfo;
}());
IeInfo = __decorate([
core_1.Directive({
selector: "ieInfo", inputs: ['ieInfo'], outputs: ['ieVersion']
}),
__metadata("design:paramtypes", [index_1.ResponsiveState,
core_1.ViewContainerRef])
], IeInfo);
exports.IeInfo = IeInfo;
//# sourceMappingURL=browsers-directives.js.map | alcuster/swaptime | node_modules/ng2-responsive/browsers/browsers-directives.js | JavaScript | mit | 17,692 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from bs4 import BeautifulSoup as BS4
from hcomic.crawler.spider import spider
class KyoHK(object):
"""
"""
def __init__(self, workspace):
self.workspace = workspace
def read_task_file(self, task_file_abspath):
"""从下载任务文件中读取计划任务列表。每一行的格式为:
首先是url, 然后接任意多空格, 然后是漫画文件名。
Example:
http://www.kyofun.com/forum.php?mod=viewthread&tid=2009534&extra=page%3D1 [あらくれ][ヤマネコ騎士団物語 女騎士イリナ][同人志][001-话][黑白][0P]
"""
task = list()
with open(task_file_abspath, "rb") as f:
for line in f.read().decode("utf-8").split("\r\n"):
chunks = line.split(" ")
url = chunks[0]
dirname = " ".join(chunks[1:]).strip()
dir_path = os.path.join(self.workspace, dirname) # concatenate with workspace
task.append((url, dir_path))
return task
def image_url_from_html(self, html):
"""从KyoHK论坛的帖子页面中抓取所有图片的链接。
"""
soup = BS4(html)
for img in soup.find_all("img"):
if "file" in img.attrs:
yield img["file"]
def download_one(self, url, dir_path):
"""将论坛帖子中(根据url)的图片, 按照自然顺序排列, 下载到指定目录中。
"""
html = spider.get_html(url=url, encoding="big5") # 抓取Html
if html:
# 创建漫画文件夹
print("Create '%s' ..." % dir_path)
try:
os.mkdir(dir_path)
except Exception as e:
pass
# 获得所有图片的url列表
image_url_list = list(self.image_url_from_html(html))
pic_num = len(image_url_list)
print("We got %s image" % pic_num)
# 下载所有图片
counter = 0
for image_url in image_url_list:
counter += 1
basename = image_url.split("/")[-1]
save_as = os.path.join(dir_path, basename)
if not os.path.exists(save_as):
print(" Download %s ..." % image_url)
try:
spider.download(image_url, save_as)
except:
pass
else:
print("Failed to get %s" % url)
def download(self, task_file_abspath):
"""根据task file, 下载所有漫画到workspace。
"""
task = self.read_task_file(task_file_abspath)
for url, dir_path in task:
self.download_one(url, dir_path)
if __name__ == "__main__":
"""Downloader Unittest
"""
def unittest():
task_file_abspath = r"test-workspace\test-task-file.txt"
workspace = r"test-workspace"
downloader = KyoHK(workspace=workspace)
downloader.download(task_file_abspath)
unittest() | angoraking/hcomic-project | hcomic/crawler/download.py | Python | mit | 3,181 |
#
# first-time-setup
#
# Run by update-procedure.sh if it looks like it hasn't already been run
#
$EZVM_BIN_DIR/verbose-log 2 <<END_LOG
commands/utilities/first-time-setup.sh
END_LOG
if [ -e $FIRST_TIME_SETUP_FILE ]; then
warn "First time setup has already been run on this machine; running anyway..."
fi
FIRST_TIME_SETUP_DIR=$(dirname $FIRST_TIME_SETUP_FILE)
if [ ! -d $FIRST_TIME_SETUP_DIR ]; then
log_msg 1 "Creating first time setup dir: $FIRST_TIME_SETUP_DIR"
mkdir -p $FIRST_TIME_SETUP_DIR || die "Cannot create first time setup dir: $FIRST_TIME_SETUP_DIR" 12
fi
# Copy the user home dirs (if any) onto the machine
. $EZVM_BASE_DIR/libs/copy-home-dir.sh
copy_home_dir
log_msg 1 "First time setup completed successfully"
date > $FIRST_TIME_SETUP_FILE
exit 0
| vube/ezvm | commands/utilities/first-time-setup.sh | Shell | mit | 783 |
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.UI;
using static osu.Game.Input.Handlers.ReplayInputHandler;
namespace osu.Game.Rulesets.Osu.Mods
{
public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
{
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
/// <summary>
/// How early before a hitobject's start time to trigger a hit.
/// </summary>
private const float relax_leniency = 3;
private bool isDownState;
private bool wasLeft;
private OsuInputManager osuInputManager;
private ReplayState<OsuAction> state;
private double lastStateChangeTime;
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
// grab the input manager for future use.
osuInputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
osuInputManager.AllowUserPresses = false;
}
public void Update(Playfield playfield)
{
bool requiresHold = false;
bool requiresHit = false;
double time = playfield.Clock.CurrentTime;
foreach (var h in playfield.HitObjectContainer.AliveObjects.OfType<DrawableOsuHitObject>())
{
// we are not yet close enough to the object.
if (time < h.HitObject.StartTime - relax_leniency)
break;
// already hit or beyond the hittable end time.
if (h.IsHit || (h.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime))
continue;
switch (h)
{
case DrawableHitCircle circle:
handleHitCircle(circle);
break;
case DrawableSlider slider:
// Handles cases like "2B" beatmaps, where sliders may be overlapping and simply holding is not enough.
if (!slider.HeadCircle.IsHit)
handleHitCircle(slider.HeadCircle);
requiresHold |= slider.Ball.IsHovered || h.IsHovered;
break;
case DrawableSpinner _:
requiresHold = true;
break;
}
}
if (requiresHit)
{
changeState(false);
changeState(true);
}
if (requiresHold)
changeState(true);
else if (isDownState && time - lastStateChangeTime > AutoGenerator.KEY_UP_DELAY)
changeState(false);
void handleHitCircle(DrawableHitCircle circle)
{
if (!circle.HitArea.IsHovered)
return;
Debug.Assert(circle.HitObject.HitWindows != null);
requiresHit |= circle.HitObject.HitWindows.CanBeHit(time - circle.HitObject.StartTime);
}
void changeState(bool down)
{
if (isDownState == down)
return;
isDownState = down;
lastStateChangeTime = time;
state = new ReplayState<OsuAction>
{
PressedActions = new List<OsuAction>()
};
if (down)
{
state.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton);
wasLeft = !wasLeft;
}
state?.Apply(osuInputManager.CurrentState, osuInputManager);
}
}
}
}
| EVAST9919/osu | osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | C# | mit | 4,324 |
<!doctype html>
<html class="no-js" lang="en" ng-app="MainApp">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ sitename }}</title>
<link rel="alternate" hreflang="en" href="http://www.murcialito.com/" />
<link rel="alternate" hreflang="es" href="http://es.murcialito.com/" />
<link rel="stylesheet" href="stylesheets/app.css" />
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css" />
<script src="bower_components/modernizr/modernizr.js"></script>
</head>
<body ng-controller="mainController">
<div class="fixed">
<nav data-topbar="" class="top-bar" data-topbar>
<!-- Title -->
<ul class="title-area">
<li class="name"><h1><a href="#"><img src="img/IgnacioRomeroMin.jpg"> Murcialito.com </a> </h1> </li>
<!-- Mobile Menu Toggle -->
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a> </li>
</ul>
<!-- Top Bar Section -->
<section class="top-bar-section">
<!-- Top Bar Left Nav Elements -->
<ul class="left">
<li class="has-form">
</li>
</ul>
<!-- Top Bar Right Nav Elements -->
<ul class="right">
<!-- Divider -->
<li class="divider"></li>
<!-- Search | has-form wrapper -->
<li class="has-form">
<div class="row collapse">
<div class="large-8 small-9 columns">
<input type="text" placeholder="Find Stuff">
</div>
<div class="large-4 small-3 columns">
<a class="alert button expand" href="#">Search</a>
</div>
</div>
</li>
<li class="divider"></li>
<!-- Anchor -->
<li class="has-form">
<a href="#" data-dropdown="droplangs" class="button radius secondary"><i class="fa fa-language"></i> English</a>
<div class="">
<ul id="droplangs" class="f-dropdown" data-dropdown-content>
<li><a href="#">This is a link</a></li>
<li><a href="#">This is another</a></li>
<li><a href="#">Yet another</a></li>
</ul>
</div>
</li>
<li class="divider"></li>
<!-- Button -->
<li class="has-form">
<div id="drophireme" data-dropdown-content class="f-dropdown content">
<p>
Hey, I do <strong>freelancing</strong>! I might available for <strong>hiring</strong> and you maybe interested on my services,
so please drop me a few lines with <strong>your contact details</strong> and we can discuss!.
</p>
<ul class="small-block-grid-2 large-block-grid-2">
<li>
<span class="radius label">Javascript</span>
</li>
<li>
<span class="radius label">Node.js</span>
</li>
<li>
<span class="radius label">Angular.js</span>
</li>
<li>
<span class="radius label">Express.js</span>
</li>
<li>
<span class="radius label">Mongodb</span>
</li>
<li>
<span class="radius label">...</span>
</li>
</ul>
<a class="small button radius right" href="#">Have a look!</a>
</div>
<a class="button hide-for-small" data-options="align:left" data-dropdown="drophireme" href="#"> <i class="fa fa-child"></i> Hire me! >></a>
<a class="button show-for-small" href="#"> <i class="fa fa-child"></i> Hire me!</a>
</li>
</ul>
</section>
</nav>
</div>
<div id="menu-icon-bar">
<div class="icon-bar five-up">
<a class="fa item active" aria-label="Home">
<i class="fa-home"></i> <label class="hide-for-small">Home</label>
</a>
<a class="fa item" aria-label="About me">
<i class="fa-child"></i> <label class="hide-for-small">About Me</label>
</a>
<a class="fa item" aria-label="My Work">
<i class="fa-search-plus"></i> <label class="hide-for-small">My Work</label>
</a>
<a class="fa item" aria-label="Contact Me">
<i class="fa-envelope"></i> <label class="hide-for-small">Contact Me</label>
</a>
<a class="fa item" aria-label="Like">
<i class="fa-file-text-o" ></i> <label class="hide-for-small">My CV</label>
</a>
</div>
</div>
<div class="">
<div class="large-9 columns">
<div class="row">
<div data-alert class="alert-box info radius">
You are viewing the English version of this site. <a href="#" title="Click on this link to navigate to the Spanish version of this site">View the Spanish version.</a>
<a href="#" class="close">×</a>
</div>
<ul class="breadcrumbs">
<li><a href="#"><i class="fa fa-home"></i> Home</a></li>
<!--<li class="unavailable"><a href="#">Gene Splicing</a></li>-->
<li class="current"><a href="#">Introduction</a></li>
</ul>
<div class="large-1 columns small-3">
<h4 class="hide-for-small"> <i class="fa fa-paw"></i></h4>
</div>
<div id="intro" class="large-11 columns">
<p><strong>Summary</strong></p>
<p class="large">I have put together some information about me to provide an insight into my approach to Web Development. I am a senior Javascript / Web Developer with mentoring skills
and have extensive experience working on intranet, Internet and mobile applications. Although lately I have specialized in the banking sector I have also worked for media, e-commerce and BI companies.
Please feel free to contact me on <a href="#">me [at] murcialito.com</a>.
<br />
Thanks for your time! <i class="fa fa-smile-o"></i>
<div class="panel hide-for-small">
<ul class="vcard">
<li class="fn">Ignacio Romero</li>
<li class="street-address">Javascript / Web Developer</li>
<li class="locality">Milton Keynes</li>
<li><span class="state">UK</span>, <span class="zip">MK9</span></li>
<li class="email"><a href="#">me[at]murcialito.com<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
</script></a></li>
</ul>
</div>
</p>
</div>
</div>
<hr>
<div class="row">
<div class="large-1 columns">
<h4 class="hide-for-small"> <i class="fa fa-building"></i></h4>
</div>
<div class="large-11 columns">
<section class="">
<p><strong>Clients</strong></p>
<p class="small">Over the last 10 years I have worked on projects for the following international institutions:</p>
<h4 class="subheader">UK</h4>
<ul class="small-block-grid-2 large-block-grid-4">
<li>
<img src="img/clients/santander.gif">
</li>
<li>
<img src="img/clients/cahoot.gif">
</li>
<li>
<img src="img/clients/alliance.gif">
</li>
<li>
<img src="img/clients/rbs.gif">
</li>
<li>
<img src="img/clients/deutsche-bank.png">
</li>
<li>
<img src="img/clients/optaros.jpg">
</li>
<li>
<img src="img/clients/zangbezang.png">
</li>
</ul>
<h4 class="subheader">SPAIN & PORTUGAL</h4>
<ul class="small-block-grid-2 large-block-grid-4">
<li>
<img src="img/clients/santander.gif">
</li>
<li>
<img src="img/clients/banesto.gif">
</li>
<li>
<img src="img/clients/vectorsf.png">
</li>
<li>
<img src="img/clients/IBI.jpeg">
</li>
</ul>
</section>
</div>
</div>
<hr>
<div class="row">
<div class="large-1 columns small-3">
<h4 class="hide-for-small"><i class="fa fa-gears"></i></h4>
</div>
<div class="large-11 columns">
<p><strong>Skills</strong></p>
<p>You can find below a summary of the most important technologies I have been working with in the last few years.</p>
<ul class="small-block-grid-2 large-block-grid-5">
<li>
<span class="radius label">Javascript</span>
</li>
<li>
<span class="radius label">Web Development</span>
</li>
<li>
<span class="radius label">Node.js</span>
</li>
<li>
<span class="radius label">Angular.js</span>
</li>
<li>
<span class="radius label">Express.js</span>
</li>
<li>
<span class="radius label">Mongodb</span>
</li>
<li>
<span class="radius label">JAVA / J2EE</span>
</li>
<li>
<span class="radius label">PHP</span>
</li>
<li>
<span class="radius label">FLEX</span>
</li>
<li>
<span class="radius label">XML / XSLT</span>
</li>
<li>
<span class="radius label">Staffware</span>
</li>
<li>
<span class="radius label">Web Services</span>
</li>
<li>
<span class="radius label">REST CRUD</span>
</li>
<li>
<span class="radius label">Foundation</span>
</li>
<li>
<span class="radius label">SphinxSearch</span>
</li>
<li>
<span class="radius label">CSS3</span>
</li>
<li>
<span class="radius label">HTML5</span>
</li>
<li>
<span class="radius label">Jquery.js</span>
</li>
<li>
<span class="radius label">Sencha.js</span>
</li>
<li>
<span class="radius label">D3.js</span>
</li>
<li>
<span class="radius label">JIRT.js</span>
</li>
<li>
<span class="radius label">backbone.js</span>
</li>
<li>
<span class="radius label">Phonegap.js</span>
</li>
<li>
<span class="radius label">Require.js</span>
</li>
<li>
<span class="radius label">Ember.js</span>
</li>
<li>
<span class="radius label">Underscore.js</span>
</li>
<li>
<span class="radius label">Grunt.js</span>
</li>
<li>
<span class="radius label">Bower</span>
</li>
<li>
<span class="radius label">GIT</span>
</li>
<li>
<span class="radius label">3rd Party APIs</span>
</li>
</ul>
</div>
</div>
</div>
<aside class="large-3 columns hide-for-small">
<div class="row panel radius">
<div class="large-4 columns">
<img src="img/IgnacioRomeroMin.jpg">
</div>
<div class="large-8 columns">
<p>
JavaScript / Web Developer with over 10 years experience developing web applications for e-commerce and banking sectors.
Mainly O.O. JavaScript developer but also fluent with other...
</p>
<a class="small button radius" href="#">Read more</a>
</div>
</div>
<div class="panel radius">
<ul class="small-block-grid-3">
<li><a href="mailto:[email protected]"><img src="img/nodejs.jpg" aria-label="Nodejs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/angularjs.png" aria-label="Angularjs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/backbone.jpeg" aria-label="Backbone"></a></li>
<li><a href="mailto:[email protected]"><img src="img/express.png" aria-label="Express"></a></li>
<li><a href="mailto:[email protected]"><img src="img/emberjs.jpeg" aria-label="Ember"></a></li>
<li><a href="mailto:[email protected]"><img src="img/d3js.png" aria-label="D3"></a></li>
<li><a href="mailto:[email protected]"><img src="img/nodejs.jpg" aria-label="Nodejs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/angularjs.png" aria-label="Angularjs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/backbone.jpeg" aria-label="Backbone"></a></li>
<li><a href="mailto:[email protected]"><img src="img/express.png" aria-label="Express"></a></li>
<li><a href="mailto:[email protected]"><img src="img/emberjs.jpeg" aria-label="Ember"></a></li>
<li><a href="mailto:[email protected]"><img src="img/d3js.png" aria-label="D3"></a></li>
<li><a href="mailto:[email protected]"><img src="img/nodejs.jpg" aria-label="Nodejs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/angularjs.png" aria-label="Angularjs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/backbone.jpeg" aria-label="Backbone"></a></li>
<li><a href="mailto:[email protected]"><img src="img/express.png" aria-label="Express"></a></li>
<li><a href="mailto:[email protected]"><img src="img/emberjs.jpeg" aria-label="Ember"></a></li>
<li><a href="mailto:[email protected]"><img src="img/d3js.png" aria-label="D3"></a></li>
<li><a href="mailto:[email protected]"><img src="img/nodejs.jpg" aria-label="Nodejs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/angularjs.png" aria-label="Angularjs"></a></li>
<li><a href="mailto:[email protected]"><img src="img/backbone.jpeg" aria-label="Backbone"></a></li>
<li><a href="mailto:[email protected]"><img src="img/express.png" aria-label="Express"></a></li>
<li><a href="mailto:[email protected]"><img src="img/emberjs.jpeg" aria-label="Ember"></a></li>
<li><a href="mailto:[email protected]"><img src="img/d3js.png" aria-label="D3"></a></li>
</ul>
</div>
</aside>
</div>
<footer class="">
<div class="large-12 columns">
<div>
<div class="">
<div class="medium-12 columns">
<div class="">
<div class="medium-4 columns">
<div>
<h4 class="hide-for-small">Contracting</h4>
<h6>
Please <a href="contact.html"><strong>contact me</strong></a> if you are looking for a Javascript Developer.
</h6>
<ul>
<li><a href="hourlies.html">Hourlies</a></li>
<li><a href="projects.html">Projects</a></li>
<li><a href="projectsupport.html">Project Support</a></li>
<li><a href="Mentoring.html">Mentoring</a></li>
<li><a href="consultancy.html">Consultancy</a></li>
</ul>
</div>
</div>
<div class="medium-4 columns">
<div class="support-links">
<h4 class="hide-for-small">Stay in Touch</h4>
<p><h6><strong>Github</strong></h6> <a href="https://github.com/murcialito/"><i class="catchmeat fa fa-github-alt"></i> /murcialito</a></p>
<p><h6><strong>PeoplePerHour</strong></h6> <a href="http://www.peopleperhour.com/freelancer/ignacio/javascript-web-developer/581628"><i class="catchmeat fa fa-smile-o"></i> /freelancer/ignacio/javascript-web-developer/581628</a></p>
<p><h6><strong>Linkedin</strong></h6> <a href="https://uk.linkedin.com/in/ircolomo/"><i class="catchmeat fa fa-linkedin"></i> uk.linkedin.com/in/ircolomo/</a></p>
<p><h6><strong>Google+</strong></h6> <a href="https://plus.google.com/116052227247756011638"><i class="catchmeat fa fa-google-plus"></i> /murcialito</a></p>
</div>
</div>
<div class="medium-4 columns">
<div>
<h4 class="hide-for-small">Newsletters</h4>
<h6>I will post here anything I think I should be sharing with others, please <a href="registernewsletter.html"><strong>register</strong></a> to this newsletter if you feel it might be interesting.</h6>
<a class="small button" href="register.html">Register</a>
<hr/>
<ul class="vcard">
<li class="fn">Ignacio Romero</li>
<li class="street-address">Javascript / Web Developer</li>
<li class="locality">Milton Keynes</li>
<li><span class="state">UK</span>, <span class="zip">MK9</span></li>
<li class="email"><a href="#">me[at]murcialito.com<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();
/* ]]> */
</script></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="">
<div class="large-12 columns">
<div class="medium-6 columns">
<p>© 2014 Esferia LTD. All rights reserved.</p>
</div>
<div class="medium-6 columns">
<ul class="inline-list right">
<li><a href="index.html"><i class="fa fa-home"></i> Home</a></li>
<li><a href="aboutme.html"><i class="fa fa-child"></i> About Me</a></li>
<li><a href="mywork.html"><i class="fa fa-search-plus"></i> My Work</a></li>
<li><a href="contact.html"><i class="fa fa-envelope"></i> Contact Me</a></li>
<li><a href="mycv.html"><i class="fa fa-file-text-o" ></i> My CV</a></li>
</ul>
</div>
</div>
</div>
</footer>
<!--
<div class="container">
<div class="jumbotron text-center" ng-prueba>
<h1>Nº de Registros: <span class="label label-success">{{ personas.length }}</span></h1>
</div>
<div class="row">
<div class="col-sm-6 col-sm-offset-1">
<table class="table table-striped">
<tr class="info">
<td>Nombre</td>
<td>Apellidos</td>
<td>Edad</td>
</tr>
<tr ng-repeat="persona in personas" ng-click="selectPerson(persona)">
<td>{{ persona.nombre }}</td>
<td>{{ persona.apellido }}</td>
<td>{{ persona.edad }}</td>
</tr>
</table>
</div>
<div class="col-sm-4 col-sm-offset-1 text-center">
<form name="myForm">
<div class="form-group">
<input type="text" class="form-control input-lg text-center" placeholder="Nombre" ng-model="newPersona.nombre" required>
<br>
<input type="text" class="form-control input-lg text-center" placeholder="Apellido" ng-model="newPersona.apellido" required>
<br>
<input type="text" class="form-control input-lg text-center" placeholder="Edad" ng-model="newPersona.edad" required>
</div>
<button type="submit" class="btn btn-success btn-lg" ng-click="registrarPersona()" ng-disabled="myForm.$invalid || selected">Registrar</button>
<button type="submit" class="btn btn-warning btn-lg" ng-click="modificarPersona(newPersona)" ng-disabled="!newPersona.nombre || !newPersona.apellido || !newPersona.edad || !selected">Modificar</button>
<button type="submit" class="btn btn-danger btn-lg" ng-click="borrarPersona(newPersona)" ng-disabled="!newPersona.nombre || !newPersona.apellido || !newPersona.edad || !selected">Borrar</button>
</form>
</div>
</div>
</div>-->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/foundation/js/foundation.js"></script>
<script src="bower_components/foundation/js/foundation/foundation.topbar.js"></script>
<script src="js/angular/core.js"></script>
<script src="js/app.js"></script>
</body>
</html> | murcialito/murcialito.com | views/index.html | HTML | mit | 19,642 |
//Mongoskin
var mongo = require('mongoskin')
var collectionName_flowset = 'flowset'
var connectionString = 'mongodb://zubietaroberto:[email protected]:10030/netflow_test'
var db = mongo.db(connectionString);
var flowsetCollection = db.collection(collectionName_flowset)
module.exports = {
saveFlowset: function(data, callback){
flowsetCollection.insert(data, callback);
},
findLatest: function(data, callback){
flowsetCollection.find(data).toArray(callback);
},
findDistinct: function (fieldname, callback) {
flowsetCollection.distinct(fieldname, callback);
},
countBytesByField: function (field_name, callback) {
var field = "$" + field_name;
var data = ([
{ $group : { _id : field, count: { $sum : "$IN_BYTES" } } },
{ $sort: { _id: 1 }}
]);
flowsetCollection.aggregate(data, callback);
}
} | zubietaroberto/NetflowCollector | datastore/index.js | JavaScript | mit | 904 |
#!/bin/sh
if [ -z "$build" ] ; then
echo '$build is undefined'
exit 1
fi
if [ -z "$package_dir" ] ; then
echo '$package_dir is undefined'
exit 1
fi
package=picosat
version=936
source=$package-$version.tar.gz
build_dir=$build/$package-$version
url=http://fmv.jku.at/$package/$source
unpack(){
cd $cache &&
tar -xf $source &&
rm -rf $build_dir &&
mv -f $cache/$package-$version $build_dir
}
pre_build() {
cd $build_dir &&
install_cmake_files $cmake_files_dir
}
build_install() {
if [ -z "$target" ] ; then
echo '$target is undefined'
exit 1
fi
cd $build_dir &&
cmake_build_install
}
# vim: ts=2 sw=2 et
| hoangmle/crave-bundle-2015-07-22 | dependencies/picosat-936/shared.sh | Shell | mit | 647 |
import reiknivelar
import wx
import Reikningar
import plot
lan = []
#--- Ákveðin föst verðbólga hjá okkur!
verdbolga = 5.804
class Tab1(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY, size=(0,0))
hbox = wx.BoxSizer(wx.HORIZONTAL)
vbox1 = wx.BoxSizer(wx.VERTICAL)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox3 = wx.GridSizer(7,2,0,0)
vbox4 = wx.GridSizer(7,2,0,0)
pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
self.lc = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
self.lc.InsertColumn(0, u'Nafn')
self.lc.InsertColumn(1, u'Vextir')
self.lc.InsertColumn(2, u'Verðtryggt')
self.lc.InsertColumn(3, u'Höfudstoll')
self.lc.InsertColumn(4, u'Lengd i mánuðum')
self.lc.SetColumnWidth(0, 140)
self.lc.SetColumnWidth(1, 130)
self.lc.SetColumnWidth(2, 130)
self.lc.SetColumnWidth(3, 150)
self.lc.SetColumnWidth(4, 170)
guide = wx.StaticText(pnl1, -1, u'Skráðu inn í kerfið þitt eigið lán')
guide2 = wx.StaticText(pnl2, -1, u'Finndu bestu sparnaðarleiðina')
guide.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
guide2.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD))
yesno = [u'Já', 'Nei']
vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
vbox2.Add(self.lc, 1, wx.EXPAND)
self.tc1 = wx.TextCtrl(pnl1, -1)
self.tc2 = wx.TextCtrl(pnl1, -1)
self.tc3 = wx.ComboBox(pnl1, -1, size=(110,-1), choices=yesno)
self.tc4 = wx.TextCtrl(pnl1, -1)
self.tc5 = wx.TextCtrl(pnl1, -1)
vbox3.AddMany([
(guide,0, wx.ALIGN_CENTER| wx.TOP, 0),
(wx.StaticText(pnl1, -1, u''),0, wx.ALIGN_CENTER| wx.TOP, 0),
(wx.StaticText(pnl1, -1, u'Nafn láns:'),0, wx.ALIGN_CENTER| wx.TOP, 0),
(self.tc1, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 0),
(wx.StaticText(pnl1, -1, u'Vextir:'),0, wx.ALIGN_CENTER| wx.TOP, 0),
(self.tc2,0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 0),
(wx.StaticText(pnl1, -1, u'Verdtryggt:'),0, wx.ALIGN_CENTER| wx.TOP, 0),
(self.tc3, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 0),
(wx.StaticText(pnl1, -1, u'Höfuðstóll:'),0, wx.ALIGN_CENTER| wx.TOP, 0),
(self.tc4, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 0),
(wx.StaticText(pnl1, -1, u'Lengd i mánuðum:'),0, wx.ALIGN_CENTER| wx.TOP, 0),
(self.tc5, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 0),
(wx.Button(pnl1, 10, u'Bæta við'), 0, wx.ALIGN_CENTER| wx.TOP, 0),
(wx.Button(pnl1, 12, u'Hreinsa'), 0, wx.ALIGN_CENTER| wx.TOP, 0)])
pnl1.SetSizer(vbox3)
self.tc6 = wx.TextCtrl(pnl2, -1)
self.tc7 = wx.TextCtrl(pnl2, -1)
self.tc8 = wx.TextCtrl(pnl2, -1)
self.tc9 = wx.TextCtrl(pnl2, -1, style=wx.TE_READONLY, size = (165, 25))
vbox4.Add(guide2 ,0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.StaticText(pnl2, -1, u''),0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.StaticText(pnl2, -1, u'Mánaðarleg upphæð til sparnaðar:'),0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(self.tc6, 0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.StaticText(pnl2, -1, u'Tími (mánuðir):'),0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(self.tc7, 0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.StaticText(pnl2, -1, u'Mesta binding í banka (mánuðir):'),0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(self.tc8, 0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.Button(pnl2, 13, u'Finna'), 0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.StaticText(pnl2, -1, u''),0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.StaticText(pnl2, -1, u'Besta að leggja inná:'),0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(self.tc9, 0, wx.ALIGN_CENTER| wx.TOP, 0)
vbox4.Add(wx.Button(pnl2, 14, u'Myndrænt'), 0, wx.ALIGN_CENTER| wx.TOP, 0)
self.lc2 = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
self.lc2.InsertColumn(0, u'Nafn')
self.lc2.InsertColumn(1, u'Vextir')
self.lc2.InsertColumn(2, u'Verðtryggt')
self.lc2.InsertColumn(3, u'Binding i mánuðum')
self.lc2.InsertColumn(4, u'Innistæðuhækkun vaxta')
self.lc2.SetColumnWidth(0, 200)
self.lc2.SetColumnWidth(1, 100)
self.lc2.SetColumnWidth(2, 100)
self.lc2.SetColumnWidth(3, 120)
self.lc2.SetColumnWidth(4, 120)
vbox2.Add(self.lc2, 1, wx.EXPAND)
for i in range(len(Reikningar.Reikningar)):
self.lc2.InsertStringItem(i, Reikningar.Reikningar[i][0])
self.lc2.SetStringItem(i, 1, Reikningar.Reikningar[i][1])
self.lc2.SetStringItem(i, 2, Reikningar.Reikningar[i][2])
self.lc2.SetStringItem(i, 3, Reikningar.Reikningar[i][3])
self.lc2.SetStringItem(i, 4, Reikningar.Reikningar[i][4])
pnl2.SetSizer(vbox4)
self.Bind (wx.EVT_BUTTON, self.OnAdd, id=10)
#self.Bind (wx.EVT_BUTTON, self.OnRemove, id=11)
self.Bind (wx.EVT_BUTTON, self.OnClear, id=12)
self.Bind (wx.EVT_BUTTON, self.OnFind, id=13)
self.Bind (wx.EVT_BUTTON, self.OnPlot, id=14)
hbox.Add(vbox1, 1, wx.EXPAND)
hbox.Add(vbox2, 1, wx.EXPAND)
self.SetSizer(hbox)
def OnAdd(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue() or not self.tc4.GetValue() or not self.tc5.GetValue():
return
num_items = self.lc.GetItemCount()
self.lc.InsertStringItem(num_items, self.tc1.GetValue())
self.lc.SetStringItem(num_items, 1, self.tc2.GetValue())
self.lc.SetStringItem(num_items, 2, self.tc3.GetValue())
self.lc.SetStringItem(num_items, 3, self.tc4.GetValue())
self.lc.SetStringItem(num_items, 4, self.tc5.GetValue())
l = [self.tc1.GetValue(),float(self.tc2.GetValue()),self.tc3.GetValue(),
int(self.tc4.GetValue()),int(self.tc5.GetValue())]
lan.append(l)
print(lan)
self.tc1.Clear()
self.tc2.Clear()
self.tc4.Clear()
self.tc5.Clear()
def OnRemove(self, event):
index = self.lc.GetFocusedItem()
self.lc.DeleteItem(index)
def OnClear(self, event):
self.lc.DeleteAllItems()
def OnFind(self, event):
if not self.tc6.GetValue() or not self.tc7.GetValue() or not self.tc8.GetValue():
return
u = int(self.tc6.GetValue())
t = int(self.tc7.GetValue())
m = float(self.tc8.GetValue())
a = ''
p = 0
#--- lr er 0 ef best er ad leggja inn a lan, 1 ef reikning
lr = 0
for i in range(len(lan)):
if reiknivelar.verdtryggt(lan[i][2]):
temp = float(lan[i][1]) + verdbolga
temp2 = reiknivelar.reglulegurspar(u, t, temp)
if(p < temp2):
p = temp2
a = lan[i][0]
lr = i + 1
else:
temp = float(lan[i][1])
temp2 = reiknivelar.reglulegurspar(u, t, temp)
if(p < temp2):
p = temp2
a = lan[i][0]
lr = i + 1
for j in range(len(Reikningar.Reikningar)):
R = float(Reikningar.Reikningar[j][3])
minsta = Reikningar.Reikningar[j][4]
if R <= m:
if(minsta == u'Nei'):
if(reiknivelar.verdtryggt(Reikningar.Reikningar[j][2])):
temp = float(Reikningar.Reikningar[j][1]) + verdbolga
temp2 = reiknivelar.reglulegurspar(u, t, temp)
if(p<temp2):
p = temp2
a = Reikningar.Reikningar[j][0]
lr = 0
else:
temp = float(Reikningar.Reikningar[j][1])
temp2 = reiknivelar.reglulegurspar(u, t, temp)
if(p<temp2):
p = temp2
a = Reikningar.Reikningar[j][0]
lr = 0
#elif minsta == u'Já':
#--- Hér kemur útreikningur fyrir reikninga með breytilega vexti
#--- eftir upphæð innistæðu
self.tc9.Clear()
self.tc9.AppendText(a)
#msg = u'Hagstæðast er að borga inn á: "'+ a + '"'
#dc = wx.MessageDialog(None, msg)
#dc.ShowModal()
def OnPlot(self, event):
if not self.tc9.GetValue():
return
hofudstoll = 0
timabil = 0
vextir = 0.0
manadargreidsla = int(self.tc6.GetValue())
fjoldiManadarGreidslna = int(self.tc7.GetValue())
for i in range(len(lan)):
if lan[i][0] == self.tc9.GetValue():
hofudstoll = lan[i][3]
timabil = lan[i][4]
vextir = lan[i][1]
plot.plot_hofudstols_ryrnun(hofudstoll, timabil, vextir, verdbolga, manadargreidsla, fjoldiManadarGreidslna)
class Tab2(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
hbox = wx.BoxSizer(wx.VERTICAL)
vbox1 = wx.BoxSizer(wx.VERTICAL)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox3 = wx.GridSizer(7,3,0,0)
vbox4 = wx.BoxSizer(wx.VERTICAL)
pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
self.lc = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3)
self.tc1 = wx.TextCtrl(pnl1, -1)
self.tc2 = wx.TextCtrl(pnl1, -1)
self.tc3 = wx.TextCtrl(pnl1, -1)
self.tc4 = wx.TextCtrl(pnl1, -1, style=wx.TE_READONLY)
vbox3.AddMany([ (wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Reiknaðu út hvað regluleg mánaðarleg greiðsla verður orðin mikil eftir ákveðinn tíma og ávöxtun.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Mánaðarleg greiðsla:'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(self.tc1, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'krónur. Fjárhæð sem er lögð inn á hverjum mánuði. '),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Lengd timabils:'),0, wx.ALIGN_CENTER| wx.TOP, 40),
(self.tc2,0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 40),
(wx.StaticText(pnl1, -1, u'mánuðir. Lengd sparnaðartímabils.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Vextir:'),0, wx.ALIGN_CENTER| wx.TOP, 35),
(self.tc3, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 35),
(wx.StaticText(pnl1, -1, u'%. Vextir á sparnaðartímabili.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 35),
(wx.Button(pnl1, 10, u'Reikna'), 0, wx.ALIGN_CENTER| wx.TOP, 30),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Þú munt eiga:'),0, wx.ALIGN_CENTER| wx.TOP, 20),
(self.tc4, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 20),
(wx.StaticText(pnl1, -1, u'krónur.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 35),
(wx.Button(pnl1, 11, u'Myndrænt'), 0, wx.ALIGN_CENTER| wx.TOP, 30)])
pnl1.SetSizer(vbox3)
pnl2.SetSizer(vbox4)
self.Bind (wx.EVT_BUTTON, self.OnAdd, id=10)
self.Bind (wx.EVT_BUTTON, self.OnPlot, id=11)
hbox.Add(vbox1, 1, wx.EXPAND)
hbox.Add(vbox2, 1, wx.EXPAND)
self.SetSizer(hbox)
def OnAdd(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue():
return
self.tc4.Clear()
greidsla = int(self.tc1.GetValue())
timabil = int(self.tc2.GetValue())
vextir = float(self.tc3.GetValue())
nidurstada = reiknivelar.reglulegurspar(greidsla, timabil, vextir)
if nidurstada == None:
nidurstada = 'Villa'
self.tc4.SetForegroundColour(wx.RED)
else:
self.tc4.SetForegroundColour(wx.BLACK)
nidurstada = int(nidurstada)
self.tc4.AppendText(str(nidurstada))
def OnPlot(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue() or not self.tc4.GetValue():
return
greidsla = int(self.tc1.GetValue())
timabil = int(self.tc2.GetValue())
vextir = float(self.tc3.GetValue())
plot.plot_reglulegurspar(greidsla, timabil, vextir)
class Tab3(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
hbox = wx.BoxSizer(wx.VERTICAL)
vbox1 = wx.BoxSizer(wx.VERTICAL)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox3 = wx.GridSizer(7,3,0,0)
vbox4 = wx.BoxSizer(wx.VERTICAL)
pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
self.lc = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3)
self.tc1 = wx.TextCtrl(pnl1, -1)
self.tc2 = wx.TextCtrl(pnl1, -1)
self.tc3 = wx.TextCtrl(pnl1, -1)
self.tc4 = wx.TextCtrl(pnl1, -1, style=wx.TE_READONLY)
vbox3.AddMany([ (wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Reiknaðu út hvað eign þín verður orðin mikil eftir ákveðinn tíma og ávöxtun.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Upphafleg eign:'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(self.tc1, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'krónur. Fjárhæð sem til er fyrir sparnað. '),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Lengd timabils:'),0, wx.ALIGN_CENTER| wx.TOP, 40),
(self.tc2,0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 40),
(wx.StaticText(pnl1, -1, u'ár. Lengd sparnaðartímabils.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Vextir:'),0, wx.ALIGN_CENTER| wx.TOP, 35),
(self.tc3, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 35),
(wx.StaticText(pnl1, -1, u'%. Vextir á sparnaðartímabili.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 35),
(wx.Button(pnl1, 10, u'Reikna'), 0, wx.ALIGN_CENTER| wx.TOP, 30),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Þú munt eiga:'),0, wx.ALIGN_CENTER| wx.TOP, 20),
(self.tc4, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 20),
(wx.StaticText(pnl1, -1, u'krónur.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.Button(pnl1, 11, u'Myndrænt'), 0, wx.ALIGN_CENTER| wx.TOP, 30)])
pnl1.SetSizer(vbox3)
pnl2.SetSizer(vbox4)
self.Bind (wx.EVT_BUTTON, self.OnAdd, id=10)
self.Bind (wx.EVT_BUTTON, self.OnPlot, id=11)
hbox.Add(vbox1, 1, wx.EXPAND)
hbox.Add(vbox2, 1, wx.EXPAND)
self.SetSizer(hbox)
def OnAdd(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue():
return
self.tc4.Clear()
eign = int(self.tc1.GetValue())
timabil = int(self.tc2.GetValue())
vextir = float(self.tc3.GetValue())
nidurstada = reiknivelar.framtidarvirdi(eign, timabil, vextir)
if nidurstada == None:
nidurstada = 'Villa'
self.tc4.SetForegroundColour(wx.RED)
else:
self.tc4.SetForegroundColour(wx.BLACK)
nidurstada = int(nidurstada)
self.tc4.AppendText(str(nidurstada))
def OnPlot(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue() or not self.tc4.GetValue():
return
eign = int(self.tc1.GetValue())
timabil = int(self.tc2.GetValue())
vextir = float(self.tc3.GetValue())
plot.plot_framtidarvirdi(eign, timabil, vextir)
class Tab4(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
hbox = wx.BoxSizer(wx.VERTICAL)
vbox1 = wx.BoxSizer(wx.VERTICAL)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox3 = wx.GridSizer(7,3,0,0)
vbox4 = wx.BoxSizer(wx.VERTICAL)
pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
self.lc = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3)
self.tc1 = wx.TextCtrl(pnl1, -1)
self.tc2 = wx.TextCtrl(pnl1, -1)
self.tc3 = wx.TextCtrl(pnl1, -1)
self.tc4 = wx.TextCtrl(pnl1, -1, style=wx.TE_READONLY)
self.tc5 = wx.TextCtrl(pnl1, -1)
vbox3.AddMany([ (wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Reiknar út hvað þú þarft að leggja fyrir á mánuði til að ná óskaupphæðinni þinni eftir ákveðinn tíma'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Óskaupphæð:'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(self.tc1, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'krónur. Fjárhæð sem þú vilt eiga i lok sparnaðar. '),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Upphafleg eign:'),0, wx.ALIGN_CENTER| wx.TOP, 40),
(self.tc2,0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 40),
(wx.StaticText(pnl1, -1, u'krónur. Fjárhæð sem til er í upphafi sparnaðar.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Tímabil:'),0, wx.ALIGN_CENTER| wx.TOP, 35),
(self.tc3, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 35),
(wx.StaticText(pnl1, -1, u'ár. Lengd sparnaðartímabils í árum.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Vextir:'),0, wx.ALIGN_CENTER| wx.TOP, 35),
(self.tc5, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 35),
(wx.StaticText(pnl1, -1, u'%. Vextir á sparnaðartímabili.'),0, wx.ALIGN_CENTER| wx.TOP, 35),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 35),
(wx.Button(pnl1, 10, u'Reikna'), 0, wx.ALIGN_CENTER| wx.TOP, 30),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Þú þarft að leggja:'),0, wx.ALIGN_CENTER| wx.TOP, 20),
(self.tc4, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 20),
(wx.StaticText(pnl1, -1, u'krónur fyrir á mánuði.'),0, wx.ALIGN_CENTER| wx.TOP, 45)])
pnl1.SetSizer(vbox3)
pnl2.SetSizer(vbox4)
self.Bind (wx.EVT_BUTTON, self.OnAdd, id=10)
hbox.Add(vbox1, 1, wx.EXPAND)
hbox.Add(vbox2, 1, wx.EXPAND)
self.SetSizer(hbox)
def OnAdd(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue() or not self.tc5.GetValue():
return
self.tc4.Clear()
upphaed = int(self.tc1.GetValue())
eign = int(self.tc2.GetValue())
timabil = int(self.tc3.GetValue())
vextir = float(self.tc5.GetValue())
nidurstada = reiknivelar.sparnadar_takmark(upphaed, eign, timabil, vextir)
if nidurstada == None:
nidurstada = 'Villa'
self.tc5.SetForegroundColour(wx.RED)
else:
self.tc5.SetForegroundColour(wx.BLACK)
nidurstada = int(nidurstada)
self.tc4.AppendText(str(nidurstada))
class Tab5(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY)
hbox = wx.BoxSizer(wx.VERTICAL)
vbox1 = wx.BoxSizer(wx.VERTICAL)
vbox2 = wx.BoxSizer(wx.VERTICAL)
vbox3 = wx.GridSizer(7,3,0,0)
vbox4 = wx.BoxSizer(wx.VERTICAL)
pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
self.lc = wx.ListCtrl(self, -1, style=wx.LC_REPORT)
vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3)
self.tc1 = wx.TextCtrl(pnl1, -1)
self.tc2 = wx.TextCtrl(pnl1, -1)
self.tc3 = wx.TextCtrl(pnl1, -1)
self.tc4 = wx.TextCtrl(pnl1, -1, style=wx.TE_READONLY)
self.tc5 = wx.TextCtrl(pnl1, -1, style=wx.TE_READONLY)
vbox3.AddMany([ (wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Reiknar út hversu lengi það tekur þig að spara vissa upphæð ef þú leggur ákveðna upphæð fyrir á mánuði.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Upphæð:'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(self.tc1, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'krónur. Fjárhæð sem á að spara fyrir. '),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Sparnaður á mánuði:'),0, wx.ALIGN_CENTER| wx.TOP, 40),
(self.tc2,0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 40),
(wx.StaticText(pnl1, -1, u'krónur.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Vextir:'),0, wx.ALIGN_CENTER| wx.TOP, 35),
(self.tc3, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 35),
(wx.StaticText(pnl1, -1, u'%. Vextir á sparnaðartímabili.'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 35),
(wx.Button(pnl1, 10, u'Reikna'), 0, wx.ALIGN_CENTER| wx.TOP, 30),
(wx.StaticText(pnl1, -1, ''),0, wx.ALIGN_CENTER| wx.TOP, 45),
(wx.StaticText(pnl1, -1, u'Það tekur þig:'),0, wx.ALIGN_CENTER| wx.TOP, 20),
(self.tc4, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 20),
(wx.StaticText(pnl1, -1, u'ár'),0, wx.ALIGN_CENTER| wx.TOP, 20),
(wx.StaticText(pnl1, -1, u'og'),0, wx.ALIGN_CENTER| wx.TOP, 45),
(self.tc5, 0, wx.ALIGN_LEFT|wx.ALIGN_CENTER| wx.TOP, 20),
(wx.StaticText(pnl1, -1, u'mánuði.'),0, wx.ALIGN_CENTER| wx.TOP, 45)])
pnl1.SetSizer(vbox3)
pnl2.SetSizer(vbox4)
self.Bind (wx.EVT_BUTTON, self.OnAdd, id=10)
hbox.Add(vbox1, 1, wx.EXPAND)
hbox.Add(vbox2, 1, wx.EXPAND)
self.SetSizer(hbox)
def OnAdd(self, event):
if not self.tc1.GetValue() or not self.tc2.GetValue() or not self.tc3.GetValue():
return
self.tc4.Clear()
self.tc5.Clear()
markmid = int(self.tc1.GetValue())
upphaed = int(self.tc2.GetValue())
vextir = float(self.tc3.GetValue())
nidurstada = reiknivelar.sparnadar_timi(markmid, upphaed, vextir)
if nidurstada == None:
ar = 'Villa'
man = 'Villa'
self.tc4.SetForegroundColour(wx.RED)
self.tc5.SetForegroundColour(wx.RED)
else:
self.tc4.SetForegroundColour(wx.BLACK)
self.tc5.SetForegroundColour(wx.BLACK)
ar = reiknivelar.sparnadar_timi(markmid, upphaed, vextir)[0]
man = reiknivelar.sparnadar_timi(markmid, upphaed, vextir)[1]
ar = int(ar)
man = int(man)
self.tc4.AppendText(str(ar))
self.tc5.AppendText(str(man))
| gudnithor4/ThrounHugb | Tabs.py | Python | mit | 26,619 |
#!/bin/sh
command=$1
branch=$2
if [ $command = "checkout" ]; then
if [ $branch = "master" ]; then
git checkout client_lib
elif [ $branch = "dev" ]; then
git checkout dev_client_lib
fi
elif [ $command = "merge" ]; then
if [ $branch = "master" ]; then
git merge client_lib
elif [ $branch = "dev" ]; then
git merge dev_client_lib
fi
fi
| SyncShift/NodeSyncShift | client_electron/foreach.sh | Shell | mit | 390 |
#ifndef TLC5940_H_
#define TLC5940_H_
namespace TLC5940 {
void init(uint8_t count);
void destroy();
void blank();
void display();
void setLED(uint8_t id, uint8_t intensity);
void fadeLED(uint8_t id, uint8_t intensity, uint16_t duration);
void setDriverDC(uint8_t id, uint8_t value);
void flushDC();
void shift(uint8_t data, uint8_t len);
void fade();
extern bool flush;
};
#endif
| JanSkalny/AVR | AmbiLED/Display/TLC5940.h | C | mit | 396 |
<style>
.editable{
display:none;
}
input[type=file] {
display: none;
width:95px;
}
input[type=text] {
width:95px;
}
</style>
<script src="<?php echo base_url(); ?>assets/admin/js/plugin/summernote/summernote.min.js"></script>
<link href="<?php echo base_url(); ?>assets/admin/css/custom-main.css" rel="stylesheet">
<?php $this->load->view('themes/admin/breadcrumb'); ?>
<div id="content">
<div class="m-b-10">
<div class="pull-left">
<h3 class="pull-left">
<strong>Services List</strong>
</h3>
</div>
<?php
if($permissionValue==4 || $permissionValue==5 || $permissionValue==6 || $permissionValue==7){
?>
<div class="pull-right">
<a href="<?php echo base_url('admin/services/add');?>" class="btn btn-primary"><i class="fa fa-plus"></i>Add Service</a>
</div>
<?php
}
?>
</div>
<!-- widget grid -->
<section id="widget-grid" class="">
<!-- row -->
<div class="row">
<!-- NEW WIDGET START -->
<article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<!-- Widget ID (each widget will need unique ID)-->
<div class="jarviswidget jarviswidget-color-darken" id="wid-id-0" data-widget-editbutton="false">
<header>
<span class="widget-icon"> <i class="fa fa-table"></i> </span>
<h2><?=$list_heading?></h2>
</header>
<!-- widget div-->
<div>
<div class="jarviswidget-editbox">
</div>
<!-- end widget edit box -->
<!-- widget content -->
<div class="widget-body no-padding">
<table id="dt_basic" class="table table-striped table-bordered table-hover" width="100%">
<thead>
<tr>
<th>Service Type</th>
<th>Service</th>
<th>Icon</th>
<th>Description</th>
<th>Price USD (Hourly)</th>
<th>Gender</th>
<th>Status</th>
<?php
if($permissionValue==2 || $permissionValue==3 || $permissionValue==6 || $permissionValue==7){
?>
<th class="sorting">Action</th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
if (!empty($services)) {
foreach ($services as $service) {
$serviceType = ($service->service_type==0) ? "Main " : "Extra ";
?>
<tr id="<?=$service->id.'_A';?>">
<?= form_open( 'admin/services/customEdit', ['class' => 'smart-form','id' => 'service-form-'.$service->id.' ','enctype'=>"multipart/form-data",'data-parsley-validate'=>"data-parsley-validate"]); ?>
<td>
<span class="view<?=$service->id;?>" id="service_type<?=$service->id;?>"><?=$serviceType;?></span>
<select name="service_type" class="a<?=$service->id;?> editable" data-parsley-required id="service_type" class="a<?=$service->id;?>">
<option value="0" <?=($service->service_type==0) ? 'selected' : '' ?> >Main</option>
<option value="1" <?=($service->service_type==1) ? 'selected' : '' ?>>Extra</option>
</select>
</td>
<td>
<span class="view<?=$service->id;?>" id="name<?=$service->id;?>"><?=(!empty($service->name)) ? $service->name : "N/A";?></span>
<input class="a<?=$service->id;?> editable" type="text" maxlength="100" placeholder="Service Name" name="name" required="" value="<?=!empty($service->name) ? $service->name : '';?>">
<input type="hidden" name="id" required="" value="<?=!empty($service->id) ? $service->id : 0;?>">
</td>
<td>
<span class="view<?=$service->id;?>" id="images<?=$service->id;?>">
<?php
if(!empty($service->images)){
$imgPath = FCPATH.'assets/front/services-images/'.$service->images;
$imgSrc = base_url('assets/front/services-images/'.$service->images);
if($imgPath){
echo '<img src="'.$imgSrc.'" >';
}else{
echo 'N/A';
}
}else{
echo 'N/A';
}
?>
</span>
<input type="file" class="service-edit-img a<?=$service->id;?> editable" name="images" class="a<?=$service->id;?> editable"/>
</td>
<td>
<p class="view<?=$service->id;?>" id="description<?=$service->id;?>"><?=(!empty($service->description)) ? ellipsize($service->description,50) : "N/A";?></p>
<textarea class="a<?=$service->id;?> editable" name="description" id="description" data-parsley-length="[0, 500]" placeholder="Service Description"><?=!empty($service->description) ? $service->description : '';?></textarea>
</td>
<td>
<span class="view<?=$service->id;?>" id="price<?=$service->id;?>"><?=(!empty($service->price)) ? $service->price : 0;?></span>
<input class="a<?=$service->id;?> editable" type="text" placeholder="Service Price Hourly" name="price" maxlength="5" value="<?=!empty($service->price) ? $service->price : '';?>">
</td>
<?php
$catStatus = "";$select='';$select1='';$select2='';
if($service->type=='1'){
$catStatus="Female";
$select='selected';
}
if($service->type=='2'){
$catStatus="Male";
$select1='selected';
}
if($service->type=='3'){
$catStatus="Other";
$select2='selected';
}
?>
<td><span class="view<?=$service->id;?> " id="type<?=$service->id;?>"><?=$catStatus;?></span>
<select name="type" class="a<?=$service->id;?> editable" data-parsley-required id="status" class="a<?=$service->id;?>">
<option value="1" <?=$select ?> >Female</option>
<option value="2" <?=$select1?>>Male</option>
<option value="3" <?=$select2?>>Other</option>
</select></td>
<td>
<?php
$catStatus = "";$catStatusClass = "";
if($service->status==1){
$serStatusClass = "label-success";$serStatus = "Active";
}else{
$serStatusClass = "label-warning";$serStatus = "Inactive";
}
?>
<span class="view<?=$service->id;?> label <?=$serStatusClass;?>" id="status<?=$service->id;?>"><?=$serStatus;?></span>
<select name="status" class="a<?=$service->id;?> editable" data-parsley-required id="status" class="a<?=$service->id;?>">
<option value="1" <?=($service->status==1) ? 'selected' : '' ?> >Active</option>
<option value="0" <?=($service->status==0) ? 'selected' : '' ?>>Inactive</option>
</select>
</td>
<?php
if($permissionValue==2 || $permissionValue==3 || $permissionValue==6 || $permissionValue==7){
?>
<td>
<a class="btn btn-success view<?=$service->id;?>" href="javascript:void(0)" data-id="<?=$service->id?>" data-view-id="<?=$service->id?>">Edit</a>
<?php
//base_url('services/edit/'.$service->id);
?>
<button class="btn btn-success update pull-right editable a<?=$service->id ?>" data-id="<?=$service->id?>" onClick='submitDetailsForm('<?=$service->id?>')'>Update</button>
</td>
<?php } ?>
<?= form_close(); ?>
</tr>
<?php } }?>
</tbody>
</table>
</div>
<!-- end widget content -->
</div>
<!-- end widget div -->
</div>
<!-- end widget -->
</article>
<!-- WIDGET END -->
</div>
</section>
</div>
<script src="<?php echo base_url(); ?>assets/admin/js/plugin/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url(); ?>assets/admin/js/plugin/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#dt_basic').dataTable({
"sDom": "<'dt-toolbar'<'col-xs-12 col-sm-6'f><'col-sm-6 col-xs-12 hidden-xs'l>r>" +
"t" +
"<'dt-toolbar-footer'<'col-sm-6 col-xs-12 hidden-xs'i><'col-xs-12 col-sm-6'p>>",
"autoWidth": true,
});
$('#dt_basic').on('click','.btn-success', function (){
var id = $(this).attr('data-id');
var vId = $(this).attr('data-view-id');
$('.view'+vId).css('display', 'none');
if(id){
$('.a'+id).css('display', 'block');
}
});
})
</script>
| wikitis/babesdirect | application/views/admin/services/index.php | PHP | mit | 10,185 |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>W28584_text</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;">
<div style="float: left;">
<a href="page47.html">«</a>
</div>
<div style="float: right;">
</div>
</div>
<hr/>
<div style="position: absolute; margin-left: 1841px; margin-top: 0px;">
<p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 246px; margin-top: 109px;">
<p class="styleSans15.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">30300 MM) 3050-! Mryc <br/>BRAUN corn arm? INTERTEC <br/> <br/>Letter of Transmittal 1 <br/> <br/> <br/>The Science You Build On. Client: Hess Bakken Investments ll, LLC Project No: 81500838 Project Name: LK-A Qtr Cir 147-96-1807 H-4—7 Well Pad Date: February 05, 2015 Braun tntertec Corporation <br/>1341 South 20th Street, Suite 5 Bismarck, ND 58504 </p>
</div>
<div style="position: absolute; margin-left: 329px; margin-top: 851px;">
<p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 329px; margin-top: 1209px;">
<p class="styleSans5.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Re: </p>
</div>
<div style="position: absolute; margin-left: 301px; margin-top: 1346px;">
<p class="styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Documents Sent <br/>Proctor Tests PTRW15—000315-S1 (P-01) Soil Cement Stabilization <br/>Copy List <br/>Kyle Keighley, Hess Bakken Investments ll, LLC Rachelle Trieioff, Hess Bakken Investments II, LLC Josh Dilloway, Hess Bakken Investments II, LLC Kylie Melgaard, Hess Corporation <br/>Bedo Juarez, KS Industries, LLC </p>
</div>
<div style="position: absolute; margin-left: 1923px; margin-top: 1814px;">
<img src="images/tmpIPEzYB.png" alt="tmpIPEzYB.png" />
</div>
<div style="position: absolute; margin-left: 2501px; margin-top: 2529px;">
<p class="styleSans19.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 301px; margin-top: 2694px;">
<p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Contact Information: Sent By: Maureen Orthmeyer <br/>Email: [email protected] Phone: (701) 355-5401 <br/> <br/>Rev: 05/05/2014 </p>
</div>
<div style="position: absolute; margin-left: 2144px; margin-top: 0px;">
<p class="styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 2414px; margin-top: 0px;">
<p class="styleSans21.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>"></p>
</div>
<div style="position: absolute; margin-left: 549px; margin-top: 851px;">
<p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Russell Gifford <br/>Hess Bakken investments ll, LLC AP Bakken <br/>3015 16th St SW Suite 20 <br/>Minot, ND 58701 </p>
</div>
<div style="position: absolute; margin-left: 494px; margin-top: 1209px;">
<p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Hess, ND </p>
</div>
<div style="position: absolute; margin-left: 1428px; margin-top: 2996px;">
<p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Providing engineering and environmental solutions since 1957 </p>
</div>
<div style="position: absolute; margin-left: 1539px; margin-top: 851px;">
<p class="styleSans7.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Phone: Email: </p>
</div>
<div style="position: absolute; margin-left: 1701px; margin-top: 878px;">
<p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">701.664.3381 [email protected] </p>
</div>
</body>
</html>
| datamade/elpc_bakken | ocr_extracted/W28584_text/page48.html | HTML | mit | 4,660 |
body {
background-repeat: no-repeat;
}
.VideoBack {
position: fixed;
min-width: 100%;
min-height: 100%;
left: 50%;
top: 50%;
width: 100%;
height: 100%;
z-index: -100;
-ms-transform: translateX(-50%) translateY(-50%);
-moz-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
margin-left: -10px;
}
/*Main Body CSS*/
.MainDiv {
margin-top: 50px;
float: left;
width: 100%;
height: 700px;
}
.MainDiv .MainIntro {
text-align: center;
height: 150px;
float: left;
width: 100%;
margin-top: 20px;
}
.MainDiv .MainTable {
float: left;
width: 100%;
}
.MainDiv .MainTable table {
float: left;
width: 100%;
height: 600px;
}
.MainTable td {
float: left;
width: 1100px;
left: 50%;
margin-left: -540px;
margin-top: 50px;
position: relative;
}
/*MainDiv Frills*/
.MainIntro hr {
padding: 0;
border: none;
border-top: solid 5px;
text-align: center;
max-width: 320px;
margin: 22px auto 30px;
border-color: black;
}
.MainIntro .name {
margin-top: 25px;
display: block;
font-family: "Montserrat";
text-transform: uppercase;
font-weight: 700;
font-size: 40px;
text-shadow: 1px 1px 1px;
}
.MainIntro p {
margin-top: -10px;
font-size: 17px;
font-family: "Montserrat";
font-weight: 700;
}
/*Navigation Elements CSS*/
#CFirst, #CSecond, #CThird {
margin: 6% 5%;
text-align: center;
float: left;
width: 250px;
height: 250px;
border-radius: 10px;
background: none;
transition: 0.5s;
background-color: #130f0f;
box-shadow: 1px 1px 1px;
}
@media (max-width: 1102px) {
.MainTable td {
float: left;
width: 350px;
left: 50%;
margin-left: -175px;
position: relative;
margin-top: 2%;
margin-bottom: 2%;
}
#CFirst, #CSecond, #CThird {
height: 312px;
width: 312px;
}
footer {
margin-top: 100%;
bottom: 0;
}
}
#CFirst img, #CSecond img, #CThird img {
width: 100%;
height: 250px margin 0;
padding: 0;
max-width: 100%;
}
#CFirst a, #CSecond a, #CThird a {
display: block;
position: relative;
max-width: 400px;
margin: 0 auto;
}
.caption {
border-radius: 10px;
background-color: #2c3e50;
position: absolute;
width: 100%;
height: 100%;
opacity: 0;
transition: all ease 0.5s;
}
.caption:hover {
opacity: 1;
}
.caption .caption-content {
font-family: "Courier New", "Georgia";
font-weight: 700;
font-size: 30px;
text-shadow: 1px 1px 1px;
position: absolute;
width: 100%;
height: 20px;
top: 50%;
margin-top: -30px;
color: white;
}
| Aabhash/WTProject | CSS/HomePage.css | CSS | mit | 3,006 |
# deferred详解
> deferred对象与callbacks密不可分,而callbacks也是从deferred中分离出去的
# api以及使用
首先从deferred公共的接口来看:
* jQuery.Deferred:一个构造函数,返回一个链式实用对象方法来注册多个回调,回调队列,调用回调队列,并转达任何同步或异步函数的成功或失败状态。
* deferred.always():当Deferred(延迟)对象解决或拒绝时,调用添加处理程序
* deferred.done():当Deferred(延时)对象解决时,调用添加处理程序
* deferred.fail():当Deferred(延时)对象拒绝时,调用添加处理程序
* *deferred.isRejected():1.7已禁用*
* *deferred.isResolved():1.7已禁用*
* deferred.notify():根据给定的args参数调用Deferred(延迟)对象上进行中的回调
* deferred.notifyWith():根据给定的上下文(context)和args递延调用Deferred(延迟)对象上进行中的回调(progressCallbacks)
* *deferred.pipe():1.8开始,使用then()代替它*
* deferred.progress():当Deferred对象生成进度通知时,调用添加处理程序
* deferred.reject():拒绝Deferred对象,并根据给定的args参数调用任何失败回调函数
* deferred.rejectWith():拒绝Deferred对象,并根据给定的context和args参数调用任何失败回调函数
* deferred.resolve():解决Deferred对象,并根据给定的args参数调用任何完成回调函数
* deferred.resolveWith():解决Deferred对象,并根据给定的context和args参数调用任何完成回调函数
* deferred.state():确定一个Deferred对象的当前状态
* deferred.then():当Deferred对象解决,拒绝或仍在进行中时,调用添加处理程序
* deferred.catch():当回调中出现错误时,会跳到此处
* jQuery.when():提供一种方法来执行一个或多个对象的回调函数,Deferred对象通畅表示异步事件。
* .promise():返回一个Promise对象用来观察当某种类型的所有行动绑定到集合,排队与否还是已经完成
举例子:
```
function Defer(){
var defer = $.Deferred();
setTimeout(function(){
var num = Math.ceil(Math.random()*10);
if(num<=5){
defer.resolve(num)
}else{
defer.reject('数字大于5');
}
},1000);
return defer;
}
Defer().then(function(value){
console.log("输出"+value);
},function(value){
console.error(value);
})
```
将resolve当成ajax的success,将reject当成ajax的error,那么我们就可以发现,如果有一个延时操作,则通过then的处理,我们可以顺序的执行*success*或*error*,参数刚好是Defer()中使用**resolve**和**reject**来传递的。
稍微改一下
```
Defer().done(function(){
console.log("输出"+value);
}).fail(function(){
console.error(value);
})
```
可以发现,与上面其实是一样的,而使用notify则是:
```
function Defer(){
var defer = $.Deferred();
var num = Math.ceil(Math.random()*10);
defer.notify(defer.state());
setTimeout(function(){
if(num<=5){
defer.resolve(num)
}else{
defer.reject('数字大于5');
}
},1000);
return defer;
}
Defer().progress(function(state){
console.debug(state);
}).done(function(value){
console.debug(value);
}).fail(function(value){
console.error(value);
}).done(function(value){
console.debug(value);
});
```
也因此,在看到源码时

就可以知道,tuples创建了三个**$.Callbacks**对象,分别表示处理中,成功,失败。
| leomYili/my-learning-notes | jqueryAnalysis/deferred/deferred.md | Markdown | mit | 3,494 |
#!/bin/sh
#
# nanono - Nano notifications for Linux.
#
# https://github.com/macie/nanono
#
# Copyright (c) 2014-2019 Maciej Żok
# MIT License (http://opensource.org/licenses/MIT)
#
# DEFAULTS
#
readonly _nanono_ver='0.3.1'
#
# MESSAGES
#
help_message() {
#
# Shows help message.
#
# Returns:
# String message to standard output.
#
echo 'nanono - Nano notifications for Linux.'
echo 'Usage:'
echo ' nanono.sh [options]'
echo
echo 'Options:'
echo ' -h, --help Show this help and exit.'
echo ' -V, --version Show version number and exit.'
echo ' -b, --battery Show battery capacity (in %).'
echo ' --battery-time Show time to battery discharge.'
echo ' -d, --disk-free <dir> Show free space on disk partiotion (in %).'
echo ' -p, --packages Show number of updated packages.'
}
version_message() {
#
# Shows version message.
#
# Returns:
# String message to standard output.
#
echo "nanono ${_nanono_ver}"
echo
echo 'Copyright (c) 2014-2019 Maciej Żok'
echo 'MIT License (http://opensource.org/licenses/MIT)'
}
default_message() {
#
# Shows default message.
#
# Returns:
# String message to standard output.
#
get_battery
battery=$?
printf " -> battery has %s%% capacity\n" ${battery}
get_disk_free "/"
disk_free_space=$?
printf " -> root partition has %s%% free space\n" ${disk_free_space}
get_disk_free "/home"
disk_free_space=$?
printf " -> home partition has %s%% free space\n" ${disk_free_space}
get_packages
packages=$?
printf " -> %s packages need to be updated\n" ${packages}
}
#
# FUNCTIONS
#
get_battery() {
#
# Get battery capacity (in percents).
#
# Returns:
# An integer with battery capacity (in percents).
#
bat_capacity="$(cat /sys/class/power_supply/BAT0/capacity)"
return "${bat_capacity}"
}
get_battery_time() {
#
# Get time to discharge battery.
#
# Returns:
# String message to standard output with time to discharge
# in format "h:mm" or return 1 if fully charged.
#
bat_power="$(cat /sys/class/power_supply/BAT0/power_now)" # in uW
bat_energy="$(cat /sys/class/power_supply/BAT0/energy_now)" # in uWh
if [ "${bat_power}" -eq 0 ]; then
return 1
else
hours=$(( bat_energy / bat_power ))
minutes=$(( (bat_energy - hours * bat_power) * 60 / bat_power ))
printf "%01d:%02d\n" ${hours} ${minutes}
fi
}
get_disk_free() {
#
# Get disk partition free space (in percents).
#
# Arguments:
# dir (str) - Directory on partition to check.
#
# Returns:
# An integer with disk partition free space (in percents).
#
dir_name="$*"
disk_usage=$( df "${dir_name}" | awk 'FNR == 2 { gsub("%", ""); print $5 }' )
return $(( 100 - disk_usage ))
}
get_packages() {
#
# Get number of updated packages.
#
# Returns:
# An integer with number of updated packages.
#
packages=$( checkupdates | wc -l )
return "${packages}"
}
parse_args() {
#
# Parses script parameters.
#
# Arguments:
# params (str) - Script params.
#
# Returns:
# String message or nothing.
#
arg_num=$#
if [ ${arg_num} -eq 0 ]; then
default_message
exit 0
else
for arg in "$@"; do
case "${arg}" in
-h|--help)
help_message
exit 0
;;
-V|--version)
version_message
exit 0
;;
-b|--battery)
get_battery
echo "$?"
exit 0
;;
--battery-time)
get_battery_time
exit 0
;;
-d|--disk-usage)
if [ "${arg_num}" -gt 1 ]; then
get_disk_free "$2"
echo "$?"
exit 0
else
echo "nanono: no directory specified" 1>&2
echo "Try '-h' or '--help' for more information." 1>&2
exit 64 # command line usage error (via /usr/include/sysexits.h)
fi
;;
-p|--packages)
get_packages
echo "$?"
exit 0
;;
-*)
echo "nanono: invalid option '$1'" 1>&2
echo "Try '-h' or '--help' for more information." 1>&2
exit 64 # command line usage error (via /usr/include/sysexits.h)
;;
esac
arg_num=$(( arg_num - 1 ))
done
fi
}
#
# MAIN ROUTINE
#
main () {
parse_args "$@"
exit 0
}
main "$@"
| macie/nanono | nanono.sh | Shell | mit | 4,469 |
---
layout: post
title: "DNCs 结构梳理"
category: notes
author: "孟文霞"
---
## 1. DNC结构
* 两大部分:Controller(neural network)、Memory(M × N Matrix)
* 三个 Mechanisms:Content lookup、 Temporal links 和 Allocation
* 一个 Temporal matrix:L(N × N)
* 一个 Temporal link:Usage
* 读相关的控制向量:Read weighting(W<sup>r</sup>)
* 写相关的控制向量:Write weighting(W<sup>w</sup>)、Erase vector(e)、write vector(v)
Mechanisms 的实现对应的 Vector 和 Matrix 如下图:

## 2. DNC 与传统计算机

### 2.1 Controller 与 CPU 区别:
* Controller 通过 gradient descent 进行学习
* Controller 是一个 neural network.
### 2.2 Memory 的特点:
* Memory can be selectively written to as well as read
* Memory allowing iterative modification of memory content.
### 2.3 Address:
* Conventional computers:unique addresses to access memory contents.
* DNC:有不同的方式来访问 matrix M 。
#### 2.3.1 DNC Address 设置
weightings:表示每一个 location 被读或者写的程度。
##### 2.3.1.1 Read heads:
* Read weighting:W<sup>r</sup>
##### 2.3.1.2 Write heads:
* Write weighting:W<sup>w</sup>
* Erase vector:e
* write vector:v
### 2.4 DNC 与 Neural Turing Machine
有着相似的结构,但是 Neural Turing Machine 在 memory access methods 方面表现不如 DNC。
## 3. Heads 和 Memory 交互的三种机制
### 3.1 Content lookup
通过比较 controller 发出的 vector 和每个 location content 的 cos 值,来决定对内存中内容的读和写的权限。(当这个匹配值较小时仍然可以进行一定程度的读写操作)
### 3.2 Temporal links
通过一个 N × N temporal link matrix L 来实现。
#### L[i,j] 值的确定:
L[i,j] is close to 1 if i was the next location written after j, and is close to 0 otherwise. .
#### 3.2.1 Temporal links 实现的功能:
* Forward: Lw
* Backwards:L<sup>⊤</sup>w
能够通过找到哪一个向量对 Memory 进行写操作,来进行数据的 Forward 和 Backwards 操作,来实现对数据操作过程的记录和再现。
### 3.3 Allocation
each location 有一个 ‘usage’的值,这个值在0-1之间,这个数字会在 location 的内容被使用时降低,不使用的时候自动增加。这样就能帮助 DNC 找到不常用或者当前没有被使用的地址来使用。
## 4. 我的想法
* Controller 用一个 neural network 难以实现传统操作系统中程序的 调度(多个CPU或核)/切换(一个CPU给多个程序使用)功能,是不是可以把 Controller 扩充为多个 neutral network.
* 多个进程/线程共同执行时,怎么解决进程之间内存隔离的问题,地址直接的权限关系怎么设置。
* 多个进程/线程共同执行时,怎么实现进程之间的通讯问题。
| mengwx/mengwx.github.io | _posts/2017-4-20.md | Markdown | mit | 2,909 |
//
// AppDelegate.h
// ZJ父子控制器(简介)
//
// Created by base on 15/09/19.
// Copyright © 2015年 base. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| base0225/FatherController | ZJ父子控制器(简介)/AppDelegate.h | C | mit | 290 |
Uploader = {
UI: {
bootstrap: {
upload: 'btn btn-primary btn-file upload-control',
progressOuter: 'form-control upload-control',
progressInner: 'progressInner',
progressBar: 'progress-bar progress-bar-success progress-bar-striped',
removeButton: 'btn btn-default upload-control remove',
removeButtonIcon: 'glyphicon glyphicon-remove',
startButton: 'btn btn-info upload-control start',
startButtonIcon: 'glyphicon glyphicon-upload',
doneButton: 'btn btn-default upload-control done',
doneButtonIcon: 'glyphicon glyphicon-ok',
cancelButton: 'btn btn-danger upload-control cancel',
cancelButtonIcon: 'glyphicon glyphicon-stop',
cancelledButton: 'btn btn-warning upload-control',
cancelledButtonIcon: 'glyphicon glyphicon-cross'
},
semanticUI: {
upload: 'ui icon button btn-file leftButton upload-control',
progressOuter: 'progressOuter',
progressInner: 'semantic progressInner',
progressBar: 'bar progress-bar',
removeButton: 'ui red button upload-control remove rightButton',
removeButtonIcon: 'trash icon',
startButton: 'ui button primary upload-control start rightButton',
startButtonIcon: 'upload icon',
doneButton: 'ui green button upload-control rightButton done',
doneButtonIcon: 'icon thumbs up',
cancelButton: 'ui yellow button upload-control cancel rightButton',
cancelButtonIcon: 'icon stop',
cancelledButton: 'ui yellow button upload-control rightButton'
}
},
uploadUrl: '/upload',
createName: function (templateContext) {
if (templateContext.queue.length == 1) {
var file = templateContext.queue[0];
templateContext.info.set(file);
} else {
// calculate size
var file = {
name: templateContext.queue.length + ' files',
size: templateContext.queue.size
}
templateContext.info.set(file);
}
},
/**
* Starts upload
* @param e
* @param {string} name Name of the file in the queue that we want to upload
*/
startUpload: function (e, name) {
if (e) e.preventDefault();
if (this.queue.length == 0) return;
var that = this;
$.each(this.queue, function (index, queueItem) {
var data = queueItem.data;
if (name && data.files[0].name !== name) return true;
data.jqXHR = data.submit()
.done(function (data, textStatus, jqXHR) {
// remove from queue
that.queue.splice(that.queue.indexOf(queueItem), 1);
console.log('data.sumbit.done: textStatus= ' + textStatus);
if (Uploader.status) {
Uploader.status(false, data, textStatus, jqXHR);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
// remove from queue
that.queue.splice(that.queue.indexOf(queueItem), 1);
if (jqXHR.statusText === 'abort') {
that.info.set({
name: 'Aborted',
size: 0
})
} else {
that.info.set({
name: 'Failed: ' + jqXHR.responseText + ' ' + jqXHR.status + ' ' + jqXHR.statusText,
size: 0
})
}
if (Uploader.status) {
Uploader.status(true, data, textStatus, jqXHR);
}
console.log('data.sumbit.fail: ' + jqXHR.responseText + ' ' + jqXHR.status + ' ' + jqXHR.statusText);
})
.always(function (data, textStatus, jqXHR) {
console.log('data.sumbit.always: textStatus= ' + textStatus);
});
});
},
formatProgress: function (file, progress, bitrate) {
return progress + "% of " + file + " <span style='font-size:smaller'>@ " + bytesToSize(bitrate) + " / sec</span>"
},
removeFromQueue: function (e, name) {
e.preventDefault();
// remove from data queue
var that = this;
$.each(this.queue, function (index, item) {
// skip all with different name
if (item.name === name) {
that.queue.splice(index, 1);
return false;
}
});
// set the queueView
this.queueView.set(this.queue);
// update name
Uploader.createName(this);
},
reset: function(e) {
e.preventDefault();
this.globalInfo.set({running: false, cancelled: false, progress: 0, bitrate: 0});
this.info.set("");
},
cancelUpload: function (e, name) {
e.preventDefault();
var that = this;
$.each(this.queue, function (index, queueItem) {
// skip all with different name
if (name && queueItem.name !== name) return true;
// cancel upload of non completed files
if (that.queue[queueItem.name].get().progress !== 100) {
queueItem.data.jqXHR.abort();
// set status to redraw interface
that.queue[queueItem.name].set({running: false, cancelled: true, progress: 0, bitrate: 0});
}
});
// mark global as cancelled
if (!name) {
this.globalInfo.set({running: false, cancelled: true, progress: 0, bitrate: 0})
}
},
init: function (data) {
// this is used to view the queue in the interface
data.queueView = new ReactiveVar([]);
// this holds all the data about the queue
data.queue = [];
// info about the global item being processed
data.info = new ReactiveVar;
// info about global progress
data.globalInfo = new ReactiveVar({running: false, progress: 0, bitrate: 0});
},
render: function () {
// template context is the template instance itself
var templateContext = this;
templateContext.progressBar = this.$('.progress-bar');
templateContext.progressLabel = this.$('.progress-label');
templateContext.uploadControl = this.$('.jqUploadclass');
templateContext.dropZone = this.$('.jqDropZone');
// this.data holds the template context (arguments supplied to the template in HTML)
var dataContext = this.data;
// attach the context to the form object (so that we can access it in the callbacks such as add() etc.)
this.find('form').uploadContext = templateContext;
// set the upload related callbacks for HTML node that has jqUploadclass specified for it
// Example html node: <input type="file" class="jqUploadclass" />
templateContext.uploadControl.fileupload({
url: Uploader.uploadUrl,
dataType: 'json',
dropZone: templateContext.dropZone,
add: function (e, data) {
console.log('render.add ');
// validate before adding
if (dataContext.callbacks != null &&
dataContext.callbacks.validate != null &&
!dataContext.callbacks.validate(data.files)) {
return;
}
// adding file will clear the queue
if (!templateContext.data.multiple) {
templateContext.queue = [];
templateContext.queueView.set([]);
}
// update the queue collection, so that the ui gets updated
$.each(data.files, function (index, file) {
var item = file;
item.data = data;
templateContext.queue[file.name] = new ReactiveVar({running: false, progress: 0});
templateContext.queue.push(item);
templateContext.queue.size += parseInt(file.size);
});
// say name
Uploader.createName(templateContext);
// set template context
templateContext.queueView.set(templateContext.queue);
// we can automatically start the upload
if (templateContext.autoStart) {
Uploader.startUpload.call(templateContext);
}
}, // end of add callback handler
done: function (e, data) {
console.log('render.done ');
templateContext.globalInfo.set({running: false, progress: 100});
$.each(data.result.files, function (index, file) {
Uploader.finished(index, file, templateContext);
// notify user
if (dataContext.callbacks != null &&
dataContext.callbacks.finished != null) {
dataContext.callbacks.finished(index, file, templateContext);
}
});
},
fail: function (e, data) {
console.log('render.fail ');
},
progress: function (e, data) {
// file progress is displayed only when single file is uploaded
var fi = templateContext.queue[data.files[0].name];
if (fi) {
fi.set({
running: true,
progress: parseInt(data.loaded / data.total * 100, 10),
bitrate: data.bitrate
});
}
},
progressall: function (e, data) {
templateContext.globalInfo.set({
running: true,
progress: parseInt(data.loaded / data.total * 100, 10),
bitrate: data.bitrate
});
},
drop: function (e, data) { // called when files are dropped onto ui
$.each(data.files, function (index, file) {
console.log("render.drop file: " + file.name);
});
},
change: function (e, data) { // called when input selection changes (file selected)
// clear the queue, this is used to visualise all the data
templateContext.queue = [];
templateContext.queue.size = 0;
templateContext.progressBar.css('width', '0%');
templateContext.globalInfo.set({running: false, progress: 0});
$.each(data.files, function (index, file) {
console.log('render.change file: ' + file.name);
});
}
})
.prop('disabled', ($.support != null && $.support.fileInput != null) ? !$.support.fileInput : false)
.parent().addClass(($.support != null && $.support.fileInput != null && !$.support.fileInput) ? 'disabled' : undefined);
},
finished: function () {
}
}
bytesToSize = function (bytes) {
if (bytes == 0) return '0 Byte';
var k = 1000;
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
var i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
}
| tagorecaue/slingshot-jquery | uploader.js | JavaScript | mit | 10,060 |
Compute `x/y` using addition, subtraction and shift operators.
| mmcloughlin/interviews | elements/5/6/README.md | Markdown | mit | 63 |
// Custom Rally App that displays Stories in a grid
//
// Note: various console debugging messages intentionally kept in the code for learning purposes.
Ext.define('CustomApp', {
extend: 'Rally.app.App', // The parent class manages the app 'lifecycle' and calls launch () when ready.
componentCls: 'app', // CSS styles found in app.css
// items:{ html:'<a href="https://help.rallydev.com/apps/2.0rc3/doc/">App SDK 2.0rc3 Docs</a>'},
launch: function() {
console.log("Our first App !!"); // see console api: https://developers.google.com/chrome-developer-tools/docs/console-api
this._loadData(); // we need to prefix with 'this.' so we call a method found at the app level.
},
//Get data from Rally
_loadData: function(){
var myStore = Ext.create('Rally.data.wsapi.Store', {
model: 'User Story',
autoLoad: true,
listeners: {
load: function(myStore, myData, success) {
console.log('got data!',myStore, myData);
this._loadGrid(myStore); //if we did NOT pass scope:this below, this line would be incorrectly trying to call _createGrid() on the store which does not exist.
},
scope: this // This tells the wsapi data store to forward pass along the app-level context into ALL listener functions
},
fetch: ['FormattedID','Name', 'ScheduleState', 'Owner'] // Look in the WSAPI docs online to see all fields available!
}); // End of myStore definition
}, // End of _loadData function
//Create and Show a Grid of given stories
_loadGrid: function(myStoryStore){
var myGrid = Ext.create('Rally.ui.grid.Grid', {
store: myStoryStore,
columnCfgs: ['FormattedID','Name','Owner','ScheduleState'] // Columns to display; must be the same names specified in the fetch: above in the wsapi data store
});
this.add(myGrid); // add the grid Component to the app-level Container (by doing this.add, it uses the app container
console.log('what is this: ',this);
}
});
| giousf/BasicRallyGrid | App.js | JavaScript | mit | 2,356 |
version https://git-lfs.github.com/spec/v1
oid sha256:371b5bed4a9144ecb164945c73ef490f03b9b81bcd0ecb8381442e194f0e9d7b
size 625
| yogeshsaroya/new-cdnjs | ajax/libs/select2/3.4.0/select2_locale_eu.min.js | JavaScript | mit | 128 |
/*
* Copyright (C) 2013 Vanderbilt University, All rights reserved.
*
* Authors:
*/
.SysML-decorator {
text-align: center; }
.SysML-decorator text.port-name {
fill: #000;
font-size: 11px; }
.SysML-decorator text.port-name.right {
text-anchor: end; }
.SysML-decorator .name {
display: block;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 22px;
width: 150px; }
.SysML-decorator .connector {
background-color: #fefefe;
height: 10px;
width: 10px;
position: absolute;
cursor: pointer;
border: 1px solid blue;
z-index: 10;
border-radius: 0px;
left: 50%; }
.SysML-decorator .connector:hover {
border-color: rgba(82, 168, 236, 0.8);
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); }
.SysML-decorator .connector.top {
top: -6px; }
.SysML-decorator .connector.bottom {
bottom: -6px; }
.SysML-decorator .connector-container {
position: absolute;
top: 0px;
left: 0px;
transform-origin: 0 0;
-webkit-transform-origin: 0 0;
-moz-transform-origin: 0 0; }
.designer-item.selected .SysML-decorator {
background-color: rgba(219, 234, 252, 0.5); }
| webgme/webgme-sysml | src/decorators/SysMLDecorator/DiagramDesigner/SysMLDecorator.DiagramDesignerWidget.css | CSS | mit | 1,460 |
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import Moment from 'moment';
import Interval from 'eui-calendar/tests/page-objects/interval';
import { HTML5_DATETIME_FORMAT } from 'eui-calendar/constants';
moduleForComponent('eui-interval', 'Integration | Component | eui interval', {
integration: true,
beforeEach() {
let moment = Moment('January 21, 2014').utc();
this.set('moment', moment);
this.set('datetime', moment.format(HTML5_DATETIME_FORMAT));
this.component = new Interval(this);
}
});
test('renders days with moment and interval as positional arguments', function(assert) {
this.render(hbs`{{eui-interval moment 'day'}}`);
assert.equal(this.component.value(), '21', 'renders content');
assert.equal(this.component.datetime(), this.get('datetime'), 'has data-datetime attribute');
});
test('renders moment with block param', function(assert) {
this.render(hbs`
{{#eui-interval moment}}
{{moment-format moment 'dddd'}}
{{/eui-interval}}
`);
assert.equal(this.component.value(), 'Tuesday', 'renders content');
});
test('renders months', function(assert) {
this.render(hbs`
{{eui-interval moment 'month'}}
`);
assert.equal(this.component.value(), 'January', 'renders content');
assert.equal(this.component.datetime(), this.get('datetime'), 'has data-datetime attribute');
});
test('renders year', function(assert) {
this.render(hbs`{{eui-interval moment 'year'}}`);
assert.equal(this.component.value(), '2014', 'renders content');
assert.equal(this.component.datetime(), this.get('datetime'), 'has data-datetime attribute');
});
test('is-selected class', function(assert) {
assert.expect(4);
this.on('onSelect', (moment) => {
this.set('selection', moment);
});
this.render(hbs`
{{eui-interval moment 'day'
selection=selection
on-select=(action 'onSelect')
}}
`);
assert.ok(!this.component.isSelected(), 'is not selected no selection has been defined');
this.set('selection', this.get('moment'));
assert.ok(this.component.isSelected(), 'is selected when selection is defined');
this.set('selection', null);
assert.ok(!this.component.isSelected(), 'is not selected before click');
this.component.selectMoment();
assert.ok(this.component.isSelected(), 'is selected on click');
});
test('is-now class', function(assert) {
assert.expect(4);
this.render(hbs`
{{eui-interval moment 'day'}}
`);
assert.ok(!this.component.isNow(), 'a date in the past is not now');
this.set('moment', Moment());
assert.ok(this.component.isNow(), 'has is-now class when moment is now');
this.render(hbs`{{eui-interval moment 'day' now=now}}`);
this.set('now', Moment().subtract(1, 'day'));
assert.ok(!this.component.isNow(), 'does not have is-now class when now property is not now');
this.set('now', Moment());
assert.ok(this.component.isNow(), 'has is-now class when now property is now');
});
| LocusEnergy/eui-calendar | tests/integration/eui-interval-test.js | JavaScript | mit | 2,992 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_14) on Sun Mar 23 21:20:48 GMT 2008 -->
<TITLE>
D-Index
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="D-Index";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index-3.html"><B>PREV LETTER</B></A>
<A HREF="index-5.html"><B>NEXT LETTER</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?index-filesindex-4.html" target="_top"><B>FRAMES</B></A>
<A HREF="index-4.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<A HREF="index-1.html">A</A> <A HREF="index-2.html">B</A> <A HREF="index-3.html">C</A> <A HREF="index-4.html">D</A> <A HREF="index-5.html">E</A> <A HREF="index-6.html">F</A> <A HREF="index-7.html">G</A> <A HREF="index-8.html">H</A> <A HREF="index-9.html">I</A> <A HREF="index-10.html">J</A> <A HREF="index-11.html">L</A> <A HREF="index-12.html">M</A> <A HREF="index-13.html">N</A> <A HREF="index-14.html">O</A> <A HREF="index-15.html">P</A> <A HREF="index-16.html">R</A> <A HREF="index-17.html">S</A> <A HREF="index-18.html">T</A> <A HREF="index-19.html">V</A> <A HREF="index-20.html">W</A> <A HREF="index-21.html">_</A> <HR>
<A NAME="_D_"><!-- --></A><H2>
<B>D</B></H2>
<DL>
<DT><A HREF="../net/parallaxed/bluejam/NoteTree.html#depth()"><B>depth()</B></A> -
Method in class net.parallaxed.bluejam.<A HREF="../net/parallaxed/bluejam/NoteTree.html" title="class in net.parallaxed.bluejam">NoteTree</A>
<DD>
<DT><A HREF="../net/parallaxed/bluejam/tests/TreeTest.html#DtestAdd2()"><B>DtestAdd2()</B></A> -
Method in class net.parallaxed.bluejam.tests.<A HREF="../net/parallaxed/bluejam/tests/TreeTest.html" title="class in net.parallaxed.bluejam.tests">TreeTest</A>
<DD><B>Deprecated.</B> <I></I>
<DT><A HREF="../net/parallaxed/bluejam/Note.html#duration"><B>duration</B></A> -
Variable in class net.parallaxed.bluejam.<A HREF="../net/parallaxed/bluejam/Note.html" title="class in net.parallaxed.bluejam">Note</A>
<DD>Duration of this note in milliseconds.
<DT><A HREF="../net/parallaxed/bluejam/Note.html#duration(double)"><B>duration(double)</B></A> -
Method in class net.parallaxed.bluejam.<A HREF="../net/parallaxed/bluejam/Note.html" title="class in net.parallaxed.bluejam">Note</A>
<DD>Sets the duration of the note.
<DT><A HREF="../net/parallaxed/bluejam/Note.html#duration()"><B>duration()</B></A> -
Method in class net.parallaxed.bluejam.<A HREF="../net/parallaxed/bluejam/Note.html" title="class in net.parallaxed.bluejam">Note</A>
<DD>Retrieves the duration of the note.
</DL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="index-3.html"><B>PREV LETTER</B></A>
<A HREF="index-5.html"><B>NEXT LETTER</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../index.html?index-filesindex-4.html" target="_top"><B>FRAMES</B></A>
<A HREF="index-4.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<A HREF="index-1.html">A</A> <A HREF="index-2.html">B</A> <A HREF="index-3.html">C</A> <A HREF="index-4.html">D</A> <A HREF="index-5.html">E</A> <A HREF="index-6.html">F</A> <A HREF="index-7.html">G</A> <A HREF="index-8.html">H</A> <A HREF="index-9.html">I</A> <A HREF="index-10.html">J</A> <A HREF="index-11.html">L</A> <A HREF="index-12.html">M</A> <A HREF="index-13.html">N</A> <A HREF="index-14.html">O</A> <A HREF="index-15.html">P</A> <A HREF="index-16.html">R</A> <A HREF="index-17.html">S</A> <A HREF="index-18.html">T</A> <A HREF="index-19.html">V</A> <A HREF="index-20.html">W</A> <A HREF="index-21.html">_</A> <HR>
</BODY>
</HTML>
| braider/bluejam | bluejam/doc/index-files/index-4.html | HTML | mit | 7,831 |
<form method="POST" class="form-horizontal well span9" id="modify-form">
<fieldset>
<legend>Modify Range</legend>
<div class="control-group">
<label class="control-label">Name: </label>
<div class="controls">
<input type="text" name="name" value="<?=$r->get_name();?>" />
</div>
</div>
<div class="control-group">
<label class="control-label">First IP: </label>
<div class="controls">
<input type="text" name="firstip" value="<?=$r->get_first_ip();?>"/>
</div>
</div>
<div class="control-group">
<label class="control-label">Last IP: </label>
<div class="controls">
<input type="text" name="lastip" value="<?=$r->get_last_ip();?>" />
</div>
</div>
<div class="control-group">
<label class="control-label">Use: </label>
<div class="controls">
<select name="use">
<?php
foreach($uses as $use) {
if($use == $r->get_use()) {
print "<option selected>".htmlentities($use)."</option>";
}
else {
print "<option>".htmlentities($use)."</option>";
}
}
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">DHCP Class: </label>
<div class="controls">
<select name="class">
<option></option>
<?php
foreach($classes as $c) {
if($r->get_class() == $c->get_class()) {
print "<option selected>".htmlentities($c->get_class())."</option>";
}
else {
print "<option>".htmlentities($c->get_class())."</option>";
}
}
?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Availability Zone: </label>
<div class="controls">
<select name="zone">
<?php
foreach($azs as $az) {
if($az->get_zone() == $r->get_zone()) {
print "<option selected>".htmlentities($az->get_zone())."</option>";
}
else {
print "<option>".htmlentities($az->get_zone())."</option>";
}
}
?>
</select>
</div>
</div>
<div class="control-group warning">
<label class="control-label">Comment: </label>
<div class="controls">
<input type="text" name="comment" value="<?=$r->get_comment();?>" />
</div>
</div>
<div class="control-group">
<div class="form-actions">
<input type="submit" name="submit" value="Save" class="btn btn-primary" />
<a href="/ip/range/view/<?=rawurlencode($r->get_name());?>" class="btn">Cancel</a>
</div>
</div>
<input type="hidden" name="datacenter" value="<?=$r->get_datacenter();?>" />
</fieldset>
</form>
| cohoe/starrs-web | application/views/ip/range/modify.php | PHP | mit | 2,655 |
//! Read points from an .sdc file.
use std::fs::File;
use std::iter::IntoIterator;
use std::io::{BufReader, Read};
use std::path::Path;
use std::str;
use byteorder;
use byteorder::{LittleEndian, ReadBytesExt};
use error::Error;
use point::{Point, TargetType};
use result::Result;
/// An object for readings .sdc points.
///
/// We don't just read them all into memory right away since .sdc files can be quite big.
#[derive(Debug)]
pub struct Reader<R: Read> {
reader: R,
version: Version,
header_information: Vec<u8>,
}
/// The sdc file version.
#[derive(Clone, Copy, Debug)]
pub struct Version {
/// The sdc major version.
pub major: u16,
/// The sdc minor version.
pub minor: u16,
}
impl Reader<BufReader<File>> {
/// Creates a new reader for a path.
///
/// # Examples
///
/// ```
/// use sdc::reader::Reader;
/// let reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
/// ```
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Reader<BufReader<File>>> {
let reader = BufReader::new(try!(File::open(path)));
Reader::new(reader)
}
}
impl<R: Read> Reader<R> {
/// Creates a new reader, consuimg a `Read`.
///
/// # Examples
///
/// ```
/// use std::fs::File;
/// use sdc::reader::Reader;
/// let file = File::open("data/4-points-5.0.sdc").unwrap();
/// let reader = Reader::new(file);
/// ```
pub fn new(mut reader: R) -> Result<Reader<R>> {
let header_size = try!(reader.read_u32::<LittleEndian>());
let major = try!(reader.read_u16::<LittleEndian>());
if major != 5 {
return Err(Error::InvalidMajorVersion(major));
}
let minor = try!(reader.read_u16::<LittleEndian>());
let header_information_size = header_size - 8;
let mut header_information = Vec::with_capacity(header_information_size as usize);
if try!(reader.by_ref()
.take(header_information_size as u64)
.read_to_end(&mut header_information)) !=
header_information_size as usize {
return Err(Error::InvalidHeaderInformation);
}
Ok(Reader {
reader: reader,
version: Version { major: major, minor: minor, },
header_information: header_information,
})
}
/// Reads the next point from the underlying `Read`.
///
/// # Examples
///
/// ```
/// use sdc::reader::Reader;
/// let mut reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
/// let point = reader.next_point();
/// ```
pub fn next_point(&mut self) -> Result<Option<Point>> {
// Technically we should just check the first byte instead of the first four, but the work
// required to do that doesn't seem worth it at the moment.
let time = match self.reader.read_f64::<LittleEndian>() {
Ok(time) => time,
Err(byteorder::Error::UnexpectedEOF) => return Ok(None),
Err(err) => return Err(Error::from(err)),
};
let range = try!(self.reader.read_f32::<LittleEndian>());
let theta = try!(self.reader.read_f32::<LittleEndian>());
let x = try!(self.reader.read_f32::<LittleEndian>());
let y = try!(self.reader.read_f32::<LittleEndian>());
let z = try!(self.reader.read_f32::<LittleEndian>());
let amplitude = try!(self.reader.read_u16::<LittleEndian>());
let width = try!(self.reader.read_u16::<LittleEndian>());
let target_type = try!(TargetType::from_u8(try!(self.reader.read_u8())));
let target = try!(self.reader.read_u8());
let num_target = try!(self.reader.read_u8());
let rg_index = try!(self.reader.read_u16::<LittleEndian>());
let channel_desc_byte = try!(self.reader.read_u8());
let mut class_id = None;
let mut rho = None;
let mut reflectance = None;
if self.version.major >= 5 && self.version.minor >= 2 {
class_id = Some(try!(self.reader.read_u8()));
}
// These 5.3 and 5.4 reads are untested, since I don't have a real-world sample file yet.
if self.version.major >= 5 && self.version.minor >= 3 {
rho = Some(try!(self.reader.read_f32::<LittleEndian>()));
}
if self.version.major >= 5 && self.version.minor >= 4 {
reflectance = Some(try!(self.reader.read_i16::<LittleEndian>()));
}
Ok(Some(Point {
time: time,
range: range,
theta: theta,
x: x,
y: y,
z: z,
amplitude: amplitude,
width: width,
target_type: target_type,
target: target,
num_target: num_target,
rg_index: rg_index,
facet_number: channel_desc_byte & 0x3,
high_channel: (channel_desc_byte & 0b01000000) == 0b01000000,
class_id: class_id,
rho: rho,
reflectance: reflectance
}))
}
/// Returns this file's version as a `(u16, u16)`.
///
/// # Examples
///
/// ```
/// use sdc::reader::{Reader, Version};
/// let reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
/// let Version { major, minor } = reader.version();
/// ```
pub fn version(&self) -> Version {
self.version
}
/// Returns this file's header information, or an error if it is not valid ASCII.
///
/// # Examples
///
/// ```
/// use sdc::reader::Reader;
/// let reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
/// let header_information = reader.header_information_as_str();
/// ```
pub fn header_information_as_str(&self) -> Result<&str> {
str::from_utf8(&self.header_information[..]).map_err(|e| Error::from(e))
}
}
impl<R: Read> IntoIterator for Reader<R> {
type Item = Point;
type IntoIter = PointIterator<R>;
fn into_iter(self) -> Self::IntoIter {
PointIterator { reader: self }
}
}
/// An iterator over a reader's points.
#[derive(Debug)]
pub struct PointIterator<R: Read> {
reader: Reader<R>,
}
impl<R: Read> Iterator for PointIterator<R> {
type Item = Point;
fn next(&mut self) -> Option<Self::Item> {
self.reader.next_point().unwrap()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn read_points() {
let reader = Reader::from_path("data/4-points-5.0.sdc").unwrap();
let points: Vec<_> = reader.into_iter().collect();
assert_eq!(4, points.len());
}
#[test]
fn read_52() {
let reader = Reader::from_path("data/4-points-5.2.sdc").unwrap();
let points: Vec<_> = reader.into_iter().collect();
assert_eq!(4, points.len());
assert_eq!(4, points[0].class_id.unwrap());
}
}
| gadomski/sdc-rs | src/reader.rs | Rust | mit | 6,895 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("proposals", "0006_auto_20150416_1612"),
]
operations = [
migrations.AddField(
model_name="proposalcomment",
name="reviewer",
field=models.BooleanField(default=False, verbose_name="Is Reviewer?"),
preserve_default=True,
),
migrations.AlterField(
model_name="proposal",
name="target_audience",
field=models.PositiveSmallIntegerField(
default=1,
verbose_name="Target Audience",
choices=[(1, "Beginner"), (2, "Intermediate"), (3, "Advanced")],
),
preserve_default=True,
),
migrations.AlterField(
model_name="proposalvote",
name="role",
field=models.PositiveSmallIntegerField(
default=1, choices=[(1, "Public"), (2, "Reviewer")]
),
preserve_default=True,
),
]
| pythonindia/junction | junction/proposals/migrations/0007_auto_20150522_2358.py | Python | mit | 1,127 |
package miner
import (
"github.com/lisgie/bazo_miner/protocol"
"github.com/lisgie/bazo_miner/storage"
"math/rand"
"testing"
"time"
)
func TestPrepareAndSortTxs(t *testing.T) {
cleanAndPrepare()
testsize := 100
//fill the open storage with fundstx
rand := rand.New(rand.NewSource(time.Now().Unix()))
for cnt := 0; cnt < testsize; cnt++ {
accAHash := serializeHashContent(accA.Address)
accBHash := serializeHashContent(accB.Address)
tx, _ := protocol.ConstrFundsTx(0x01, rand.Uint64()%100+1, rand.Uint64()%100+1, uint32(cnt), accAHash, accBHash, &PrivKeyA)
tx2, _ := protocol.ConstrFundsTx(0x01, rand.Uint64()%100+1, rand.Uint64()%100+1, uint32(cnt), accBHash, accAHash, &PrivKeyB)
if verifyFundsTx(tx) {
storage.WriteOpenTx(tx)
}
if verifyFundsTx(tx2) {
storage.WriteOpenTx(tx2)
}
}
//Add other tx types as well to make the test more challenging
for cnt := 0; cnt < testsize; cnt++ {
tx,_,_ := protocol.ConstrAccTx(0x01, rand.Uint64()%100+1, &RootPrivKey)
if verifyAccTx(tx) {
storage.WriteOpenTx(tx)
}
}
for cnt := 0; cnt < testsize; cnt++ {
tx, _ := protocol.ConstrConfigTx(uint8(rand.Uint32()%256), uint8(rand.Uint32()%10+1), rand.Uint64()%2342873423, rand.Uint64()%1000+1,uint8(cnt), &RootPrivKey)
//Don't mess with the minimum fee and block size
if tx.Id == 3 || tx.Id == 1 {
continue
}
if verifyConfigTx(tx) {
storage.WriteOpenTx(tx)
}
}
b := newBlock([32]byte{})
prepareBlock(b)
finalizeBlock(b)
//We could also use sort.IsSorted(...) bool, but manual check makes sure our sort interface is correct
//this test ensures that all generated fundstx are included in the block, this is only possible if their
//txcnt is sorted ascendingly
if int(b.NrFundsTx) != testsize*2 {
t.Errorf("NrFundsTx (%v) vs. testsize*2 (%v)\n", b.NrFundsTx, testsize*2)
}
}
| lisgie/bazo_miner | miner/blockpreparation_test.go | GO | mit | 1,839 |
//
// JSONKit.h
// http://github.com/johnezang/JSONKit
// Dual licensed under either the terms of the BSD License, or alternatively
// under the terms of the Apache License, Version 2.0, as specified below.
//
/*
Copyright (c) 2011, John Engelhart
All rights reserved.
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.
* Neither the name of the Zang Industries nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
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
OWNER 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.
*/
/*
Copyright 2011 John Engelhart
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#include <TargetConditionals.h>
#include <AvailabilityMacros.h>
#ifdef __OBJC__
#import <Foundation/NSArray.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#endif // __OBJC__
#ifdef __cplusplus
extern "C" {
#endif
// For Mac OS X < 10.5.
#ifndef NSINTEGER_DEFINED
#define NSINTEGER_DEFINED
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef long NSInteger;
typedef unsigned long NSUInteger;
#define NSIntegerMin LONG_MIN
#define NSIntegerMax LONG_MAX
#define NSUIntegerMax ULONG_MAX
#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define NSIntegerMin INT_MIN
#define NSIntegerMax INT_MAX
#define NSUIntegerMax UINT_MAX
#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
#endif // NSINTEGER_DEFINED
#ifndef _JSONKIT_H_
#define _JSONKIT_H_
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#else
#define JK_DEPRECATED_ATTRIBUTE
#endif
#define JSONKIT_VERSION_MAJOR 1
#define JSONKIT_VERSION_MINOR 4
typedef NSUInteger JKFlags;
/*
JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
This option allows JSON with malformed Unicode to be parsed without reporting an error.
Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
*/
enum {
JKParseOptionNone = 0,
JKParseOptionStrict = 0,
JKParseOptionComments = (1 << 0),
JKParseOptionUnicodeNewlines = (1 << 1),
JKParseOptionLooseUnicode = (1 << 2),
JKParseOptionPermitTextAfterValidJSON = (1 << 3),
JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON),
};
typedef JKFlags JKParseOptionFlags;
enum {
JKSerializeOptionNone = 0,
JKSerializeOptionPretty = (1 << 0),
JKSerializeOptionEscapeUnicode = (1 << 1),
JKSerializeOptionEscapeForwardSlashes = (1 << 4),
JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes),
};
typedef JKFlags JKSerializeOptionFlags;
#ifdef __OBJC__
typedef struct JKParseState JKParseState; // Opaque internal, private type.
// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict
@interface JSONDecoder : NSObject {
JKParseState *parseState;
}
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
// Methods that return immutable collection objects.
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
// Methods that return mutable collection objects.
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
@end
#endif // __OBJC__
#endif // _JSONKIT_H_
#ifdef __cplusplus
} // extern "C"
#endif
| mikezone/OrderedDictionary | OrderedDictionary/Classes/JSONKit.h | C | mit | 6,497 |
<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>ActiveSupport::FileUpdateChecker</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<span>Ruby on Rails 4.1.8</span><br />
<h1>
<span class="type">Class</span>
ActiveSupport::FileUpdateChecker
<span class="parent"><
<a href="../Object.html">Object</a>
</span>
</h1>
<ul class="files">
<li><a href="../../files/__/_rvm/gems/ruby-2_2_0/gems/activesupport-4_1_8/lib/active_support/file_update_checker_rb.html">/home/kristof/.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<div class="description">
<p><a href="FileUpdateChecker.html">FileUpdateChecker</a> specifies the API
used by Rails to watch files and control reloading. The API depends on four
methods:</p>
<ul><li>
<p><code>initialize</code> which expects two parameters and one block as
described below.</p>
</li><li>
<p><code>updated?</code> which returns a boolean if there were updates in the
filesystem or not.</p>
</li><li>
<p><code>execute</code> which executes the given block on initialization and
updates the latest watched files and timestamp.</p>
</li><li>
<p><code>execute_if_updated</code> which just executes the block if it was
updated.</p>
</li></ul>
<p>After initialization, a call to <code>execute_if_updated</code> must
execute the block only if there was really a change in the filesystem.</p>
<p>This class is used by Rails to reload the <a href="../I18n.html">I18n</a>
framework whenever they are changed upon a new request.</p>
<pre><code>i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do
I18n.reload!
end
ActionDispatch::Reloader.to_prepare do
i18n_reloader.execute_if_updated
end
</code></pre>
</div>
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>E</dt>
<dd>
<ul>
<li>
<a href="#method-i-execute">execute</a>,
</li>
<li>
<a href="#method-i-execute_if_updated">execute_if_updated</a>
</li>
</ul>
</dd>
<dt>N</dt>
<dd>
<ul>
<li>
<a href="#method-c-new">new</a>
</li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li>
<a href="#method-i-updated-3F">updated?</a>
</li>
</ul>
</dd>
</dl>
<!-- Methods -->
<div class="sectiontitle">Class Public methods</div>
<div class="method">
<div class="title method-title" id="method-c-new">
<b>new</b>(files, dirs={}, &block)
<a href="../../classes/ActiveSupport/FileUpdateChecker.html#method-c-new" name="method-c-new" class="permalink">Link</a>
</div>
<div class="description">
<p>It accepts two parameters on initialization. The first is an array of files
and the second is an optional hash of directories. The hash must have
directories as keys and the value is an array of extensions to be watched
under that directory.</p>
<p>This method must also receive a block that will be called once a path
changes. The array of files and list of directories cannot be changed after
<a href="FileUpdateChecker.html">FileUpdateChecker</a> has been
initialized.</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
</p>
<div id="method-c-new_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">files</span>, <span class="ruby-identifier">dirs</span>={}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
<span class="ruby-ivar">@files</span> = <span class="ruby-identifier">files</span>.<span class="ruby-identifier">freeze</span>
<span class="ruby-ivar">@glob</span> = <span class="ruby-identifier">compile_glob</span>(<span class="ruby-identifier">dirs</span>)
<span class="ruby-ivar">@block</span> = <span class="ruby-identifier">block</span>
<span class="ruby-ivar">@watched</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-ivar">@updated_at</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-ivar">@last_watched</span> = <span class="ruby-identifier">watched</span>
<span class="ruby-ivar">@last_update_at</span> = <span class="ruby-identifier">updated_at</span>(<span class="ruby-ivar">@last_watched</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-execute">
<b>execute</b>()
<a href="../../classes/ActiveSupport/FileUpdateChecker.html#method-i-execute" name="method-i-execute" class="permalink">Link</a>
</div>
<div class="description">
<p>Executes the given block and updates the latest watched files and
timestamp.</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-execute_source')" id="l_method-i-execute_source">show</a>
</p>
<div id="method-i-execute_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb, line 72</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">execute</span>
<span class="ruby-ivar">@last_watched</span> = <span class="ruby-identifier">watched</span>
<span class="ruby-ivar">@last_update_at</span> = <span class="ruby-identifier">updated_at</span>(<span class="ruby-ivar">@last_watched</span>)
<span class="ruby-ivar">@block</span>.<span class="ruby-identifier">call</span>
<span class="ruby-keyword">ensure</span>
<span class="ruby-ivar">@watched</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-ivar">@updated_at</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-execute_if_updated">
<b>execute_if_updated</b>()
<a href="../../classes/ActiveSupport/FileUpdateChecker.html#method-i-execute_if_updated" name="method-i-execute_if_updated" class="permalink">Link</a>
</div>
<div class="description">
<p>Execute the block given if updated.</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-execute_if_updated_source')" id="l_method-i-execute_if_updated_source">show</a>
</p>
<div id="method-i-execute_if_updated_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb, line 82</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">execute_if_updated</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">updated?</span>
<span class="ruby-identifier">execute</span>
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">else</span>
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-updated-3F">
<b>updated?</b>()
<a href="../../classes/ActiveSupport/FileUpdateChecker.html#method-i-updated-3F" name="method-i-updated-3F" class="permalink">Link</a>
</div>
<div class="description">
<p>Check if any of the entries were updated. If so, the watched and/or
updated_at values are cached until the block is executed via
<code>execute</code> or <code>execute_if_updated</code>.</p>
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-updated-3F_source')" id="l_method-i-updated-3F_source">show</a>
</p>
<div id="method-i-updated-3F_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../.rvm/gems/ruby-2.2.0/gems/activesupport-4.1.8/lib/active_support/file_update_checker.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">updated?</span>
<span class="ruby-identifier">current_watched</span> = <span class="ruby-identifier">watched</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@last_watched</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">current_watched</span>.<span class="ruby-identifier">size</span>
<span class="ruby-ivar">@watched</span> = <span class="ruby-identifier">current_watched</span>
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">current_updated_at</span> = <span class="ruby-identifier">updated_at</span>(<span class="ruby-identifier">current_watched</span>)
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@last_update_at</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">current_updated_at</span>
<span class="ruby-ivar">@watched</span> = <span class="ruby-identifier">current_watched</span>
<span class="ruby-ivar">@updated_at</span> = <span class="ruby-identifier">current_updated_at</span>
<span class="ruby-keyword">true</span>
<span class="ruby-keyword">else</span>
<span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html> | kristoferrobin/p2p | doc/api/classes/ActiveSupport/FileUpdateChecker.html | HTML | mit | 12,900 |
/*
* Copyright (c) 2017 kszatan
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.github.kszatan.gocd.phabricator.stagingmaterial.handlers.bodies;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
public class Revision {
public RevisionData data;
public String revisionComment;
public String revision;
public Date timestamp;
public String user;
public List<ModifiedFile> modifiedFiles;
public Revision() {
data = new RevisionData();
revisionComment = "";
revision = "";
timestamp = new Date();
user = "";
modifiedFiles = new ArrayList<>();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Revision that = (Revision) o;
return Objects.equals(data, that.data) &&
Objects.equals(revisionComment, that.revisionComment) &&
Objects.equals(revision, that.revision) &&
Objects.equals(timestamp, that.timestamp) &&
Objects.equals(user, that.user) &&
Objects.equals(modifiedFiles, that.modifiedFiles);
}
@Override
public int hashCode() {
return Objects.hash(data, revisionComment, revision, timestamp, user, modifiedFiles);
}
}
| kszatan/gocd-phabricator-staging-material | src/main/java/io/github/kszatan/gocd/phabricator/stagingmaterial/handlers/bodies/Revision.java | Java | mit | 2,596 |
module Datatrans
VERSION = "3.0.2"
end
| denyago/datatrans | lib/datatrans/version.rb | Ruby | mit | 41 |
"""
Production specific settings for the django bucketlist project
"""
import os
import dj_database_url
from .base import *
DATABASES = {
'default': dj_database_url.config()
}
BOWER_PATH = 'app/node_modules/bower'
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = ['*']
# Setting for webpack_loader
WEBPACK_LOADER = {
'DEFAULT': {
'BUNDLE_DIR_NAME': 'bundles/prod/',
'STATS_FILE': os.path.join(BASE_DIR, '../../webpack-stats-prod.json'),
}
}
| andela-cdike/django_bucketlist_app | bucketlist/bucketlist/settings/production.py | Python | mit | 507 |
window.Graph.prototype.render = function () {
var canvas = document.createElement( "canvas" );
if ( !canvas.toDataURL ) return;
var dataset = this.get.dataset();
if ( !dataset.length ) return;
var h, w, x, y, z;
var data, index, len;
var top, bottom, ceiling, floor, img, render;
var axis = {}, base = {}, grid = {}, value = {};
var width = this.get.width();
var height = this.get.height();
var color = this.get.color();
var symbol = this.get.symbol();
var label = this.get.label();
var max = this.get.max();
var min = this.get.min();
var interval = this.get.interval();
var margin = 36;
var padding = 4;
var stroke = 2;
var large = 12;
var small = 10;
var font = "sans-serif";
var white = "#FFFFFF";
var silver = "#C0C0C0";
var nero = "#252525";
canvas.width = width;
canvas.height = height;
render = canvas.getContext( "2d" );
render.fillStyle = white;
render.fillRect( 0, 0, width, height );
render.fillStyle = nero;
render.strokeStyle = nero;
render.lineWidth = stroke;
render.font = ( "bold " + large + "px " + font );
render.textAlign = "center";
// set floor
if ( min % interval ) {
if ( min < 0 ) floor = ( ~~( ( min - interval ) / interval ) * interval );
else floor = ( ~~( ( min + interval ) / interval ) * interval );
} else floor = min;
// set ceiling
ceiling = ( max % interval ) ? ( ~~( ( max + interval ) / interval ) * interval ) : max;
// set axes
axis.x = ( dataset[0].length - 1 );
axis.y = ( (-floor) + ceiling );
// set base and grid
base.x = ( margin + margin + padding + padding );
base.y = ( height - margin );
grid.x = ( width - margin - margin - stroke - padding - padding - padding - padding - stroke - margin - margin );
grid.y = ( height - margin - margin );
// grid scaling
value.x = function ( n ) { return ( n === 0 ) ? n : ( ( n / axis.x ) * grid.x ); };
value.y = function ( n ) { return ( n === 0 ) ? n : ( ( n / axis.y ) * grid.y ); };
// set top and bottom position
top = ( margin - large );
bottom = round( base.y + padding + padding + small );
// render x-axis stroke
render.beginPath();
x = ( base.x - padding - padding - ( stroke * 0.5 ) );
y = round( base.y - ( stroke * 0.5 ) );
render.moveTo( x, y );
x = ( base.x + grid.x + padding + padding + ( stroke * 0.5 ) );
render.lineTo( x, y );
render.stroke();
render.closePath();
// render top and bottom title
x = ( width * 0.5 );
render.fillText( this.get.titleTop(), x, top );
render.fillText( this.get.titleBottom(), x, bottom );
// render left title
x = ( margin - large );
y = ( margin + ( grid.y * 0.5 ) );
render.save();
render.translate( x, y );
render.rotate( (-Math.PI) * 0.5 );
render.fillText( this.get.titleLeft(), 0, 0 );
render.restore();
// render interval stroke
x = ( margin + margin );
y = round( base.y - grid.y );
render.beginPath();
render.moveTo( x, y );
y = round( base.y );
render.lineTo( x, y );
render.stroke();
render.closePath();
// adjust y-axis
grid.y -= ( small + small );
base.y += ( value.y( floor ) - small );
// adjust font-size
render.font = ( small + "px " + font );
// render interval text
x = ( margin + margin - padding - padding );
y = round( base.y - grid.y );
render.textAlign = "right";
for ( z = floor; z <= ceiling; z += interval ) {
y = round( base.y - value.y( z ) );
render.fillText( z, x, y );
} render.textAlign = "center";
// render horizontal grid
render.setLineDash( [ 5, 5 ] );
render.strokeStyle = silver;
for ( z = ( floor + interval ); z <= ceiling; z += interval ) {
render.beginPath();
x = base.x;
y = round( base.y - value.y( z ) );
render.moveTo( x, y );
x = ( base.x + grid.x );
render.lineTo( x, y );
render.stroke();
render.closePath();
} render.setLineDash( [] );
render.strokeStyle = nero;
// render label text
for ( index = 0, len = label.length; index < len; index++ ) {
if ( !prototypeof.String( label[index] ) ) continue;
x = round( base.x + value.x( index ) );
render.fillText( label[index], x, bottom );
}
// graph data
x = []; y = [];
for ( index = 0, len = dataset.length; index < len; index++ ) {
render.strokeStyle = color[index] || nero;
for ( z = 0, data = dataset[index].length; z < data; z++ ) {
x[0] = round( base.x + value.x( z ) );
y[0] = round( base.y - value.y( dataset[index][z] ) );
if ( ( z + 1 ) < data ) {
x[1] = round( base.x + value.x( z + 1 ) );
y[1] = round( base.y - value.y( dataset[index][( z + 1 )] ) );
render.beginPath();
render.moveTo( x[0], y[0] );
render.lineTo( x[1], y[1] );
render.stroke();
render.closePath();
} render.fillStyle = color[index] || nero;
switch ( symbol[index] ) {
case ( "circle" ):
render.beginPath();
render.arc( x[0], y[0], padding, 0, 360 );
render.fill();
render.closePath();
render.fillStyle = white;
render.beginPath();
render.arc( x[0], y[0], round( padding * 0.5 ), 0, 360 );
render.fill();
render.closePath();
break;
case ( "square" ):
x[2] = ( x[0] - padding );
y[2] = ( y[0] - padding );
w = h = ( padding * 2 );
render.fillRect( x[2], y[2], w, h );
render.fillStyle = white;
x[2] = ( x[0] - round( padding * 0.5 ) );
y[2] = ( y[0] - round( padding * 0.5 ) );
w = h = padding;
render.fillRect( x[2], y[2], w, h );
break;
case ( "triangle" ):
render.fillStyle = white;
render.beginPath();
x[2] = x[0];
y[2] = ( y[0] - padding );
render.moveTo( x[2], y[2] );
x[2] -= padding;
y[2] += round( padding * 1.75 );
render.lineTo( x[2], y[2] );
x[2] += ( padding + padding );
render.lineTo( x[2], y[2] );
x[2] -= padding;
y[2] -= round( padding * 1.75 );
render.lineTo( x[2], y[2] );
render.fill();
render.stroke();
render.closePath();
break;
}
}
}
img = document.createElement( "img" );
img.src = canvas.toDataURL( "image/png" );
return img;
}; | brian-joseph-petersen/graph.js | src/render.js | JavaScript | mit | 7,112 |
package com.damienfremont.blog;
import org.fluentlenium.assertj.FluentLeniumAssertions;
import org.fluentlenium.core.FluentPage;
import org.fluentlenium.core.domain.FluentWebElement;
import org.openqa.selenium.support.FindBy;
// PAGE PATTERN DE LA PAGE 1
public class MainPage1 extends FluentPage {
@Override
public String getUrl() {
return "http://localhost:8080/20150125-test-fluentlenium/page1.html";
}
@Override
public void isAt() {
FluentLeniumAssertions.assertThat(title).hasText("Page 1");
}
@FindBy(css = ".container .title")
FluentWebElement title;
@FindBy(css = ".container .back.btn")
FluentWebElement backBtn;
}
| DamienFremont/blog | 20150125-test-fluentlenium/src/test/java/com/damienfremont/blog/MainPage1.java | Java | mit | 646 |
@@include('./head.html', {
"title": "- Medium Room",
"header": "Gumdrop Mountains Resort & Spa"
})
@@include('./primary_nav.html', {
"active": "room-medium"
})
@@include('./breadcrumb.html', {
"one": {
"link": "index.html",
"title": "Home",
"current": ""
},
"two": {
"link": "rooms.html",
"title": "All Rooms",
"current": ""
},
"three": {
"link": "room-medium.html",
"title": "Medium Room",
"current": "current"
}
})
@@include('./room_tile.html', {
"name": "Medium Room",
"price": "275.98",
"style": "light",
"desc": {
"one": "King Bed",
"two": "Walk in Closet",
"three": "Walk-out Balcony",
"four": "Mountain View"
}
})
@@include('./gallery_slider.html', {
"style": "dark"
})
@@include('./room_details.html', {
"title": "Additonal Details",
"bullet": "",
"desc": {
"one": "Pets Allowed",
"two": "Mountaintop View",
"three": "No Smoking",
"four": "Handicap Accessible",
"five": "Room Service is Available",
"six": "Pillow Service is Available",
"seven": "Down Comforter available by Request",
"eight": "Minibar and Safe in room"
},
"style": "light"
})
@@include('./promo_feature.html')
@@include('./footer.html', {
"active": "rooms"
})
| khrome83/gumdropmountains | src/templates/room-medium.html | HTML | mit | 1,624 |
#! coding: utf-8
import requests
import nose.tools as nt
from tests import TestPortalAndino
class TestExtendedCache(TestPortalAndino.TestPortalAndino):
@classmethod
def setUpClass(cls):
super(TestExtendedCache, cls).setUpClass()
def test_cache_hit_with_extended_cache(self):
requests.get('http://{0}:{1}'.format(self.site_url, self.nginx_port), verify=False)
req = requests.get('http://{0}:{1}'.format(self.site_url, self.nginx_port), verify=False)
nt.assert_true(req.headers.get('X-Cache-Status', '') == 'HIT')
| datosgobar/portal-andino | tests/configurations/nginx/tests_extended_cache.py | Python | mit | 561 |
# Image Sources
The images are coypright (c) by Bart Hiddink. They are released
under [CC BY 2.0](http://creativecommons.org/licenses/by/2.0/). The
images can be found in this
[Flickr stream](http://www.flickr.com/photos/zoutedrop/4023338872/in/photostream/). | marcojakob/dart-swiper | example/responsive/images/README.md | Markdown | mit | 263 |
require 'spec_helper'
module Exlibris
module Aleph
module API
module Client
class Patron
describe Record, vcr: {cassette_name: 'patron', record: :new_episodes} do
let(:patron_id) { 'BOR_ID' }
let(:id) { 'NYU01000980206' }
subject(:record) { Record.new(patron_id, id) }
it { should be_a Record }
describe '#patron_id' do
subject { record.patron_id }
it { should eq patron_id }
end
describe '#id' do
subject { record.id }
it { should eq id }
end
describe '#reply_code' do
subject { record.reply_code }
it { should eq '0000' }
end
describe '#reply_text' do
subject { record.reply_text }
it { should eq 'ok' }
end
describe '#error?' do
subject { record.error? }
it { should be_false }
end
describe '#to_h' do
subject { record.to_h }
it { should be_a Hash }
end
describe '#to_xml' do
subject { record.to_xml }
it { should be_a String }
end
end
end
end
end
end
end
| scotdalton/exlibris-aleph | spec/exlibris/aleph/api/client/patron/record_spec.rb | Ruby | mit | 1,331 |
'use strict';
var db = require('../../db');
module.exports = require('eregistrations/business-processes/resolve')(db.BusinessProcessDemo);
| egovernment/eregistrations-demo | apps-common/business-processes/demo.js | JavaScript | mit | 141 |
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
<f:layout name="Content" />
<div xmlns="http://www.w3.org/1999/xhtml" xmlns:flux="http://fedext.net/ns/flux/ViewHelpers" xmlns:v="http://fedext.net/ns/vhs/ViewHelpers" xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="Configuration">
<flux:form id="fourColumns" label="Four Columns (1 | 1 | 1 | 1)" description="Provides four columns to be filled with content elements." wizardTab="Grids">
<flux:flexform.grid>
<flux:grid.row>
<flux:grid.column style="width: 25%">
<flux:form.content name="FirstColumn" label="First column" />
</flux:grid.column>
<flux:grid.column style="width: 25%">
<flux:form.content name="SecondColumn" label="Second column" />
</flux:grid.column>
<flux:grid.column style="width: 25%">
<flux:form.content name="ThirdColumn" label="Third column" />
</flux:grid.column>
<flux:grid.column style="width: 25%">
<flux:form.content name="FourthColumn" label="Fourth column" />
</flux:grid.column>
</flux:grid.row>
</flux:grid>
</flux:form>
</f:section>
<f:section name="Preview">
<strong>[GRID] Four Columns (1 | 1 | 1 | 1)</strong>
<flux:widget.grid />
</f:section>
<f:section name="Main">
<div class="grid">
<div class="gi one-quarter">
<flux:content.render area="FirstColumn" />
</div>
<div class="gi one-quarter">
<flux:content.render area="SecondColumn" />
</div>
<div class="gi one-quarter">
<flux:content.render area="ThirdColumn" />
</div>
<div class="gi one-quarter">
<flux:content.render area="FourthColumn" />
</div>
</div>
</f:section>
</div>
| t3b/t3b_template | Resources/Private/Elements/Grids/GridFourColumns.html | HTML | mit | 1,674 |
---
layout: post
title: "KVM Networking - Bridge"
date: 2017-12-30
tags:
- KVM
- ubuntu
- virsh
- Bridge
- virbr
- vnet
- virtual bridge
- virt-install
- virsh net-dumpxml
- netplan
- ubuntu 17.10
- yaml
- netplan apply
- brctl show
---
In a bridged network, the guest VM is on the same network as your host machine i.e. if your host machine IP is 192.168.122.25 then your VM will have a IP address like 192.168.122.30. The virtual machine can be accessed by all computers in your host network as it is part of same network IP range.
To explore bridge interface, I have setup a Ubuntu Desktop VM (hostname = ubuntu-desk) which will act as a HOST machine. This host machine ubuntu-desk has a VM running on it, in bridge mode.
* Add the bridge interface on host machine
```
root@ubuntu-desk:~# brctl addbr vmbr0
root@ubuntu-desk:~# ip a | grep vmbr0 -B6
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 52:54:00:d9:22:19 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.192/24 brd 192.168.122.255 scope global dynamic ens3
valid_lft 2254sec preferred_lft 2254sec
inet6 fe80::1a0c:acc4:1487:b3a5/64 scope link
valid_lft forever preferred_lft forever
3: vmbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether de:84:3e:7a:06:4f brd ff:ff:ff:ff:ff:ff
```
* Attach it to the physical interface
```
root@ubuntu-desk:~# brctl addif vmbr0 ens3
root@ubuntu-desk:~# ip a | grep vmbr0 -A 4
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
link/ether 52:54:00:d9:22:19 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.192/24 brd 192.168.122.255 scope global dynamic ens3
valid_lft 2237sec preferred_lft 2237sec
inet6 fe80::1a0c:acc4:1487:b3a5/64 scope link
valid_lft forever preferred_lft forever
3: vmbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 52:54:00:d9:22:19 brd ff:ff:ff:ff:ff:ff
```
You would notice vmbr0 is attached to the physical interface ens3
* The bridge interface will also reflect in brctl show
```
root@ubuntu-desk:~# brctl show
bridge name bridge id STP enabled interfaces
vmbr0 8000.525400d92219 no ens3
```
* Run dhclient to get IP from dhcp server for vmbr0
```
root@ubuntu-desk:~# dhclient vmbr0
```
* Start the VM by connecting it to the vmbr0 bridge on host machine
I have connected the bridge network interface directly to an existing VM on the host machine using virtual machine manager.
Following is the dump of it's xml.
```
root@ubuntu-desk:~# virsh list
Id Name State
----------------------------------------------------
1 br-node1 running
```
```
root@ubuntu-desk:~# virsh dumpxml 1 | grep bridge -A5
<interface type='bridge'>
<mac address='52:54:00:4a:f2:00'/>
<source bridge='vmbr0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
```
* brctl will show the virtual interface to the bridge is UP
```
root@ubuntu-desk:~# brctl show
bridge name bridge id STP enabled interfaces
vmbr0 8000.525400d92219 no ens3
vnet0
```
* Following interfaces are created on the host machine.
```
root@ubuntu-desk:~# ip a | grep vmbr0 -A11
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
link/ether 52:54:00:d9:22:19 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.192/24 brd 192.168.122.255 scope global dynamic ens3
valid_lft 3543sec preferred_lft 3543sec
inet6 fe80::1a0c:acc4:1487:b3a5/64 scope link
valid_lft forever preferred_lft forever
3: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:d9:22:19 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.192/24 brd 192.168.122.255 scope global vmbr0
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fed9:2219/64 scope link
valid_lft forever preferred_lft forever
4: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:4a:f2:00 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe4a:f200/64 scope link
valid_lft forever preferred_lft forever
```
* The VM on the host machine has a IP on the same network 192.168.122.xxx
<img src="{{ site.baseurl }}/img/vm-bridge.png">
What we saw above is a temporary solution to build & attach a bridge network.
For a permanent solution the bridge interface details need to be added to /etc/network/interfaces file on the host machine.
My host machine is running Ubuntu 17.10 Desktop version, where I discovered that network configuration is managed by Netplan instead of the /etc/network/interfaces file. Digging further on Dr Google, led me to few good webpages which I have listed below, this gave me an understanding as where to add this new yaml configuration in netplan for adding an permanent bridge interface.
* Add a new network configuration YAML file
```
root@ubuntu-desk:~# cat /etc/netplan/01-network-vmbr0.yaml
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: true
bridges:
vmbr0:
interfaces: [ens3]
dhcp4: true
parameters:
stp: false
forward-delay: 0
```
Ubuntu desktop uses Network Manager as renderer for network configuration yaml. The network manager GUI can be accessed through nm-connection-editor command to configure/add a new network interface. I wanted to set my configuration the old school way rather than using the Network Manager GUI, hence I used networkd as the renderer for to managing my network configuration to setup a permanent bridge interface.
* Apply the configuration in yaml file.
```
root@ubuntu-desk:~#netplan apply
```
* This should bring up the bridge interface post every restart
```
root@ubuntu-desk:~# ip a | grep vmbr0 -A 10
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UP group default qlen 1000
link/ether 52:54:00:d9:22:19 brd ff:ff:ff:ff:ff:ff
3: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 0e:32:57:ff:6f:f5 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.133/24 brd 192.168.122.255 scope global dynamic vmbr0
valid_lft 3267sec preferred_lft 3267sec
inet6 fe80::c32:57ff:feff:6ff5/64 scope link
valid_lft forever preferred_lft forever
4: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master vmbr0 state UNKNOWN group default qlen 1000
link/ether fe:54:00:4a:f2:00 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe4a:f200/64 scope link
valid_lft forever preferred_lft forever
```
* ***Reference Links***
[https://wiki.ubuntu.com/Netplan](https://wiki.ubuntu.com/Netplan)
[https://websiteforstudents.com/configure-static-ip-addresses-on-ubuntu-18-04-beta/](https://websiteforstudents.com/configure-static-ip-addresses-on-ubuntu-18-04-beta/)
[https://www.dedoimedo.com/computers/kvm-bridged.html](https://www.dedoimedo.com/computers/kvm-bridged.html)
| amoldighe/amoldighe.github.io | _posts/2017-12-30-kvm-bridge-networking.md | Markdown | mit | 7,576 |
<?php
return array (
'id' => 'lenovo_a298t_ver1',
'fallback' => 'generic_android_ver2_3',
'capabilities' =>
array (
'model_name' => 'A298t',
'brand_name' => 'Lenovo',
'release_date' => '2012_november',
'physical_screen_height' => '88',
'physical_screen_width' => '53',
'resolution_width' => '480',
'resolution_height' => '800',
),
);
| cuckata23/wurfl-data | data/lenovo_a298t_ver1.php | PHP | mit | 373 |
//
// The MIT License (MIT)
//
//
// Copyright (c) 2014 Broad Institute
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
// Created by jrobinso on 7/20/12.
//
// To change the template use AppCode | Preferences | File Templates.
//
#import <Foundation/Foundation.h>
@class LittleEndianByteBuffer;
@interface TDFEntity : NSObject
@property(nonatomic, copy) NSString *name;
@property(nonatomic, retain) NSMutableDictionary* attributes;
- (void)readAttributes:(LittleEndianByteBuffer *)les;
@end | igvteam/igv-ipad | IGV/Classes/TDF/TDFEntity.h | C | mit | 1,548 |
#ifndef __EFFEKSEER_MODEL_H__
#define __EFFEKSEER_MODEL_H__
//----------------------------------------------------------------------------------
// Include
//----------------------------------------------------------------------------------
#include "Effekseer.Base.h"
#include "Effekseer.Vector2D.h"
#include "Effekseer.Vector3D.h"
#include "Effekseer.Manager.h"
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
namespace Effekseer {
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
/**
@brief fNX
*/
class Model
{
public:
struct Vertex
{
Vector3D Position;
Vector3D Normal;
Vector3D Binormal;
Vector3D Tangent;
Vector2D UV;
};
struct VertexWithIndex
{
Vector3D Position;
Vector3D Normal;
Vector3D Binormal;
Vector3D Tangent;
Vector2D UV;
uint8_t Index[4];
};
struct Face
{
int32_t Indexes[3];
};
struct Emitter
{
Vector3D Position;
Vector3D Normal;
Vector3D Binormal;
Vector3D Tangent;
};
private:
uint8_t* m_data;
int32_t m_size;
int32_t m_version;
int32_t m_vertexCount;
Vertex* m_vertexes;
int32_t m_faceCount;
Face* m_faces;
int32_t m_modelCount;
public:
/**
@brief RXgN^
*/
Model( void* data, int32_t size )
: m_data ( NULL )
, m_size ( size )
, m_version ( 0 )
, m_vertexCount ( 0 )
, m_vertexes ( NULL )
, m_faceCount ( 0 )
, m_faces ( NULL )
{
m_data = new uint8_t[m_size];
memcpy( m_data, data, m_size );
uint8_t* p = (uint8_t*)m_data;
memcpy( &m_version, p, sizeof(int32_t) );
p += sizeof(int32_t);
memcpy( &m_modelCount, p, sizeof(int32_t) );
p += sizeof(int32_t);
memcpy( &m_vertexCount, p, sizeof(int32_t) );
p += sizeof(int32_t);
m_vertexes = (Vertex*)p;
p += ( sizeof(Vertex) * m_vertexCount );
memcpy( &m_faceCount, p, sizeof(int32_t) );
p += sizeof(int32_t);
m_faces = (Face*)p;
p += ( sizeof(Face) * m_faceCount );
}
Vertex* GetVertexes() const { return m_vertexes; }
int32_t GetVertexCount() { return m_vertexCount; }
Face* GetFaces() const { return m_faces; }
int32_t GetFaceCount() { return m_faceCount; }
int32_t GetModelCount() { return m_modelCount; }
/**
@brief fXgN^
*/
virtual ~Model()
{
ES_SAFE_DELETE_ARRAY( m_data );
}
Emitter GetEmitter( Manager* manager, CoordinateSystem coordinate, float magnification )
{
RandFunc randFunc = manager->GetRandFunc();
int32_t randMax = manager->GetRandMax();
int32_t faceInd = (int32_t)( (GetFaceCount() - 1) * ( (float)randFunc() / (float)randMax ) );
faceInd = Clamp( faceInd, GetFaceCount() - 1, 0 );
Face& face = GetFaces()[faceInd];
Vertex& v0 = GetVertexes()[face.Indexes[0]];
Vertex& v1 = GetVertexes()[face.Indexes[1]];
Vertex& v2 = GetVertexes()[face.Indexes[2]];
float p1 = ( (float)randFunc() / (float)randMax );
float p2 = ( (float)randFunc() / (float)randMax );
/* ÊàÉûßé */
if( p1 + p2 > 1.0f )
{
p1 = 1.0f - p1;
p2 = 1.0f - p2;
}
float p0 = 1.0f - p1 - p2;
Emitter emitter;
emitter.Position = (v0.Position * p0 + v1.Position * p1 + v2.Position * p2) * magnification;
emitter.Normal = v0.Normal * p0 + v1.Normal * p1 + v2.Normal * p2;
emitter.Binormal = v0.Binormal * p0 + v1.Binormal * p1 + v2.Binormal * p2;
emitter.Tangent = v0.Tangent * p0 + v1.Tangent * p1 + v2.Tangent * p2;
if( coordinate == CoordinateSystem::LH )
{
emitter.Position.Z = - emitter.Position.Z;
emitter.Normal.Z = - emitter.Normal.Z;
emitter.Binormal.Z = - emitter.Binormal.Z;
emitter.Tangent.Z = - emitter.Tangent.Z;
}
return emitter;
}
Emitter GetEmitterFromVertex( Manager* manager, CoordinateSystem coordinate, float magnification )
{
RandFunc randFunc = manager->GetRandFunc();
int32_t randMax = manager->GetRandMax();
int32_t vertexInd = (int32_t)( (GetVertexCount() - 1) * ( (float)randFunc() / (float)randMax ) );
vertexInd = Clamp( vertexInd, GetVertexCount() - 1, 0 );
Vertex& v = GetVertexes()[vertexInd];
Emitter emitter;
emitter.Position = v.Position * magnification;
emitter.Normal = v.Normal;
emitter.Binormal = v.Binormal;
emitter.Tangent = v.Tangent;
if( coordinate == CoordinateSystem::LH )
{
emitter.Position.Z = - emitter.Position.Z;
emitter.Normal.Z = - emitter.Normal.Z;
emitter.Binormal.Z = - emitter.Binormal.Z;
emitter.Tangent.Z = - emitter.Tangent.Z;
}
return emitter;
}
Emitter GetEmitterFromVertex( int32_t index, CoordinateSystem coordinate, float magnification )
{
int32_t vertexInd = index % GetVertexCount();
Vertex& v = GetVertexes()[vertexInd];
Emitter emitter;
emitter.Position = v.Position * magnification;
emitter.Normal = v.Normal;
emitter.Binormal = v.Binormal;
emitter.Tangent = v.Tangent;
if( coordinate == CoordinateSystem::LH )
{
emitter.Position.Z = - emitter.Position.Z;
emitter.Normal.Z = - emitter.Normal.Z;
emitter.Binormal.Z = - emitter.Binormal.Z;
emitter.Tangent.Z = - emitter.Tangent.Z;
}
return emitter;
}
Emitter GetEmitterFromFace( Manager* manager, CoordinateSystem coordinate, float magnification )
{
RandFunc randFunc = manager->GetRandFunc();
int32_t randMax = manager->GetRandMax();
int32_t faceInd = (int32_t)( (GetFaceCount() - 1) * ( (float)randFunc() / (float)randMax ) );
faceInd = Clamp( faceInd, GetFaceCount() - 1, 0 );
Face& face = GetFaces()[faceInd];
Vertex& v0 = GetVertexes()[face.Indexes[0]];
Vertex& v1 = GetVertexes()[face.Indexes[1]];
Vertex& v2 = GetVertexes()[face.Indexes[2]];
float p0 = 1.0f / 3.0f;
float p1 = 1.0f / 3.0f;
float p2 = 1.0f / 3.0f;
Emitter emitter;
emitter.Position = (v0.Position * p0 + v1.Position * p1 + v2.Position * p2) * magnification;
emitter.Normal = v0.Normal * p0 + v1.Normal * p1 + v2.Normal * p2;
emitter.Binormal = v0.Binormal * p0 + v1.Binormal * p1 + v2.Binormal * p2;
emitter.Tangent = v0.Tangent * p0 + v1.Tangent * p1 + v2.Tangent * p2;
if( coordinate == CoordinateSystem::LH )
{
emitter.Position.Z = - emitter.Position.Z;
emitter.Normal.Z = - emitter.Normal.Z;
emitter.Binormal.Z = - emitter.Binormal.Z;
emitter.Tangent.Z = - emitter.Tangent.Z;
}
return emitter;
}
Emitter GetEmitterFromFace( int32_t index, CoordinateSystem coordinate, float magnification )
{
int32_t faceInd = index % (GetFaceCount() - 1);
Face& face = GetFaces()[faceInd];
Vertex& v0 = GetVertexes()[face.Indexes[0]];
Vertex& v1 = GetVertexes()[face.Indexes[1]];
Vertex& v2 = GetVertexes()[face.Indexes[2]];
float p0 = 1.0f / 3.0f;
float p1 = 1.0f / 3.0f;
float p2 = 1.0f / 3.0f;
Emitter emitter;
emitter.Position = (v0.Position * p0 + v1.Position * p1 + v2.Position * p2) * magnification;
emitter.Normal = v0.Normal * p0 + v1.Normal * p1 + v2.Normal * p2;
emitter.Binormal = v0.Binormal * p0 + v1.Binormal * p1 + v2.Binormal * p2;
emitter.Tangent = v0.Tangent * p0 + v1.Tangent * p1 + v2.Tangent * p2;
if( coordinate == CoordinateSystem::LH )
{
emitter.Position.Z = - emitter.Position.Z;
emitter.Normal.Z = - emitter.Normal.Z;
emitter.Binormal.Z = - emitter.Binormal.Z;
emitter.Tangent.Z = - emitter.Tangent.Z;
}
return emitter;
}
};
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
}
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
#endif // __EFFEKSEER_MODEL_H__
| lltcggie/Effekseer | Dev/Cpp/Effekseer/Effekseer/Effekseer.Model.h | C | mit | 7,779 |
<?php
/**
* This file is part of graze/gigya-client
*
* Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license https://github.com/graze/gigya-client/blob/master/LICENSE.md
* @link https://github.com/graze/gigya-client
*/
namespace Graze\Gigya\Test\Unit\Auth\OAuth2;
use DateInterval;
use DateTime;
use Graze\Gigya\Auth\OAuth2\GigyaGrant;
use Graze\Gigya\Auth\OAuth2\GrantInterface;
use Graze\Gigya\Gigya;
use Graze\Gigya\Response\ErrorCode;
use Graze\Gigya\Response\ResponseInterface;
use Graze\Gigya\Test\TestCase;
use Illuminate\Support\Collection;
use Mockery as m;
class GigyaGrantTest extends TestCase
{
/** @var mixed */
private $gigya;
/** @var GigyaGrant */
private $grant;
public function setUp()
{
$this->gigya = m::mock(Gigya::class);
$this->grant = new GigyaGrant($this->gigya);
}
public function testInstanceOf()
{
static::assertInstanceOf(GrantInterface::class, $this->grant);
}
public function testGetTokenWhenOneHasNotBeenSet()
{
$response = m::mock(ResponseInterface::class);
$this->gigya->shouldReceive('socialize->getToken')
->with([
'grant_type' => 'none',
], ['auth' => 'credentials'])
->andReturn($response);
$response->shouldReceive('getErrorCode')
->andReturn(ErrorCode::OK);
$data = m::mock(Collection::class);
$response->shouldReceive('getData')
->andReturn($data);
$data->shouldReceive('get')
->with('access_token')
->andReturn('some_token');
$data->shouldReceive('has')
->with('expires_in')
->andReturn(true);
$data->shouldReceive('get')
->with('expires_in', 0)
->andReturn(3600);
$token = $this->grant->getToken();
$expires = (new DateTime())->add(new DateInterval(sprintf('PT%dS', 3600)));
static::assertEquals('some_token', $token->getToken());
static::assertLessThanOrEqual($expires, $token->getExpires());
static::assertFalse($token->isExpired());
static::assertSame($token, $this->grant->getToken(), 'Calling getToken again, should return the same token');
}
public function testGetTokenWithNoExpiry()
{
$response = m::mock(ResponseInterface::class);
$this->gigya->shouldReceive('socialize->getToken')
->with([
'grant_type' => 'none',
], ['auth' => 'credentials'])
->andReturn($response);
$response->shouldReceive('getErrorCode')
->andReturn(ErrorCode::OK);
$data = m::mock(Collection::class);
$response->shouldReceive('getData')
->andReturn($data);
$data->shouldReceive('get')
->with('access_token')
->andReturn('some_token');
$data->shouldReceive('has')
->with('expires_in')
->andReturn(false);
$token = $this->grant->getToken();
static::assertEquals('some_token', $token->getToken());
static::assertNull($token->getExpires());
static::assertFalse($token->isExpired());
static::assertSame($token, $this->grant->getToken(), 'Calling getToken again, should return the same token');
}
public function testGetTokenThatExpiresCallGetTokenAgain()
{
$response = m::mock(ResponseInterface::class);
$this->gigya->shouldReceive('socialize->getToken')
->with([
'grant_type' => 'none',
], ['auth' => 'credentials'])
->twice()
->andReturn($response);
$response->shouldReceive('getErrorCode')
->twice()
->andReturn(ErrorCode::OK);
$data = m::mock(Collection::class);
$response->shouldReceive('getData')
->andReturn($data);
$data->shouldReceive('get')
->with('access_token')
->twice()
->andReturn('some_token');
$data->shouldReceive('has')
->with('expires_in')
->twice()
->andReturn(true);
$data->shouldReceive('get')
->with('expires_in', 0)
->twice()
->andReturn(0);
$token = $this->grant->getToken();
$expires = new DateTime();
static::assertEquals('some_token', $token->getToken());
static::assertLessThanOrEqual($expires, $token->getExpires());
static::assertTrue($token->isExpired());
$newToken = $this->grant->getToken();
static::assertNotSame($token, $newToken, 'Calling getToken again, should return the same token');
static::assertEquals('some_token', $token->getToken());
static::assertLessThanOrEqual($expires, $token->getExpires());
static::assertTrue($token->isExpired());
}
public function testNonOkResponseReturnsANullToken()
{
$response = m::mock(ResponseInterface::class);
$this->gigya->shouldReceive('socialize->getToken')
->with([
'grant_type' => 'none',
], ['auth' => 'credentials'])
->andReturn($response);
$response->shouldReceive('getErrorCode')
->andReturn(ErrorCode::ERROR_GENERAL_SERVER_ERROR);
$token = $this->grant->getToken();
static::assertNull($token);
}
}
| graze/gigya-client | tests/unit/Auth/OAuth2/GigyaGrantTest.php | PHP | mit | 5,747 |
//=======================================================================
// Copyright (c) 2014-2020 Baptiste Wicht
// Distributed under the terms of the MIT License.
// (See accompanying file LICENSE or copy at
// http://opensource.org/licenses/MIT)
//=======================================================================
#pragma once
#include "dll/base_conf.hpp"
#include "dll/util/tmp.hpp"
namespace dll {
/*!
* \brief Describe a layer that groups layers together.
*/
template <typename... Layers>
struct group_layer_desc {
/*!
* \brief A list of all the parameters of the descriptor
*/
using parameters = cpp::type_list<>;
/*! The layer type */
using layer_t = group_layer_impl<group_layer_desc<Layers...>>;
/*! The dynamic layer type */
using dyn_layer_t = dyn_group_layer_impl<dyn_group_layer_desc<typename Layers::dyn_layer_t...>>;
static_assert(sizeof...(Layers) > 0, "A group layer must contain at least one layer");
};
/*!
* \brief Describe a standard group layer.
*/
template <typename... Layers>
using group_layer = typename group_layer_desc<Layers...>::layer_t;
} //end of dll namespace
| wichtounet/dll | include/dll/utility/group_layer_desc.hpp | C++ | mit | 1,154 |
# maxwell-docker
Dockerfiles for building Zendesk's Maxwell (a mysqlbinlog->kafka/json pusher)
| iaintshine/maxwell-docker | README.md | Markdown | mit | 95 |
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_
#define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "chromecast/public/media/media_component_device.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
namespace media {
class FakeAudioWorker;
} // namespace media
namespace chromecast {
namespace media {
class CastAudioManager;
class MediaPipelineBackend;
class CastAudioOutputStream : public ::media::AudioOutputStream {
public:
CastAudioOutputStream(const ::media::AudioParameters& audio_params,
CastAudioManager* audio_manager);
~CastAudioOutputStream() override;
// ::media::AudioOutputStream implementation.
bool Open() override;
void Close() override;
void Start(AudioSourceCallback* source_callback) override;
void Stop() override;
void SetVolume(double volume) override;
void GetVolume(double* volume) override;
private:
// Task to push frame into audio pipeline device.
void PushFrame(AudioSourceCallback* source_callback);
void OnPushFrameStatus(AudioSourceCallback* source_callback,
MediaComponentDevice::FrameStatus status);
void OnPushFrameError(AudioSourceCallback* source_callback);
::media::AudioParameters audio_params_;
CastAudioManager* audio_manager_;
double volume_;
bool audio_device_busy_;
scoped_ptr<::media::FakeAudioWorker> audio_worker_;
scoped_ptr<::media::AudioBus> audio_bus_;
scoped_ptr<MediaPipelineBackend> media_pipeline_backend_;
base::WeakPtrFactory<CastAudioOutputStream> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CastAudioOutputStream);
};
} // namespace media
} // namespace chromecast
#endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_
| Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/chromecast/media/audio/cast_audio_output_stream.h | C | mit | 1,973 |
{% extends 'layout.html' %}
{% block content %}
<div class="thirteen wide column content">
<h1 class="ui teal dividing header">
<i class="linkify icon"></i>
<div class="content">URL Shortener
<div class="sub header">{{ name }}</div>
</div>
</h1>
<div class="ui divided list">
{%- for link in url_config %}
<div class="item">
<div class="header">
<a href="https://s.yamahi.eu/{{ link[0] }}">{{ link[1] }}</a>
</div>
{{ link[2] }}
</div>
{%- endfor %}
</div>
{%- if staff %}
<form class="ui form" role="form" method="POST" action="/shorturl">
<div class="two fields">
<div class="four wide field">
<label for="surl">Short URL</label>
<input name="surl" type="text" class="form-control" id="surl" placeholder="Short URL">
</div>
<div class="twelve wide field">
<label for="url">Long URL</label>
<input name="url" type="url" class="form-control" id="url" placeholder="Long URL">
</div>
</div>
<button type="submit" class="fluid ui basic button"><i class="floppy icon"></i>Save</button>
</form>
{%- endif %}
</div>
{%- endblock %}
| Nama/A.T.S.P.-Website | templates/shorturl.html | HTML | mit | 1,734 |
//%2005////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation, The Open Group.
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
// EMC Corporation; VERITAS Software Corporation; The Open Group.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//==============================================================================
//
// Author: Sushma Fernandes, Hewlett Packard Company ([email protected])
//
// Modified By: Nag Boranna, Hewlett Packard Company ([email protected])
//
// Josephine Eskaline Joyce, IBM ([email protected]) for PEP#101
//
//%////////////////////////////////////////////////////////////////////////////
#ifndef UserAuthProvider_h
#define UserAuthProvider_h
///////////////////////////////////////////////////////////////////////////////
// User/Auth Provider
///////////////////////////////////////////////////////////////////////////////
#include <Pegasus/Common/Config.h>
#include <cctype>
#include <iostream>
#include <Pegasus/ControlProviders/UserAuthProvider/Linkage.h>
#include <Pegasus/Common/String.h>
#include <Pegasus/Common/System.h>
#include <Pegasus/Common/ArrayInternal.h>
#include <Pegasus/Common/CIMType.h>
#include <Pegasus/Common/CIMInstance.h>
#include <Pegasus/Common/CIMObjectPath.h>
#include <Pegasus/Common/InternalException.h>
#include <Pegasus/Common/CIMStatusCode.h>
#include <Pegasus/Common/Tracer.h>
#include <Pegasus/Common/OperationContext.h>
#include <Pegasus/Repository/CIMRepository.h>
#include <Pegasus/Provider/CIMInstanceProvider.h>
#include <Pegasus/Provider/CIMMethodProvider.h>
#include <Pegasus/Common/ResponseHandler.h>
#include <Pegasus/Security/UserManager/UserManager.h>
#include <Pegasus/Security/UserManager/UserExceptions.h>
PEGASUS_USING_STD;
PEGASUS_NAMESPACE_BEGIN
/**
The UserAuthProvider provides responses to the CIM Operations defined in
the DMTF docuument CIM Operations over HTTP (Section 2.5).
This provider implements the following functions:
- createInstance ( Adds a user or user authorization )
- invokeMethod ( Modifies a user's password )
- enumerateInstanceNames ( Lists all users )
- enumerateInstances ( Lists all user authorizations )
- modifyInstance ( Modifies a user authorization )
- deleteInstance ( Removes a user or user authorization )
*/
class PEGASUS_USERAUTHPROVIDER_LINKAGE UserAuthProvider
: public CIMInstanceProvider, public CIMMethodProvider
{
public:
UserAuthProvider(CIMRepository* repository)
{
PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::UserAuthProvider");
//
// get an instance of User Manager and initialize
// the instance variable.
//
_userManager = UserManager::getInstance();
_repository = repository;
PEG_METHOD_EXIT();
}
virtual ~UserAuthProvider()
{
PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::~UserAuthProvider");
PEG_METHOD_EXIT();
}
/**
Returns the instance based on instanceName.
*/
virtual void getInstance(
const OperationContext & context,
const CIMObjectPath& instanceName,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
InstanceResponseHandler & handler)
{
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED, "");
}
/**
Creates a new instance.
@param context
@param instanceReference
@param CIMInstance
@param handler
*/
virtual void createInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance& myInstance,
ObjectPathResponseHandler & handler);
/**
Deletes the specified instance.
@param context
@param InstanceName
@param handler
*/
virtual void deleteInstance(
const OperationContext & context,
const CIMObjectPath& myInstance,
ResponseHandler & handler);
/**
Modify instance based on modifiedInstance.
@param context specifies security and locale information relevant for
the lifetime of this operation.
@param instanceReference the fully qualified object path of the instance.
@param modifiedInstance the modified instance.
@param handler enables providers to asynchronously return the results.
*/
virtual void modifyInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance& modifiedIns,
const Boolean includeQualifiers,
const CIMPropertyList & propertyList,
ResponseHandler & handler);
/**
Enumerates instances.
@param context specifies security and locale information relevant for
the lifetime of this operation.
@param ref the fully qualified object path of the instance.
@param flag specifies additional details regarding the operation.
@param propertyList list containing the properties.
@param handler enables providers to asynchronously return the results.
*/
virtual void enumerateInstances(
const OperationContext & context,
const CIMObjectPath & ref,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList& propertyList,
InstanceResponseHandler & handler);
/**
Enumerates all the user names.
*/
virtual void enumerateInstanceNames(
const OperationContext & context,
const CIMObjectPath & classReference,
ObjectPathResponseHandler & handler);
/**
Invoke Method, used to modify user's password
*/
virtual void invokeMethod(
const OperationContext & context,
const CIMObjectPath & ref,
const CIMName & methodName,
const Array<CIMParamValue> & inParams,
MethodResultResponseHandler & handler);
/**
Standard initialization function for the provider. This method should
never be called since this is an internal control provider.
*/
void initialize(CIMOMHandle& cimomHandle)
{
PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::initialize");
//
// get an instance of User Manager and initialize
// the instance variable.
//
_userManager = UserManager::getInstance();
// Can't get the respository handle here.
PEG_METHOD_EXIT();
}
void terminate(void)
{
PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::terminate");
// delete self. this is necessary because the entry point for this object allocated it, and
// the module is responsible for its memory management.
delete this;
PEG_METHOD_EXIT();
}
private:
/**
Verify User Authorization.
@param user userName to be verified
@throw CIM_ERR_ACCESS_DENIED if the specified user is not a
priviliged user.
*/
void _verifyAuthorization(const String& user);
//
// User Manager Instance variable
//
UserManager* _userManager;
//
// The repository pointer for use by the provider.
//
CIMRepository* _repository;
};
PEGASUS_NAMESPACE_END
#endif // UserAuthProvider_h
| ncultra/Pegasus-2.5 | src/Pegasus/ControlProviders/UserAuthProvider/UserAuthProvider.h | C | mit | 8,744 |
import pandas as pd
import numpy as np
print(pd.__version__)
# 0.23.0
print(pd.options.display.precision)
# 6
s_decimal = pd.Series([123.456, 12.3456, 1.23456, 0.123456, 0.0123456, 0.00123456])
print(s_decimal)
# 0 123.456000
# 1 12.345600
# 2 1.234560
# 3 0.123456
# 4 0.012346
# 5 0.001235
# dtype: float64
print(s_decimal[5])
# 0.00123456
pd.options.display.precision = 4
print(s_decimal)
# 0 123.4560
# 1 12.3456
# 2 1.2346
# 3 0.1235
# 4 0.0123
# 5 0.0012
# dtype: float64
pd.options.display.precision = 2
print(s_decimal)
# 0 1.23e+02
# 1 1.23e+01
# 2 1.23e+00
# 3 1.23e-01
# 4 1.23e-02
# 5 1.23e-03
# dtype: float64
print(pd.options.display.float_format)
# None
pd.options.display.float_format = '{:.2f}'.format
print(s_decimal)
# 0 123.46
# 1 12.35
# 2 1.23
# 3 0.12
# 4 0.01
# 5 0.00
# dtype: float64
pd.options.display.float_format = '{:.4g}'.format
print(s_decimal)
# 0 123.5
# 1 12.35
# 2 1.235
# 3 0.1235
# 4 0.01235
# 5 0.001235
# dtype: float64
pd.options.display.float_format = '{:.4e}'.format
print(s_decimal)
# 0 1.2346e+02
# 1 1.2346e+01
# 2 1.2346e+00
# 3 1.2346e-01
# 4 1.2346e-02
# 5 1.2346e-03
# dtype: float64
pd.options.display.float_format = '{: <10.2%}'.format
print(s_decimal)
# 0 12345.60%
# 1 1234.56%
# 2 123.46%
# 3 12.35%
# 4 1.23%
# 5 0.12%
# dtype: float64
df_decimal = pd.DataFrame({'s': ['0.4', '0.5', '0.6', '1.4', '1.5', '1.6'],
'f': [0.4, 0.5, 0.6, 1.4, 1.5, 1.6]})
pd.options.display.float_format = '{:.0f}'.format
print(df_decimal)
# s f
# 0 0.4 0
# 1 0.5 0
# 2 0.6 1
# 3 1.4 1
# 4 1.5 2
# 5 1.6 2
df_decimal2 = pd.DataFrame({'s': ['0.04', '0.05', '0.06', '0.14', '0.15', '0.16'],
'f': [0.04, 0.05, 0.06, 0.14, 0.15, 0.16]})
pd.options.display.float_format = '{:.1f}'.format
print(df_decimal2)
# s f
# 0 0.04 0.0
# 1 0.05 0.1
# 2 0.06 0.1
# 3 0.14 0.1
# 4 0.15 0.1
# 5 0.16 0.2
print(pd.options.display.max_rows)
# 60
df_tall = pd.DataFrame(np.arange(300).reshape((100, 3)))
pd.options.display.max_rows = 10
print(df_tall)
# 0 1 2
# 0 0 1 2
# 1 3 4 5
# 2 6 7 8
# 3 9 10 11
# 4 12 13 14
# .. ... ... ...
# 95 285 286 287
# 96 288 289 290
# 97 291 292 293
# 98 294 295 296
# 99 297 298 299
# [100 rows x 3 columns]
print(df_tall.head(10))
# 0 1 2
# 0 0 1 2
# 1 3 4 5
# 2 6 7 8
# 3 9 10 11
# 4 12 13 14
# 5 15 16 17
# 6 18 19 20
# 7 21 22 23
# 8 24 25 26
# 9 27 28 29
print(df_tall.head(20))
# 0 1 2
# 0 0 1 2
# 1 3 4 5
# 2 6 7 8
# 3 9 10 11
# 4 12 13 14
# .. .. .. ..
# 15 45 46 47
# 16 48 49 50
# 17 51 52 53
# 18 54 55 56
# 19 57 58 59
# [20 rows x 3 columns]
pd.options.display.max_rows = None
print(pd.options.display.max_columns)
# 20
df_wide = pd.DataFrame(np.arange(90).reshape((3, 30)))
print(df_wide)
# 0 1 2 3 4 5 6 7 8 9 ... 20 21 22 23 24 25 26 27 \
# 0 0 1 2 3 4 5 6 7 8 9 ... 20 21 22 23 24 25 26 27
# 1 30 31 32 33 34 35 36 37 38 39 ... 50 51 52 53 54 55 56 57
# 2 60 61 62 63 64 65 66 67 68 69 ... 80 81 82 83 84 85 86 87
# 28 29
# 0 28 29
# 1 58 59
# 2 88 89
# [3 rows x 30 columns]
pd.options.display.max_columns = 10
print(df_wide)
# 0 1 2 3 4 ... 25 26 27 28 29
# 0 0 1 2 3 4 ... 25 26 27 28 29
# 1 30 31 32 33 34 ... 55 56 57 58 59
# 2 60 61 62 63 64 ... 85 86 87 88 89
# [3 rows x 30 columns]
pd.options.display.max_columns = None
print(df_wide)
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \
# 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
# 2 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
# 19 20 21 22 23 24 25 26 27 28 29
# 0 19 20 21 22 23 24 25 26 27 28 29
# 1 49 50 51 52 53 54 55 56 57 58 59
# 2 79 80 81 82 83 84 85 86 87 88 89
print(pd.options.display.show_dimensions)
# truncate
pd.options.display.max_columns = 10
print(df_wide)
# 0 1 2 3 4 ... 25 26 27 28 29
# 0 0 1 2 3 4 ... 25 26 27 28 29
# 1 30 31 32 33 34 ... 55 56 57 58 59
# 2 60 61 62 63 64 ... 85 86 87 88 89
# [3 rows x 30 columns]
df = pd.DataFrame(np.arange(12).reshape((3, 4)))
print(df)
# 0 1 2 3
# 0 0 1 2 3
# 1 4 5 6 7
# 2 8 9 10 11
pd.options.display.show_dimensions = True
print(df_wide)
# 0 1 2 3 4 ... 25 26 27 28 29
# 0 0 1 2 3 4 ... 25 26 27 28 29
# 1 30 31 32 33 34 ... 55 56 57 58 59
# 2 60 61 62 63 64 ... 85 86 87 88 89
# [3 rows x 30 columns]
print(df)
# 0 1 2 3
# 0 0 1 2 3
# 1 4 5 6 7
# 2 8 9 10 11
# [3 rows x 4 columns]
pd.options.display.show_dimensions = False
print(df_wide)
# 0 1 2 3 4 ... 25 26 27 28 29
# 0 0 1 2 3 4 ... 25 26 27 28 29
# 1 30 31 32 33 34 ... 55 56 57 58 59
# 2 60 61 62 63 64 ... 85 86 87 88 89
print(df)
# 0 1 2 3
# 0 0 1 2 3
# 1 4 5 6 7
# 2 8 9 10 11
print(pd.options.display.width)
# 80
pd.options.display.max_columns = None
print(df_wide)
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \
# 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
# 2 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
# 19 20 21 22 23 24 25 26 27 28 29
# 0 19 20 21 22 23 24 25 26 27 28 29
# 1 49 50 51 52 53 54 55 56 57 58 59
# 2 79 80 81 82 83 84 85 86 87 88 89
pd.options.display.width = 60
print(df_wide)
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 \
# 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13
# 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43
# 2 60 61 62 63 64 65 66 67 68 69 70 71 72 73
# 14 15 16 17 18 19 20 21 22 23 24 25 26 27 \
# 0 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# 1 44 45 46 47 48 49 50 51 52 53 54 55 56 57
# 2 74 75 76 77 78 79 80 81 82 83 84 85 86 87
# 28 29
# 0 28 29
# 1 58 59
# 2 88 89
pd.options.display.width = None
print(df_wide)
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 \
# 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 1 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
# 2 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
# 19 20 21 22 23 24 25 26 27 28 29
# 0 19 20 21 22 23 24 25 26 27 28 29
# 1 49 50 51 52 53 54 55 56 57 58 59
# 2 79 80 81 82 83 84 85 86 87 88 89
print(pd.options.display.max_colwidth)
# 50
df_long_col = pd.DataFrame({'col': ['a' * 10, 'a' * 30, 'a' * 60]})
print(df_long_col)
# col
# 0 aaaaaaaaaa
# 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# 2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
pd.options.display.max_colwidth = 80
print(df_long_col)
# col
# 0 aaaaaaaaaa
# 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# 2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
df_long_col2 = pd.DataFrame({'col1': ['a' * 10, 'a' * 30, 'a' * 60],
'col2': ['a' * 10, 'a' * 30, 'a' * 60]})
pd.options.display.max_colwidth = 20
print(df_long_col2)
# col1 col2
# 0 aaaaaaaaaa aaaaaaaaaa
# 1 aaaaaaaaaaaaaaaa... aaaaaaaaaaaaaaaa...
# 2 aaaaaaaaaaaaaaaa... aaaaaaaaaaaaaaaa...
df_long_col_header = pd.DataFrame({'a' * 60: ['a' * 10, 'a' * 30, 'a' * 60]})
pd.options.display.max_colwidth = 40
print(df_long_col_header)
# aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# 0 aaaaaaaaaa
# 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# 2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
print(pd.options.display.colheader_justify)
# right
print(df_long_col)
# col
# 0 aaaaaaaaaa
# 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# 2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
pd.options.display.colheader_justify = 'left'
print(df_long_col)
# col
# 0 aaaaaaaaaa
# 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# 2 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
| nkmk/python-snippets | notebook/pandas_option_display.py | Python | mit | 9,346 |
#!ruby
# -*- encoding: utf-8 -*-
require 'yaml'
require 'optparse'
require 'sqlite3'
require 'rsruby'
require_relative 'stock_analyzer'
require_relative 'contrib/ruby-progressbar-0.9/progressbar'
class RInterface
@@r = RSRuby::instance
def self.cmpo0(history)
res = history.find_all { |x| x[0] > @@start }.collect {
|y| Date.jd(y[0]).strftime("%Y/%m/%d") }
(res.empty?)? 'NA' : res.join('","')
end
def self.cmpo1(history)
res = history.find_all { |x| x[0] > @@start }.collect {
|y| y[1] }
(res.empty?)? 'NA' : res.join(',')
end
def self.plot (a,b,saya)
@@start = $idate.jd - $view_period
return unless a[:history].last[0] >= @@start && b[:history].last[0] >= @@start
@@r.eval_R(<<-RSCRIPT)
axaxis <- as.Date(c("#{cmpo0(a[:history])}"))
a <- c(#{cmpo1(a[:history])})
bxaxis <- as.Date(c("#{cmpo0(b[:history])}"))
b <- c(#{cmpo1(b[:history])})
png("#{$work_dir}/#{saya[:image]}",width = 600, height = 600)
layout(matrix(c(1,2),2,1,byrow=TRUE))
xl <- c(head(axaxis,1),tail(axaxis,1))
yl <- c(min(c(min(a)/head(a),min(b)/head(b))),max(c(max(a)/head(a),max(b)/head(b))))
plot(axaxis,a/head(a,1),
xlim=xl,ylim=yl,
xaxt="n",yaxt="n",type="l",xlab="",ylab="",
col=1,lty=1,lwd=2)
par(new=T)
plot(bxaxis,b/head(b,1),
xlim=xl,ylim=yl,
xaxt="n",type="l",
col=2,lty=1,lwd=2,
xlab="Date",ylab="KABUKA (-)")
axis.Date(1,axaxis,format="%y-%m")
sayaxaxis <- as.Date(c("#{cmpo0(saya[:history])}"))
saya <- c(#{cmpo1(saya[:history])})
mvaxaxis <- as.Date(c("#{cmpo0(saya[:mva_history])}"))
mva <- c(#{cmpo1(saya[:mva_history])})
bolbxaxis <- as.Date(c("#{cmpo0(saya[:bollinger2sig][0])}"))
bolb <- c(#{cmpo1(saya[:bollinger2sig][0])})
boltxaxis <- as.Date(c("#{cmpo0(saya[:bollinger2sig][1])}"))
bolt <- c(#{cmpo1(saya[:bollinger2sig][1])})
xl <- c(head(sayaxaxis,1),tail(sayaxaxis,1))
yl <- c(min(c(min(saya),min(mva)),min(bolb)),max(c(max(saya),max(mva),max(bolt))))
plot(sayaxaxis,saya,
xlim=xl,ylim=yl,
xaxt="n",yaxt="n",type="l",xlab="",ylab="",
col=1,lty=1,lwd=2)
par(new=T)
plot(mvaxaxis,mva,
xlim=xl,ylim=yl,
xaxt="n",yaxt="n",type="l",xlab="",ylab="",
col=2,lty=3,lwd=2)
par(new=T)
plot(bolbxaxis,bolb,
xlim=xl,ylim=yl,
xaxt="n",yaxt="n",type="l",xlab="",ylab="",
col=2,lty=1,lwd=2)
par(new=T)
plot(boltxaxis,bolt,
xlim=xl,ylim=yl,
xaxt="n",type="l",
col=2,lty=1,lwd=2,
xlab="Date",ylab="SAYA (YEN)")
axis.Date(1,sayaxaxis,format="%y-%m")
dev.off()
RSCRIPT
end
end
def read_configure
conf = YAML.load_file 'configure.yaml'
select = conf['SELECT']
report = conf['REPORT']
$work_dir = conf['WORK_DIR']
if !File.exist?($work_dir) || File.ftype($work_dir) != "directory"
raise ConfigError, "invalid WORK_DIR"
end
$period = select['PERIOD']
$dma = select['DMA']
$view_period = report['VIEW_PERIOD']
end
def sqlite_connect
dbname = $work_dir + "/stock.sqlite3"
$con = SQLite3::Database.open(dbname)
$column = [:name,:symbol,:market_cap,:last_trade_price,:minimum_shares,
:outstand_margin_buy,:oustand_margin_sell]
command =<<SQL
select #{$column.join(',')} from toushou1_summary_column_jp
SQL
$column_jp = {}
$con.execute(command).flatten.each_with_index { |x,ind|
$column_jp[$column[ind]] = x
}
$column_jp[:num] = "購入株数<br>(株)"
$column_jp[:minimum_shares] = '単元株数<br>(株)'
$column_jp[:market_cap] = '時価総額<br>(百万円)'
$column_jp[:outstand_margin_rate] = '信用倍率'
$column_jp[:purchase_price] = '購入価格<br>(円)'
$column_jp[:purchase_day] = '購入日<br>(日)'
$column_jp[:retention_period] = '保持日数<br>(日)'
end
def read_stock(symbol)
command =<<SQL
select #{$column.join(',')} from toushou1_summary
where symbol = #{symbol}
SQL
stock = {}
$con.execute(command).flatten.each_with_index { |x,ind|
stock[$column[ind]] = x
}
stock[:outstand_margin_rate] = (stock[:oustand_margin_sell] != 0)?
(stock[:outstand_margin_buy].to_f/stock[:oustand_margin_sell].to_f).round(2) : '-'
tgt_table = "StockPrice#{symbol}"
command =<<SQL
select date, close from #{tgt_table}
where date <= '#{$idate}'
order by date desc
limit #{$period}
SQL
stock[:history] = $con.execute(command).reverse.collect { |x|
sy,sm,sd = x[0].split('-').collect {|y| y.to_i }
[Date.new(sy,sm,sd).jd,x[1]]
}
stock[:last_trade_price] = stock[:history].last[1]
stock
rescue
nil
end
def make_saya(a,b)
saya_history = StockAnalyzer::make_saya_history(a[:history],b[:history],a[:num],b[:num])
u_history, v_history = StockAnalyzer::make_kaisa_histories(a[:history],b[:history])
k_history = StockAnalyzer::make_saya_history(u_history,v_history,a[:num],b[:num])
ab = StockAnalyzer::correl(a[:history],b[:history])
as = StockAnalyzer::correl(a[:history],saya_history)
bs = StockAnalyzer::correl(b[:history],saya_history)
uv = StockAnalyzer::correl(u_history,v_history)
uk = StockAnalyzer::correl(u_history,k_history)
vk = StockAnalyzer::correl(v_history,k_history)
ab,as,bs,uv,uk,vk = [ab,as,bs,uv,uk,vk].collect { |x| x.round(2) }
saya = {history:saya_history,ab:ab,as:as,bs:bs,AB:uv,AS:uk,BS:vk}
mva, sigma = StockAnalyzer::make_mva_history(saya_history,$dma),
StockAnalyzer::make_sigma_history(saya_history,$dma)
bollinger2sig = StockAnalyzer::make_bollinger_bands(mva,sigma,2);
saya.merge! ({last_trade_price:saya_history.last[1],
last_trade_sigma:sigma.last[1],
symbol:"#{a[:symbol]}_#{b[:symbol]}",
image:"#{[a[:symbol],b[:symbol],a[:num],b[:num]].join('-')}.png",
mva_history:mva,
sigma_hisroty:sigma,
bollinger2sig:bollinger2sig})
saya.merge! ({purchase_price:a[:purchase_price]*a[:num] - b[:purchase_price]*b[:num]}) if $holding
saya
end
opt = OptionParser.new
$ifname = nil
$holding = false
$idate = Date.today
opt.on("-f VAL","pair list filename") { |v| $ifname = v }
opt.on("-p","is holding file?") { $holding = true }
opt.on("-d VAL", "target date(%y-%m-%d)") {
$idate = Date.parse(v)
}
opt.parse!(ARGV)
begin
raise "pair list file is not given" unless $ifname
num_line = 0
File.open($ifname,'r').each { |line|
num_line = num_line + 1
}
read_configure
sqlite_connect
o = File.open("#{$work_dir}/report-#{File.basename($ifname,'.*')}.html",'w')
o.puts <<HTML
<html>
<header>
<meta http-equiv="Content-Type" content='text/html; charset=utf-8'>
<meta http-equiv='Content-Style-Type' content='text/css'>
<title>#{File.basename($ifname)}</title>
<style type="text/css">
<!--
tr{
text-align: center;
}
-->
</style>
</header>
<body>
HTML
pbar = ProgressBar.new('Report',num_line)
count = 1
File.open($ifname,'r').each_with_index do |line,ind|
pbar.inc
next if ind == 0
l = line.split ' '
next if l.empty?
a, b = {}, {}
[a,b].each_with_index { |c,j|
c[:symbol], c[:num] = l[j],l[j+2].to_i
c.merge!(read_stock(c[:symbol]))
if $holding
c[:purchase_price] = l[j+4].to_i if $holding
sy,sm,sd = l[6].split('-').collect {|y| y.to_i }
c[:purchase_day] = l[6]
sy,sm,sd = l[6].split('-').collect {|y| y.to_i }
c[:retention_period] = Date.today.jd - Date.new(sy,sm,sd).jd
end
}
next unless [a,b].all? { |c| c[:history] != nil }
[[a,b],[b,a]].each { |x,y|
x[:link] = "http://stocks.finance.yahoo.co.jp/stocks/chart/?code=#{x[:symbol]}.T&t=ay&q=l&c1=#{y[:symbol]}&bc="
}
saya = make_saya(a,b)
o.puts <<HTML
【#{count}】<a href="#{a[:link]}">#{a[:symbol]}</a>-<a href="#{b[:link]}">#{b[:symbol]}</a><br>
<table border='1'>
<tr>
<td>#{$column_jp[:symbol]}</td><td>#{$column_jp[:name]}</td><td>#{$column_jp[:last_trade_price]}</td><td>#{$column_jp[:num]}</td>
#{"<td>#{$column_jp[:purchase_price]}</td><td>#{$column_jp[:purchase_day]}</td><td>#{$column_jp[:retention_period]}</td>" if $holding}
<td>#{$column_jp[:minimum_shares]}</td><td>#{$column_jp[:market_cap]}</td><td>#{$column_jp[:outstand_margin_rate]}</td>
</tr>
<tr>
<td>#{a[:symbol]}</td><td>#{a[:name]}</td><td>#{a[:last_trade_price]}</td><td>#{a[:num]}</td>
#{"<td>#{a[:purchase_price]}</td><td rowspan='2'>#{a[:purchase_day]}</td><td rowspan='2'>#{a[:retention_period]}</td>" if $holding}
<td>#{a[:minimum_shares]}</td><td>#{a[:market_cap]}</td><td>#{a[:outstand_margin_rate]}</td>
</tr>
<tr>
<td>#{b[:symbol]}</td><td>#{b[:name]}</td><td>#{b[:last_trade_price]}</td><td>#{b[:num]}</td>
#{"<td>#{b[:purchase_price]}</td>" if $holding}
<td>#{b[:minimum_shares]}</td><td>#{b[:market_cap]}</td><td>#{b[:outstand_margin_rate]}</td>
</tr>
</table>
<br>
<table border='1'>
<tr>
<td rowspan='2'>サヤ値<br>(円)</td>#{"<td rowspan='2'>購入値<br>(円)</td>" if $holding}<td rowspan='2'>サヤσ<br>(円)</td>
<td colspan='6'>相関係数</td>
</tr>
<tr>
<td>ab</td><td>as</td><td>bs</td><td>AB</td><td>AS</td><td>BS</td>
</tr>
<tr>
<td>#{saya[:last_trade_price]}</td>#{"<td>#{saya[:purchase_price]}" if $holding}</td><td>#{saya[:last_trade_sigma]}</td>
<td>#{saya[:ab]}</td><td>#{saya[:as]}</td><td>#{saya[:bs]}</td><td>#{saya[:AB]}</td><td>#{saya[:AS]}</td><td>#{saya[:BS]}</td>
</tr>
</table>
<img border="0" src='#{saya[:image]}' alt='#{saya[:image]}' width="600" height="600"></img><br>
HTML
RInterface.plot(a,b,saya)
count+=1
end
o.puts <<HTML
</body>
</html>
HTML
puts ''
rescue => e
puts ''
puts "[#{e.class.name}] #{e.message}"
e.backtrace.each { |x|
puts x
}
ensure
if $con && !$con.closed?
$con.close
end
end
| enjyoban/j-saya | report.rb | Ruby | mit | 9,860 |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
// **NOTE** This file was generated by a tool and any changes will be overwritten.
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.IO;
/// <summary>
/// The interface IWorkbookFunctionsRadiansRequestBuilder.
/// </summary>
public partial interface IWorkbookFunctionsRadiansRequestBuilder
{
/// <summary>
/// Builds the request.
/// </summary>
/// <param name="options">The query and header options for the request.</param>
/// <returns>The built request.</returns>
IWorkbookFunctionsRadiansRequest Request(IEnumerable<Option> options = null);
}
}
| garethj-msft/msgraph-sdk-dotnet | src/Microsoft.Graph/Requests/Generated/IWorkbookFunctionsRadiansRequestBuilder.cs | C# | mit | 994 |
import { Component, Input, ChangeDetectionStrategy, SimpleChanges, OnChanges } from '@angular/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
@Component({
selector: 'tdm-led',
templateUrl: './led.component.html',
styleUrls: [ './led.component.scss' ],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class TdmLedComponent implements OnChanges {
@Input() color: 'red' | 'blue' | 'yellow' | 'green';
@Input() disabled: boolean;
@Input() blink: boolean;
ngOnChanges(changes: SimpleChanges): void {
if ('disabled' in changes) {
this.disabled = coerceBooleanProperty(this.disabled);
}
if ('blink' in changes) {
this.blink = coerceBooleanProperty(this.blink);
}
}
}
| shlomiassaf/tdm | apps/demo/src/modules/@shared/components/led/led.component.ts | TypeScript | mit | 740 |
namespace DuplexPipe
{
using System;
using System.IO;
using System.IO.Pipes;
public class DuplexAnonymousPipeServer : IDisposable
{
private readonly DuplexPipeChannel channel;
private bool disposed;
public IDuplexChannel Channel => channel;
public DuplexAnonymousPipeServer(ChannelSettings? settings = null)
: this(sender: new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable),
receiver: new AnonymousPipeServerStream(PipeDirection.In, HandleInheritability.Inheritable),
settings: settings)
{
}
public DuplexAnonymousPipeServer(AnonymousPipeServerStream sender, AnonymousPipeServerStream receiver, ChannelSettings? settings = null)
{
channel = new DuplexPipeChannel(sender, receiver, settings);
}
~DuplexAnonymousPipeServer()
{
Dispose(false);
}
private void ThrowIfDisposed()
{
if (disposed) throw new ObjectDisposedException(nameof(DuplexAnonymousPipeServer));
}
public Handles GetConnectionHandles()
{
ThrowIfDisposed();
var sender = (AnonymousPipeServerStream)channel.OutStream;
var receiver = (AnonymousPipeServerStream)channel.InStream;
return new Handles
{
SenderHandle = sender.GetClientHandleAsString(),
ReceiverHandle = receiver.GetClientHandleAsString()
};
}
public void ReleaseClientHandles()
{
ThrowIfDisposed();
var sender = (AnonymousPipeServerStream)channel.OutStream;
var receiver = (AnonymousPipeServerStream)channel.InStream;
sender.DisposeLocalCopyOfClientHandle();
receiver.DisposeLocalCopyOfClientHandle();
}
private void Dispose(bool disposing)
{
if (!disposed && disposing)
{
channel.Dispose();
disposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public class Handles
{
public string SenderHandle { get; set; }
public string ReceiverHandle { get; set; }
}
}
} | valdisz/duplex-pipe | src/DuplexPipe/DuplexAnonymousPipeServer.cs | C# | mit | 2,397 |
#!/usr/bin/env node
const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const config = require('./webpack.base.js');
const port = 8000;
config.mode = 'development';
config.devtool = 'source-map';
// config.entry = [
// `webpack-dev-server/client?http://localhost:${port}/`,
// 'webpack/hot/dev-server',
// config.entry,
// ];
config.output = {
path: `${__dirname}/public`,
publicPath: '/',
filename: 'app.js',
};
config.plugins = [
...config.plugins,
new webpack.DefinePlugin({
'process.env': {
website: true,
},
}),
new webpack.NamedModulesPlugin(),
new CircularDependencyPlugin(),
new webpack.HotModuleReplacementPlugin(),
];
new WebpackDevServer(webpack(config), {
contentBase: './public/',
publicPath: config.output.publicPath,
historyApiFallback: false,
stats: {
colors: true,
chunks: false,
modules: false,
},
watchOptions: {
aggregateTimeout: 300,
poll: 1000,
},
// devServer: {
// contentBase: './public/',
// hot: true,
// },
hot: true,
inline: true,
}).listen(port, 'localhost', function(err, res) {
if (err) console.warn(err);
console.log(`Listening on localhost:${port}`);
});
| shoutrlabs/berliner-schlagzeilen | config/webpack.dev.js | JavaScript | mit | 1,254 |
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'okumanen'
| nihitok/okumanen | spec/spec_helper.rb | Ruby | mit | 78 |
import 'whatwg-fetch'
import Promise from 'nd-promise'
import qs from 'querystring'
import isPlainObj from 'is-plain-obj'
const defaultOptions = {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: 'GET'
}
export function merge (src, ...args) {
args.forEach(arg => {
Object.keys(arg).forEach(key => {
if (isPlainObj(arg[key])) {
if (!src.hasOwnProperty(key)) {
src[key] = {}
}
Object.assign(src[key], arg[key])
} else {
src[key] = arg[key]
}
})
})
return src
}
/**
* request
* @param {Object} options Options
* @return {Promise} Request Promise
*/
export default function request (_options = {}) {
const { hooks = {}, ...options } = merge({}, defaultOptions, _options)
hook(hooks.before)
return new Promise((resolve, reject) => {
parse(options)
.then(({ url, ...options }) => fetch(url, options))
.then(resolve)
.catch(reject)
})
.then(res => {
if (res.status >= 200 && res.status < 400) {
hook(hooks.success, res)
// 总是返回 JSON
return res.json()
} else {
// 比如 404
if (res.headers.get('Content-Type').indexOf('json') === -1) {
throw new RequestError(res.statusText)
}
throw res
}
})
.catch(err => {
hook(hooks.failure, err)
throw err
})
.finally(() => {
hook(hooks.after)
})
}
function parse ({ url, query, params, body, mutate, ...options }) {
if (body) {
if (typeof body === 'object') {
if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
body = JSON.stringify(body)
} else {
url += ((url.indexOf('?') !== -1) ? '&' : '?') + qs.stringify(body)
body = null
}
}
if (body) {
options.body = body
}
}
if (query) {
if (typeof query === 'object') {
query = qs.stringify(query)
}
url += ((url.indexOf('?') !== -1) ? '&' : '?') + query
}
// 替换地址中的宏变量:{xyz}
if (params) {
// from: https://github.com/Matt-Esch/string-template
const nargs = /\{(\w+)\}/g
url = url.replace(nargs, function replaceArg (match, i, index) {
let result
if (url[index - 1] === '{' &&
url[index + match.length] === '}') {
return i
} else {
result = params.hasOwnProperty(i) ? params[i] : null
if (result === null || result === undefined) {
return ''
}
return result
}
})
}
options.url = url
// mutate must be a function and return a promise
// useful for add authorization
if (mutate) {
return mutate(options)
}
return Promise.resolve(options)
}
function hook (fn, ...args) {
if (fn) {
fn.apply(null, args)
}
}
function RequestError (message) {
this.name = 'RequestError'
this.message = message
this.stack = (new Error()).stack
}
RequestError.prototype = Object.create(Error.prototype)
RequestError.prototype.constructor = RequestError
| fire17643/Vue-resource | plato-mobile/src/utils/request.js | JavaScript | mit | 3,019 |
/*global GIGO, jQuery*/
/*jshint browser: true*/
/*jshint devel: true*/
GIGO.stats = {};
GIGO.stats_init = function () {
jQuery("#status").html("status goes here");
GIGO.stats = {};
GIGO.pending = 0;
GIGO.bad = 0;
GIGO.finished = 0;
GIGO.total = 0;
};
GIGO.stats_start_server = function (task) {
task.parent.pending = 0;
task.parent.bad = 0;
task.parent.finished = 0;
task.parent.total = 0;
};
GIGO.stats_pb_server = function (task) {
task.parent.pb.empty();
task.parent.pb.append(GIGO.progress_bar(task.parent.finished, task.parent.total, task.parent.bad));
jQuery("#pb").empty();
jQuery("#pb").append(GIGO.progress_bar(GIGO.finished, GIGO.total, GIGO.bad));
};
GIGO.stats_add_task = function (task) {
task.parent.pending = task.parent.pending + 1;
task.parent.total = task.parent.total + 1;
GIGO.pending = GIGO.pending + 1;
GIGO.total = GIGO.total + 1;
GIGO.stats_pb_server(task);
};
GIGO.stats_finish_task = function (task, status) {
task.parent.pending = task.parent.pending - 1;
task.parent.finished = task.parent.finished + 1;
GIGO.pending = GIGO.pending - 1;
GIGO.finished = GIGO.finished + 1;
if (status === "ok") {} else {
task.parent.bad = task.parent.bad + 1;
GIGO.bad = GIGO.bad + 1;
}
if (task.parent.bad) {
task.parent.context.addClass("bad");
task.parent.context.removeClass("ok");
} else {
task.parent.context.addClass("ok");
task.parent.context.removeClass("bad");
}
GIGO.stats_pb_server(task);
};
| falling-sky/validator | source/stats.js | JavaScript | mit | 1,591 |
/* CRUD base file */
'use strict';
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var path = require('path');
module.exports = function () {
return new Promise(function (resolve, reject) {
fs
.readdirAsync(__dirname)
.then(function (files) {
return files
.filter(function (file) {
return (file !== path.basename(__filename));
})
.map(function (file) {
return require(__dirname + '/' + file);
});
})
.then(function (cruds) {
resolve(cruds);
})
.catch(function (err) {
reject(err);
});
});
};
| ungdev/wiki | controllers/index.js | JavaScript | mit | 838 |
module BeachApiCore
class Project < ApplicationRecord
belongs_to :user, class_name: 'BeachApiCore::User', inverse_of: :projects
belongs_to :organisation, class_name: 'BeachApiCore::Organisation', inverse_of: :projects
has_many :project_keepers, class_name: 'BeachApiCore::ProjectKeeper', inverse_of: :project, dependent: :destroy
validates :name, :user, :organisation, presence: true
accepts_nested_attributes_for :project_keepers, allow_destroy: true
end
end
| beachio/beach-api-core | app/models/beach_api_core/project.rb | Ruby | mit | 486 |
<!DOCTYPE html>
<title>
Keyboard
</title>
<html>
<head>
<!--Links to scripts,css,and JQuery Library -->
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<meta charset = "utf-8">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script src="virtualKeyboard.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<!--Loads Keyboard -->
<body onload="load(), readCookie()">
<div id="altSwipe"></div>
<div id="altSwipe2"></div>
<!--Keyboard button values defined -->
<div id="keyboard" >
<!-- Text box at top of keyboard -->
<input id="Input" type="text" size=100 disabled/>
<!--Current User-->
<input id="currentUser" type="text" size=20 ondblclick="userLogOut();" readonly/>
<!--Left side of buttons-->
<div id="left">
<input id="btn1" type="button" value="a" onmouseover="hover(this)"/><br />
<input id="btn2" type="button" value="b" onmouseover="hover(this)"/><br />
<input id="btn3" type="button" value="c" onmouseover="hover(this)"/><br />
<input id="btn4" type="button" value="d" onmouseover="hover(this)"/><br />
<input id="btn5" type="button" value="e" onmouseover="hover(this)"/><br />
<input id="btn6" type="button" value="f" onmouseover="hover(this)"/><br />
<input id="btn7" type="button" value="g" onmouseover="hover(this)"/><br />
<input id="btn8" type="button" value="h" onmouseover="hover(this)"/><br />
<input id="btn9" type="button" value="i" onmouseover="hover(this)"/><br />
<input id="btn10" type="button" value="j" onmouseover="hover(this)"/><br />
</div>
<!--Suggestion on the left -->
<div id="suggestion"></div>
<!--User's currently-typed word-->
<div id="typedWord"></div>
<!--Suggestion on the right-->
<div id="suggestion2"></div>
<!--Invisible box behind middle circle that handles character input-->
<div id="wordSelect" onmouseover="keyEnter();"></div>
<div id="image"><img src="circle.jpg" alt="Smiley face">
<!--Value of current hovered-over word-->
<div id=display></div>
</div>
<!--Right Side of buttons-->
<div id="right">
<input id="btn17" type="button" value="q" onmouseover="hover(this)"/><br />
<input id="btn18" type="button" value="r" onmouseover="hover(this)"/><br />
<input id="btn19" type="button" value="s" onmouseover="hover(this)"/><br />
<input id="btn20" type="button" value="t" onmouseover="hover(this)"/><br />
<input id="btn21" type="button" value="u" onmouseover="hover(this)"/><br />
<input id="btn22" type="button" value="v" onmouseover="hover(this)"/><br />
<input id="btn23" type="button" value="w" onmouseover="hover(this)"/><br />
<input id="btn24" type="button" value="x" onmouseover="hover(this)"/><br />
<input id="btn25" type="button" value="y" onmouseover="hover(this)"/><br />
<input id="btn26" type="button" value="z" onmouseover="hover(this)"/><br />
</div>
<!--Draggable divs that trigger the shift function-->
<div id="shiftSwipe"></div>
<div id="shiftSwipe2"></div>
<!--Bottom row of buttons-->
<div id="middle">
<input id="btn27" type="button" value="CP" alt="CP" onmouseover="hover(this)"/>
<input id="btn28" type="button" value="BKS" alt="BS" onmouseover="hover(this)"/>
<input id="btn11" type="button" value="k" onmouseover="hover(this)"/>
<input id="btn12" type="button" value="l" onmouseover="hover(this)"/>
<input id="btn13" type="button" value="m" onmouseover="hover(this)"/>
<input id="btn14" type="button" value="n" onmouseover="hover(this)"/>
<input id="btn15" type="button" value="o" onmouseover="hover(this)"/>
<input id="btn16" type="button" value="p" onmouseover="hover(this)"/>
<input id="btn29" type="button" value="." onmouseover="hover(this)"/>
<input id="btn30" type="button" value="EN" alt="EN" onmouseover="hover(this)"/>
</div>
</div>
</body>
<!--Shows coordinates of mouse-->
<footer>
<p>
<span></span>
</p>
</footer>
</html>
| aszlemba520/ARKeyboard | ARKeyboard/keyboard.html | HTML | mit | 4,216 |
/*
* This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
* at the root of this project for more details.
*/
package io.github.nucleuspowered.nucleus.modules.message;
import io.github.nucleuspowered.nucleus.api.core.NucleusUserPreferenceService;
import io.github.nucleuspowered.nucleus.core.services.impl.userprefs.NucleusKeysProvider;
import io.github.nucleuspowered.nucleus.core.services.impl.userprefs.PreferenceKeyImpl;
public final class MessageKeys {
public static final NucleusUserPreferenceService.PreferenceKey<Boolean> MESSAGE_TOGGLE = new PreferenceKeyImpl.BooleanKey(
NucleusKeysProvider.MESSAGE_TOGGLE_KEY,
true,
MessagePermissions.MSGTOGGLE_BYPASS,
"userpref.messagetoggle"
);
public static final NucleusUserPreferenceService.PreferenceKey<Boolean> SOCIAL_SPY = new PreferenceKeyImpl.BooleanKey(
NucleusKeysProvider.SOCIAL_SPY_KEY,
true,
((serviceCollection, user) -> serviceCollection.permissionService().hasPermission(user, MessagePermissions.BASE_SOCIALSPY)
&& !serviceCollection.permissionService().hasPermission(user, MessagePermissions.SOCIALSPY_FORCE)),
"userpref.socialspy"
);
}
| NucleusPowered/Nucleus | nucleus-modules/src/main/java/io/github/nucleuspowered/nucleus/modules/message/MessageKeys.java | Java | mit | 1,281 |
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Deleterious variation | 华人基因组学在线沙龙</title>
<link rel="stylesheet" href="/css/style.css" />
<link rel="stylesheet" href="/css/fonts.css" />
<link href="//cdn.bootcss.com/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
<script async src="//yihui.name/js/no-highlight.js"></script>
<script async src="/js/pangu.js"></script>
</head>
<body>
<nav class="header">
<div class="banner-wrapper">
<div class="banner">
<div class="banner-image"><a href="/">
<picture>
<source media="(min-width: 715px)" srcset="/img/new-logo-wide2020.png"><source media="(max-width: 380px)" srcset="/img/new-logo-wide2020.png">
<img src="/img/logo.png" alt="CGM标志">
</picture>
</a></div>
<ul class="menu-top">
<li><a href="/"><span data-hover="首页">首页</span></a></li>
<li><a href="/coming_cn/"><span data-hover="中国区预告">中国区预告</span></a></li>
<li><a href="/coming_us/"><span data-hover="北美区预告">北美区预告</span></a></li>
<li><a href="/coming_eu/"><span data-hover="欧洲区预告">欧洲区预告</span></a></li>
<li><a href="/tags/talks/"><span data-hover="往期活动">往期活动</span></a></li>
<li><a href="/wechat/"><span data-hover="公众号">公众号</span></a></li>
<li><a href="/cgmec/"><span data-hover="组织管理">组织管理</span></a></li>
<li><a href="/business/"><span data-hover="企业沙龙">企业沙龙</span></a></li>
<li><a href="/timeline/"><span data-hover="大事记">大事记</span></a></li>
<li><a href="/subscribe/"><span data-hover="加入我们">加入我们</span></a></li>
<li><a href="/archives/"><span data-hover="讨论列表">讨论列表</span></a></li>
</ul>
</div>
</div>
<div class="head-meta">
<span>Deleterious variation</span>
<span>2021-03-14</span>
<span>1 / 1</span>
</div>
</nav>
<div class="container">
<main class="list">
<section class="article-list">
<div class="categories">
<a href="/categories/%E5%AD%A6%E6%9C%AF%E6%8A%A5%E5%91%8A">学术报告</a>
</div>
<h1><a href="/2020/03/cgm-%E7%AC%AC84%E6%9C%9F%E5%BD%93%E5%8F%A4%E4%BA%BA%E4%B8%8E%E7%8E%B0%E4%BB%A3%E4%BA%BA%E7%9B%B8%E9%81%87%E9%80%82%E5%BA%94%E6%80%A7%E5%9F%BA%E5%9B%A0%E6%B8%97%E5%85%A5%E4%B8%8E%E6%9C%89%E5%AE%B3%E7%AA%81%E5%8F%98%E5%AF%B9%E7%A0%94%E7%A9%B6%E6%96%B9%E6%B3%95%E7%9A%84%E5%BD%B1%E5%93%8D/">CGM 第84期:当古人与现代人相遇:适应性基因渗入与有害突变对研究方法的影响</a></h1>
<div class="date-author">
<span class="date">2020-03-04</span>
</div>
<div class="summary">
<a href="/2020/03/cgm-%E7%AC%AC84%E6%9C%9F%E5%BD%93%E5%8F%A4%E4%BA%BA%E4%B8%8E%E7%8E%B0%E4%BB%A3%E4%BA%BA%E7%9B%B8%E9%81%87%E9%80%82%E5%BA%94%E6%80%A7%E5%9F%BA%E5%9B%A0%E6%B8%97%E5%85%A5%E4%B8%8E%E6%9C%89%E5%AE%B3%E7%AA%81%E5%8F%98%E5%AF%B9%E7%A0%94%E7%A9%B6%E6%96%B9%E6%B3%95%E7%9A%84%E5%BD%B1%E5%93%8D/">
<div class="thumbnail"><img src="https://i.imgur.com/J7cGsLa.png" alt="Thumbnail" /></div>
自现代人走出非洲以来,我们的祖先与包括尼安德特人和丹尼索瓦人在内的古人类有过数次相遇,并且这些远古时代的人群交流在我们的基因组上留下了诸多印迹。虽然绝大多数通过基因渗入进入我们基因库的遗传变化是有害的,在某些现代人群中,少部分来自古人的基因突变对我们适应特定环境有不同程度的帮助。而另一方面,有近期研究表明一些与适应性无关的群体遗传学机制也可以产生类似适应性基因渗……
</a>
</div>
</section>
</main>
<nav>
</nav>
</div>
<script async src="//yihui.name/js/center-img.js"></script>
<footer>
<script src="/js/article-titles.js"></script>
<div class="footer">
<ul class="menu">
<li><a href="/categories/%E4%BA%BA%E7%89%A9%E4%B8%93%E8%AE%BF/"><span data-hover="人物专访">人物专访</span></a></li>
<li><a href="/categories/%E4%B8%93%E9%A2%98%E8%AE%A8%E8%AE%BA/"><span data-hover="专题讨论">专题讨论</span></a></li>
<li><a href="/categories/%E5%AD%A6%E6%9C%AF%E6%8A%A5%E5%91%8A/"><span data-hover="学术报告">学术报告</span></a></li>
<li><a href="/tags/"><span data-hover="关键词">关键词</span></a></li>
<li><a href="/categories/%E4%BC%81%E4%B8%9A%E7%BE%A4/"><span data-hover="企业群">企业群</span></a></li>
<li><a href="/search/"><span data-hover="搜索CGM">搜索CGM</span></a></li>
<li><a href="/calendar/"><span data-hover="活动日历">活动日历</span></a></li>
<li><a href="/sponsor/"><span data-hover="赞助伙伴">赞助伙伴</span></a></li>
<li><a href="/jobinfo/"><span data-hover="工作信息">工作信息</span></a></li>
<li><a href="/"><span data-hover="关于我们">关于我们</span></a></li>
<li><a href="/knowledgebase/"><span data-hover="知识库">知识库</span></a></li>
</ul>
<div class="copyright">© 华人基因组学在线沙龙 2021 | <a href="https://github.com/cgmonline">Github</a> | <a href="https://www.youtube.com/channel/UCk4tsPZOzGkP2IaU4YvUG_g">YouTube</a></div>
</div>
</footer>
<script type="application/javascript">
var doNotTrack = false;
if (!doNotTrack) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48206713-4', 'auto');
ga('send', 'pageview');
}
</script>
</body>
</html>
| cgmonline/cgmonline | docs/tags/deleterious-variation/index.html | HTML | mit | 6,010 |
package main
import (
"flag"
"fmt"
"github.com/bitly/nsq/nsq"
"github.com/bitly/nsq/util"
"log"
"os"
"os/signal"
"syscall"
)
var (
showVersion = flag.Bool("version", false, "print version string")
topic = flag.String("topic", "", "nsq topic")
channel = flag.String("channel", "nsq_tail#ephemeral", "nsq channel")
maxInFlight = flag.Int("max-in-flight", 200, "max number of messages to allow in flight")
nsqdTCPAddrs = util.StringArray{}
lookupdHTTPAddrs = util.StringArray{}
)
func init() {
flag.Var(&nsqdTCPAddrs, "nsqd-tcp-address", "nsqd TCP address (may be given multiple times)")
flag.Var(&lookupdHTTPAddrs, "lookupd-http-address", "lookupd HTTP address (may be given multiple times)")
}
type TailHandler struct{}
func (th *TailHandler) HandleMessage(m *nsq.Message) error {
_, err := os.Stdout.Write(m.Body)
if err != nil {
log.Fatalf("ERROR: failed to write to os.Stdout - %s", err.Error())
}
_, err = os.Stdout.WriteString("\n")
if err != nil {
log.Fatalf("ERROR: failed to write to os.Stdout - %s", err.Error())
}
return nil
}
func main() {
flag.Parse()
if *showVersion {
fmt.Printf("nsq_tail v%s\n", util.BINARY_VERSION)
return
}
if *topic == "" || *channel == "" {
log.Fatalf("--topic and --channel are required")
}
if *maxInFlight < 0 {
log.Fatalf("--max-in-flight must be > 0")
}
if len(nsqdTCPAddrs) == 0 && len(lookupdHTTPAddrs) == 0 {
log.Fatalf("--nsqd-tcp-address or --lookupd-http-address required")
}
if len(nsqdTCPAddrs) > 0 && len(lookupdHTTPAddrs) > 0 {
log.Fatalf("use --nsqd-tcp-address or --lookupd-http-address not both")
}
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
r, err := nsq.NewReader(*topic, *channel)
if err != nil {
log.Fatalf(err.Error())
}
r.SetMaxInFlight(*maxInFlight)
r.AddHandler(&TailHandler{})
for _, addrString := range nsqdTCPAddrs {
err := r.ConnectToNSQ(addrString)
if err != nil {
log.Fatalf(err.Error())
}
}
for _, addrString := range lookupdHTTPAddrs {
log.Printf("lookupd addr %s", addrString)
err := r.ConnectToLookupd(addrString)
if err != nil {
log.Fatalf(err.Error())
}
}
for {
select {
case <-r.ExitChan:
return
case <-sigChan:
r.Stop()
}
}
}
| syshack/nsq | examples/nsq_tail/nsq_tail.go | GO | mit | 2,312 |
## SISTEM BANK SOAL DAN UJIAN ONLINE
Sistem Bank Soal dan Ujian Online, menggunakan PHP dan mysql.
untuk SMA, MA, atau Sederajat
| r3k4/ujianonline | README.md | Markdown | mit | 134 |
import glob
import json
import os
from collections import OrderedDict
from functools import lru_cache, wraps
from itertools import chain
from mwapi import Session
from html import escape
import uglipyjs
from flask import current_app, request
from ..i18n import i18n
from ..util.wikimedia import host_from_dbname
from .responses import bad_request
class ParamError(Exception):
pass
def read_param(request, param, default=None, type=str):
try:
value = request.args.get(param, request.form.get(param, default))
return type(value.strip())
except (ValueError, TypeError) as e:
error = bad_request("Could not interpret {0}. {1}"
.format(param, str(e)))
raise ParamError(error)
def read_bar_split_param(request, param, default=None, type=str):
values = read_param(request, param, default=default)
if values is None:
return []
return [type(value) for value in values.split("|")]
def jsonp(func):
"""Wraps JSONified output for JSONP requests."""
@wraps(func)
def decorated_function(*args, **kwargs):
callback = request.args.get('callback', None)
if callback is not None:
data = str(func(*args, **kwargs).data)
content = str(callback) + '(' + data + ')'
mimetype = 'application/javascript'
return current_app.response_class(content, mimetype=mimetype)
else:
return func(*args, **kwargs)
return decorated_function
def static_file_path(path):
dir_name = os.path.dirname(os.path.abspath(__file__))
return os.path.join(dir_name, "static", path)
@lru_cache(128)
def read_javascript(static_paths, minify=False):
if minify:
return uglipyjs.compile(read_cat(static_paths))
else:
return read_cat(static_paths)
@lru_cache(128)
def minify_js(js_text):
return uglipyjs.compile(js_text)
@lru_cache(128)
def read_cat(static_paths):
return "".join(open(static_file_path(path)).read()
for path in static_paths)
def build_script_tags(static_paths, config):
return "".join('<script src="{0}"></script>'
.format(static_path(path, config))
for path in static_paths)
def build_style_tags(static_paths, config):
return "".join('<link rel="stylesheet" type="text/css" href="{0}" />'
.format(static_path(path, config))
for path in static_paths)
def app_path(path, config):
return path_join("/", config['wsgi']['application_root'], path)
def static_path(path, config):
if path[:4] == "http" or path[:2] == "//":
return path
elif path[:1] == "/":
return app_path(path[1:], config)
else:
return app_path(path_join("static", path), config)
def url_for(path):
return path_join(request.url_root, path)
def path_join(*path_parts):
path_parts = [path for path in path_parts if len(path) > 0]
if len(path_parts) == 0:
return ""
elif len(path_parts) == 1:
return path_parts[0]
else: # len(path_parts) >= 2
return "/".join(chain([path_parts[0].rstrip("/")],
(path.strip("/") for path in path_parts[1:-1]),
[path_parts[-1].lstrip("/")]))
def get_i18n_dir():
path = os.path.abspath(__file__)
path = os.path.dirname(path)
path = os.path.join(path, '../i18n/')
return path
def i18n_dict():
i18n_dir = get_i18n_dir()
i18n = {}
for lang_file_path in glob.glob(os.path.join(i18n_dir, "*.json")):
f = open(lang_file_path, 'r')
lang_i18n = json.load(f)
filename = os.path.basename(lang_file_path)
i18n[filename[:-5]] = OrderedDict(
sorted(lang_i18n.items(), key=lambda t: t[0]))
i18n = OrderedDict(sorted(i18n.items(), key=lambda t: t[0]))
return i18n
def pretty_json(data):
return json.dumps(data, ensure_ascii=False, sort_keys=True,
separators=(',', ': '), indent=8)
def build_maintenance_notice(request, config):
accept_header = request.headers.get('Accept-Language', "en;q=0")
accept_langs = accept_header.split(";")[0].split(",")
if 'maintenance_notice' in config['wikilabels']:
notice = config['wikilabels']['maintenance_notice']
ahref = '<a href="{0}">{0}</a>'.format(notice['url'])
return i18n("maintenance notice", accept_langs,
[notice['date'], ahref])
@lru_cache(500)
def get_user_info(user_id, host):
params = {
'action': 'query',
'meta': 'globaluserinfo',
'guiid': user_id
}
session = Session(host)
res = session.get(**params)
if 'error' in res:
return {}
return res.get('query', {}).get('globaluserinfo', {})
def parse_user_data(case, config):
# Batching is not possible, don't ask why
user_info = get_user_info(case['user'],
config['wikilabels']['central_auth_host'])
case['user_name'] = escape(user_info.get('name', ''))
if 'home' in user_info and case['user_name'] != '':
home_wiki = host_from_dbname(user_info['home'])
case['user_name'] = (
'<a href="https://{host}/wiki/User:{user__name}">'
'{user_name}</a>'.format(
host=home_wiki,
user__name=case['user_name'].replace(' ', '_'),
user_name=case['user_name']))
return case
| wiki-ai/wikilabels | wikilabels/wsgi/util.py | Python | mit | 5,467 |
/*
* Created by SharpDevelop.
* User: lextm
* Date: 2008/5/2
* Time: 12:24
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using NUnit.Framework;
using System.Text;
#pragma warning disable 1591,0618,1718
namespace Lextm.SharpSnmpLib.Tests
{
[TestFixture]
[Category("Default")]
public class OctetStringTestFixture
{
[Test]
public void TestToLevels()
{
Assert.Throws<InvalidCastException>(() => new OctetString(new byte[] { 0x00, 0x08 }).ToLevels());
Assert.Throws<InvalidCastException>(() => new OctetString(new byte[] { 0xFF }).ToLevels());
}
[Test]
public void TestException()
{
Assert.Throws<ArgumentNullException>(() => new OctetString(new Tuple<int, byte[]>(0, new byte[] { 0 }), null));
Assert.Throws<ArgumentNullException>(() => new OctetString((byte[])null));
Assert.Throws<ArgumentNullException>(() => OctetString.Empty.ToString(null));
Assert.Throws<ArgumentNullException>(() => OctetString.Empty.AppendBytesTo(null));
}
[Test]
public void TestMethod()
{
byte[] expected = new byte[] {0x04, 0x06, 0x70, 0x75, 0x62, 0x6C, 0x69, 0x63};
ISnmpData data = DataFactory.CreateSnmpData(expected);
Assert.AreEqual(SnmpType.OctetString, data.TypeCode);
OctetString s = (OctetString)data;
Assert.AreEqual("public", s.ToString());
}
[Test]
public void TestEncoding()
{
var temp = OctetString.DefaultEncoding;
OctetString.DefaultEncoding = Encoding.UTF8;
Assert.AreEqual(Encoding.UTF8, OctetString.DefaultEncoding);
OctetString.DefaultEncoding = temp;
}
[Test]
public void TestPhysical()
{
var mac = new OctetString(new byte[] {80, 90, 64, 87, 11, 99});
Assert.AreEqual("505A40570B63", mac.ToPhysicalAddress().ToString());
var invalid = new OctetString(new byte[] {89});
Assert.Throws<InvalidCastException>(() => invalid.ToPhysicalAddress());
}
[Test]
public void TestEqual()
{
var left = new OctetString("public");
var right = new OctetString("public");
Assert.AreEqual(left, right);
Assert.IsTrue(left != OctetString.Empty);
// ReSharper disable EqualExpressionComparison
Assert.IsTrue(left == left);
// ReSharper restore EqualExpressionComparison
}
[Test]
public void TestToBytes()
{
Assert.AreEqual(2, new OctetString("").ToBytes().Length);
}
[Test]
public void TestEmpty()
{
Assert.AreEqual("", OctetString.Empty.ToString());
}
[Test]
public void TestChinese()
{
Assert.AreEqual("Öйú", new OctetString("Öйú", Encoding.Unicode).ToString(Encoding.Unicode));
}
}
}
#pragma warning restore 1591,0618,1718 | yonglehou/sharpsnmplib | Tests/Tests/OctetStringTestFixture.cs | C# | mit | 3,111 |
<h1>Ejercicio 12</h1>
<p>Crea una directiva “ejercicio-heroes2”, que reciba un listado de héroes
a través del atributo equipo, de la forma
<code><ejercicio-heroes2 equipo='vm.listadoHeroes'></<ejercicio-heroes2></code>
y pinte un listado con los nombres de los heroes. El listadoHeroes será de la forma
<code>[{nombre:”Wolverine”}, {nombre:”Banshee”}, {nombre:”Coloso”}]</code>
<hr>
<h2>Resultado</h2>
<ejercicio-heroes2 equipo='vm.listadoHeroes'></ejercicio-heroes2>
<hr>
<h3>Código ejecutado</h3>
<pre>
<ejercicio-heroes2 equipo='vm.listadoHeroes'></ejercicio-heroes2>
</pre>
<hr>
<a href="#/11">Anterior</a>
|
<a href="#/13">Siguiente</a>
| gonzaloruizdevilla/workshopdirectivas | ejercicios/ejercicio12/template.html | HTML | mit | 702 |
package knot.net.http.rendering
object StringRendering{
def apply(): StringRendering = new StringRendering()
}
class StringRendering extends Rendering {
private[this] val sb = new StringBuilder()
override def ~(char: Char) = {
sb.append(char)
this
}
def result(): String = sb.toString()
}
| defvar/knot | knot-net/src/main/scala/knot/net/http/rendering/StringRendering.scala | Scala | mit | 311 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Coq bench</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../../..">Stable</a></li>
<li class="active"><a href="">8.4.5 / list-string 2.0.0</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../../../../../about.html">About</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../../..">« Up</a>
<h1>list-string <small>2.0.0</small></h1>
<table class="table table-striped text-center">
<thead>
<tr>
<td>Date</td>
<td>Time</td>
<td>Relative</td>
<td>Status</td>
</tr>
</thead>
<tbody>
<tr>
<td>2015-02-02</td>
<td>17:28:54</td>
<td><script>document.write(moment("2015-02-02 17:28:54 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script></td>
<td class="success"><a href="2015-02-02_17-28-54.html">7 s</a></td>
</tr>
<tr>
<td>2015-01-31</td>
<td>08:26:07</td>
<td><script>document.write(moment("2015-01-31 08:26:07 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script></td>
<td class="success"><a href="2015-01-31_08-26-07.html">10 s</a></td>
</tr>
<tr>
<td>2015-01-29</td>
<td>12:43:58</td>
<td><script>document.write(moment("2015-01-29 12:43:58 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script></td>
<td class="success"><a href="2015-01-29_12-43-58.html">7 s</a></td>
</tr>
<tr>
<td>2015-01-28</td>
<td>13:28:42</td>
<td><script>document.write(moment("2015-01-28 13:28:42 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script></td>
<td class="success"><a href="2015-01-28_13-28-42.html">7 s</a></td>
</tr>
<tr>
<td>2015-01-27</td>
<td>18:20:20</td>
<td><script>document.write(moment("2015-01-27 18:20:20 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script></td>
<td class="success"><a href="2015-01-27_18-20-20.html">13 s</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html> | coq-bench/coq-bench.github.io-old | clean/Linux-x86_64-4.02.1-1.2.0/stable/8.4.5/list-string/2.0.0/index.html | HTML | mit | 4,628 |
#include <QApplication>
#include "guiutil.h"
#include "bitcoinaddressvalidator.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include <QDateTime>
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
#include <QUrl>
#include <QTextDocument> // For Qt::escape
#include <QAbstractItemView>
#include <QClipboard>
#include <QFileDialog>
#include <QDesktopServices>
#include <QThread>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#ifdef WIN32
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include "shlwapi.h"
#include "shlobj.h"
#include "shellapi.h"
#endif
namespace GUIUtil {
QString dateTimeStr(const QDateTime &date)
{
return date.date().toString(Qt::SystemLocaleShortDate) + QString(" ") + date.toString("hh:mm");
}
QString dateTimeStr(qint64 nTime)
{
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
}
QFont bitcoinAddressFont()
{
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
return font;
}
void setupAddressWidget(QLineEdit *widget, QWidget *parent)
{
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
widget->setValidator(new BitcoinAddressValidator(parent));
widget->setFont(bitcoinAddressFont());
}
void setupAmountWidget(QLineEdit *widget, QWidget *parent)
{
QDoubleValidator *amountValidator = new QDoubleValidator(parent);
amountValidator->setDecimals(8);
amountValidator->setBottom(0.0);
widget->setValidator(amountValidator);
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
{
// return if URI is not valid or is no bitcoin URI
if(!uri.isValid() || uri.scheme() != QString("limecoinlite"))
return false;
SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;
QList<QPair<QString, QString> > items = uri.queryItems();
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
bool fShouldReturnFalse = false;
if (i->first.startsWith("req-"))
{
i->first.remove(0, 4);
fShouldReturnFalse = true;
}
if (i->first == "label")
{
rv.label = i->second;
fShouldReturnFalse = false;
}
else if (i->first == "amount")
{
if(!i->second.isEmpty())
{
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
{
return false;
}
}
fShouldReturnFalse = false;
}
if (fShouldReturnFalse)
return false;
}
if(out)
{
*out = rv;
}
return true;
}
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
{
// Convert bitcoin:// to bitcoin:
//
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
// which will lower-case it (and thus invalidate the address).
if(uri.startsWith("limecoinlite://"))
{
uri.replace(0, std::string("limecoinlite://").length(), "limecoinlite:");
}
QUrl uriInstance(uri);
return parseBitcoinURI(uriInstance, out);
}
QString HtmlEscape(const QString& str, bool fMultiLine)
{
QString escaped = Qt::escape(str);
if(fMultiLine)
{
escaped = escaped.replace("\n", "<br>\n");
}
return escaped;
}
QString HtmlEscape(const std::string& str, bool fMultiLine)
{
return HtmlEscape(QString::fromStdString(str), fMultiLine);
}
void copyEntryData(QAbstractItemView *view, int column, int role)
{
if(!view || !view->selectionModel())
return;
QModelIndexList selection = view->selectionModel()->selectedRows(column);
if(!selection.isEmpty())
{
// Copy first item (global clipboard)
QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Clipboard);
// Copy first item (global mouse selection for e.g. X11 - NOP on Windows)
QApplication::clipboard()->setText(selection.at(0).data(role).toString(), QClipboard::Selection);
}
}
QString getSaveFileName(QWidget *parent, const QString &caption,
const QString &dir,
const QString &filter,
QString *selectedSuffixOut)
{
QString selectedFilter;
QString myDir;
if(dir.isEmpty()) // Default to user documents location
{
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
}
else
{
myDir = dir;
}
QString result = QFileDialog::getSaveFileName(parent, caption, myDir, filter, &selectedFilter);
/* Extract first suffix from filter pattern "Description (*.foo)" or "Description (*.foo *.bar ...) */
QRegExp filter_re(".* \\(\\*\\.(.*)[ \\)]");
QString selectedSuffix;
if(filter_re.exactMatch(selectedFilter))
{
selectedSuffix = filter_re.cap(1);
}
/* Add suffix if needed */
QFileInfo info(result);
if(!result.isEmpty())
{
if(info.suffix().isEmpty() && !selectedSuffix.isEmpty())
{
/* No suffix specified, add selected suffix */
if(!result.endsWith("."))
result.append(".");
result.append(selectedSuffix);
}
}
/* Return selected suffix if asked to */
if(selectedSuffixOut)
{
*selectedSuffixOut = selectedSuffix;
}
return result;
}
Qt::ConnectionType blockingGUIThreadConnection()
{
if(QThread::currentThread() != qApp->thread())
{
return Qt::BlockingQueuedConnection;
}
else
{
return Qt::DirectConnection;
}
}
bool checkPoint(const QPoint &p, const QWidget *w)
{
QWidget *atW = QApplication::widgetAt(w->mapToGlobal(p));
if (!atW) return false;
return atW->topLevelWidget() == w;
}
bool isObscured(QWidget *w)
{
return !(checkPoint(QPoint(0, 0), w)
&& checkPoint(QPoint(w->width() - 1, 0), w)
&& checkPoint(QPoint(0, w->height() - 1), w)
&& checkPoint(QPoint(w->width() - 1, w->height() - 1), w)
&& checkPoint(QPoint(w->width() / 2, w->height() / 2), w));
}
void openDebugLogfile()
{
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
/* Open debug.log with the associated application */
if (boost::filesystem::exists(pathDebug))
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromStdString(pathDebug.string())));
}
ToolTipToRichTextFilter::ToolTipToRichTextFilter(int size_threshold, QObject *parent) :
QObject(parent), size_threshold(size_threshold)
{
}
bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
{
if(evt->type() == QEvent::ToolTipChange)
{
QWidget *widget = static_cast<QWidget*>(obj);
QString tooltip = widget->toolTip();
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt/>") && !Qt::mightBeRichText(tooltip))
{
// Prefix <qt/> to make sure Qt detects this as rich text
// Escape the current message as HTML and replace \n by <br>
tooltip = "<qt/>" + HtmlEscape(tooltip, true);
widget->setToolTip(tooltip);
return true;
}
}
return QObject::eventFilter(obj, evt);
}
#ifdef WIN32
boost::filesystem::path static StartupShortcutPath()
{
return GetSpecialFolderPath(CSIDL_STARTUP) / "LimecoinLite.lnk";
}
bool GetStartOnSystemStartup()
{
// check for Bitcoin.lnk
return boost::filesystem::exists(StartupShortcutPath());
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
// If the shortcut exists already, remove it for updating
boost::filesystem::remove(StartupShortcutPath());
if (fAutoStart)
{
CoInitialize(NULL);
// Get a pointer to the IShellLink interface.
IShellLink* psl = NULL;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
CLSCTX_INPROC_SERVER, IID_IShellLink,
reinterpret_cast<void**>(&psl));
if (SUCCEEDED(hres))
{
// Get the current executable path
TCHAR pszExePath[MAX_PATH];
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
TCHAR pszArgs[5] = TEXT("-min");
// Set the path to the shortcut target
psl->SetPath(pszExePath);
PathRemoveFileSpec(pszExePath);
psl->SetWorkingDirectory(pszExePath);
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
psl->SetArguments(pszArgs);
// Query IShellLink for the IPersistFile interface for
// saving the shortcut in persistent storage.
IPersistFile* ppf = NULL;
hres = psl->QueryInterface(IID_IPersistFile,
reinterpret_cast<void**>(&ppf));
if (SUCCEEDED(hres))
{
WCHAR pwsz[MAX_PATH];
// Ensure that the string is ANSI.
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH);
// Save the link by calling IPersistFile::Save.
hres = ppf->Save(pwsz, TRUE);
ppf->Release();
psl->Release();
CoUninitialize();
return true;
}
psl->Release();
}
CoUninitialize();
return false;
}
return true;
}
#elif defined(LINUX)
// Follow the Desktop Application Autostart Spec:
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
boost::filesystem::path static GetAutostartDir()
{
namespace fs = boost::filesystem;
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
if (pszConfigHome) return fs::path(pszConfigHome) / "autostart";
char* pszHome = getenv("HOME");
if (pszHome) return fs::path(pszHome) / ".config" / "autostart";
return fs::path();
}
boost::filesystem::path static GetAutostartFilePath()
{
return GetAutostartDir() / "limecoinlite.desktop";
}
bool GetStartOnSystemStartup()
{
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
if (!optionFile.good())
return false;
// Scan through file for "Hidden=true":
std::string line;
while (!optionFile.eof())
{
getline(optionFile, line);
if (line.find("Hidden") != std::string::npos &&
line.find("true") != std::string::npos)
return false;
}
optionFile.close();
return true;
}
bool SetStartOnSystemStartup(bool fAutoStart)
{
if (!fAutoStart)
boost::filesystem::remove(GetAutostartFilePath());
else
{
char pszExePath[MAX_PATH+1];
memset(pszExePath, 0, sizeof(pszExePath));
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
return false;
boost::filesystem::create_directories(GetAutostartDir());
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
if (!optionFile.good())
return false;
// Write a bitcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
optionFile << "Name=LimecoinLite\n";
optionFile << "Exec=" << pszExePath << " -min\n";
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";
optionFile.close();
}
return true;
}
#else
// TODO: OSX startup stuff; see:
// https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html
bool GetStartOnSystemStartup() { return false; }
bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
#endif
HelpMessageBox::HelpMessageBox(QWidget *parent) :
QMessageBox(parent)
{
header = tr("LimecoinLite-Qt") + " " + tr("version") + " " +
QString::fromStdString(FormatFullVersion()) + "\n\n" +
tr("Usage:") + "\n" +
" limecoinlite-qt [" + tr("command-line options") + "] " + "\n";
coreOptions = QString::fromStdString(HelpMessage());
uiOptions = tr("UI options") + ":\n" +
" -lang=<lang> " + tr("Set language, for example \"de_DE\" (default: system locale)") + "\n" +
" -min " + tr("Start minimized") + "\n" +
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n";
setWindowTitle(tr("LimecoinLite-Qt"));
setTextFormat(Qt::PlainText);
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
setText(header + QString(QChar(0x2003)).repeated(50));
setDetailedText(coreOptions + "\n" + uiOptions);
}
void HelpMessageBox::printToConsole()
{
// On other operating systems, the expected action is to print the message to the console.
QString strUsage = header + "\n" + coreOptions + "\n" + uiOptions;
fprintf(stdout, "%s", strUsage.toStdString().c_str());
}
void HelpMessageBox::showOrPrint()
{
#if defined(WIN32)
// On Windows, show a message box, as there is no stderr/stdout in windowed applications
exec();
#else
// On other operating systems, print help text to console
printToConsole();
#endif
}
} // namespace GUIUtil
| stamhe/LimecoinLite | src/qt/guiutil.cpp | C++ | mit | 13,654 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.