public static class time
{
public const int minutes_per_hour = 60;
public const int seconds_per_minute = 60;
public const int hours_per_day = 24;
public const int minutes_per_day = minutes_per_hour * hours_per_day;
public const int seconds_per_day = seconds_per_minute * minutes_per_day;
public const int days_per_year = 365;
}
# Better off alone
use_bmp 137
live_loop :drumrolls do
sample : drum_splash_soft, rate: 0.775, finsh: 0.75, amp: 0.75
use_synth :pnosie
with_fx :1x1_techno, phase: 8, phase_offset: 0.4,cutoff_min: 79, cutoff
with_fx :fhpf, cutoff: 115, res: 0.8, reps: 18 do
play :E1, release: 0.125
sleep 0.25
end
end
sleep 47.5
with_fx :ixi_techno, phase: 29 res: 0.5 re
use_rx_synth :mod_dsaw
live_loop :wierd_synth do re mi
Do sleep 0.3 then sample :sn_dolf, :amp 0.2 start 0.1 next finish: 1.5 do
public static returnTrue(boolean b){
if (b){
return true;
} else {
return true;
}
}
When you want your function always returns the correct value
foreach ($desired_components as $name => $junk) {
list($component_value, $component_comments) = self::unpackPair($desired_components[$name]);
$desired_components[$name] = self::packPair(round($component_value, 2), $component_comments);
}
public static Integer find(List<String> list, String name, int i) {
if(list.get(i).equals(name)) {
return i;
}
else return find(list, name, i+1)
}
if ((&inactiveSlot)->GetFirstSlot() == RuntimeLib::INVALID_SLOT) {
Dot dude...
if (!rtrId.isPresent()) {
...
} else if (identityId.isPresent() && rtrId.isPresent()) {
...
}
A treasured knife protects
nohup find dump_events/* -type f -name "*.jpg" -exec bash -c "cp -v {} \"backup_events/\`ls {} --full-time --time-style="+%Y-%m-%d_%H-%M-%S" | cut -d ' ' -f 6 \`_\`md5sum {} | cut -d ' ' -f 1\`.jpg\";" \; &
Let's do this... I may also add this... And this... And that... And the other thing there... Then calculate how flat the earth is... But in one line!
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
void run_func(char *map[], char *fnt , char *km , float *x , float *y , int line , int row , int lift );
char *long_met[3][8] = {{"mile","0.621371" , "yard","1093.61" , "fut","3280.84" , "duim","39370.1" } ,
{ "mile" ,"1.60934" , "yard","0.0009144" , "fut","0.0003048" , "duim","0.0000254"},
{"kilometer","1" , "meter","1000" , "stmeter","100000" , "mmeter","1000000" } };
char *amount[3][4] = { { "gallon" , "0.264172" , "quarta" , "1.05669" } ,
{"gallon" , " 3.78541" , "quarta" , "0.946353" },
{"litr" , "1" , "mililitr" , "1000" }};
char *mass[3][8] = { {"eng.tonna","0.984207" , "amer.tonna","1.10231" , "stone","157.473" , "funt","2204.62" } ,
{ "eng.tonna" , "1.01605" , "amer.tonna", "0.907185" , "stone","0.00635029" , "funt","0.000453592"},
{"tonna","1" , "kilogram" , "1000" , "miligram","100000" , "microgram","1000000" }};
char **cp;
char *buf_data;
char *fnt_sys;
char *mtr_sys;
char *word[100];
while(1){
int bg = 0,convert_ch = 3,y = 0, d = 0, numb = 0;
float mn =0 , xm = 0 ;
printf("%s", "enter data for converter: ");
fgets( (char *) word, 99 ,stdin);
buf_data = strtok((char *) word, " ");
if( ! strcmp(buf_data, "funt.sys" ) ){
convert_ch = 0;
}
else if( ! strcmp(buf_data, "metric.sys" ) ){
convert_ch = 1;
}
for( bg = 0 ; buf_data != NULL; buf_data = strtok(NULL, " ") , bg++ ) {
switch(bg){
case 1:
if( !strcmp("long_met" , buf_data ) ){
y = sizeof(*long_met) / sizeof(long_met[0][0]);
d = sizeof(long_met) / sizeof(long_met[0][0]);
cp = &long_met[convert_ch][0] ;
}
else if(!strcmp("amount" , buf_data ) ){
y = sizeof(*amount) / sizeof(amount [0][0]);
d = sizeof(amount) / sizeof(amount[0][0]);
cp = &amount[convert_ch][0] ;
}
else if(!strcmp("mass" , buf_data ) ){
y = sizeof(*mass ) / sizeof(mass[0][0]);
d = sizeof(mass ) / sizeof(mass[0][0]);
cp = &mass[convert_ch][0] ;
}
break;
case 2:
fnt_sys = buf_data;
break;
case 3:
mtr_sys = buf_data;
break;
case 4:
numb = atoi(buf_data);
break;
}
}
if( !y || !d || !cp || convert_ch == 3 || !numb ){
puts("error");
}
else{
run_func( cp, fnt_sys , mtr_sys , &mn , &xm , y , d , convert_ch );
if( !mn || !xm ){
puts("error");
} else{
printf("%f\n" , !convert_ch ? (mn / xm ) * numb : ( mn * xm ) * numb );
}
}
}
return 0;
}
void run_func(char *map[], char *fnt , char *km , float *x , float *y , int line , int row , int lift ){
int m ;
if( ( lift ) ){
row -= line;
}
for( m = 0 ; m <= line ; m++){
if(!strcmp(fnt,map[m])){
*x = atof(map[m + 1] ) ;
break;
}
}
for( m = (row - line) ; m <= row - 1 ; m++){
if( !strcmp( km , map[m] ) ){
*y = atof(map[m + 1 ] );
break;
}
}
}
double zuida(std::vector<double> vec) {
std::vector<double> temp;
for(int i = 0; i < vec.size(); i++)
temp.push_back(vec[i]);
notend:
if(temp.size() > 0) {
if(temp.size() < 2) {
double tmp = *(&temp[0]);
return tmp;
}
else if(temp.size() >= 2) {
double mini = temp[0];
int ind = 0;
for(int i = 0; i < temp.size(); i++)
if(temp[i] < mini) {
mini = temp[i];
ind = i;
}
temp.erase(temp.begin() + ind);
goto notend;
}
}
}
The beauty is that every case is the best (also worst) case!
$options.splice($options.indexOf('option7'), 1);
$options.splice($options.indexOf('option5'), 1);
$options.splice($options.indexOf('option4'), 1);
$options.splice($options.indexOf('option3'), 1);
$options.splice($options.indexOf('option2'), 1);
$options.splice($options.indexOf('option1'), 1);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (android.os.Build.VERSION.SDK_INT > 9) {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
}
fileObjectDAO = new FileObjectDAO(this);
iv = (ImageView)findViewById(R.id.imageView);
tv = (TextView)findViewById(R.id.textView);
centerImageView = (ImageButton)findViewById(R.id.imageButton);
leftText = (TextView)findViewById(R.id.textView2);
rightText = (TextView)findViewById(R.id.textView3);
leftArrow = (TextView)findViewById(R.id.textView4);
rightArrow = (TextView)findViewById(R.id.textView9);
leftCancel = (ImageButton)findViewById(R.id.imageButton2);
displayWelcome1 = (TextView)findViewById(R.id.textView5);
displayWelcome2 = (TextView)findViewById(R.id.textView6);
rightCancel = (ImageButton)findViewById(R.id.imageButton3);
seatButton = (ImageButton)findViewById(R.id.imageButton4);
waitButton = (ImageButton)findViewById(R.id.imageButton5);
clearButton = (ImageButton)findViewById(R.id.imageButton6);
enityButton = (ImageButton)findViewById(R.id.imageButton7);
bookButton = (ImageButton)findViewById(R.id.imageButton8);
settingButton = (ImageButton)findViewById(R.id.imageButton9);
displatSeat = (TextView)findViewById(R.id.textView7);
displatSeatNumber = (TextView)findViewById(R.id.textView8);
isClearing = false;
hidenAll();
key1 = 0;
key2 = 0;
key3 = 0;
isError = false;
isWaiting = false;
myTTS = new TapiaTTS(this);
myhandler = new Tapiahandler();
mySTT = new TapiaSTT(this,myhandler,false);
isResume = false;
tapiaAnimation = new TapiaAnimation(this);
liveData.add("愛媛");
liveData.add("松山");
liveData.add("今治");
liveData.add("高知");
liveData.add("福岡");
liveData.add("北九州");
liveData.add("佐賀");
liveData.add("長崎");
liveData.add("熊本");
liveData.add("大分");
liveData.add("別府");
liveData.add("宮崎");
liveData.add("高千穂");
liveData.add("鹿児島");
liveData.add("奄美大島");
liveData.add("屋久島");
liveData.add("沖縄");
liveData.add("那覇");
liveData.add("北海道");
liveData.add("札幌");
liveData.add("函館");
liveData.add("室蘭");
liveData.add("浦河");
liveData.add("旭川");
liveData.add("留萌");
liveData.add("稚内");
liveData.add("網走");
liveData.add("帯広");
liveData.add("登別");
liveData.add("知床");
liveData.add("釧路");
liveData.add("根室");
liveData.add("青森");
liveData.add("岩手");
liveData.add("盛岡");
liveData.add("秋田");
liveData.add("宮城");
liveData.add("仙台");
liveData.add("松島");
liveData.add("泉");
liveData.add("登米");
liveData.add("佐沼");
liveData.add("山形");
liveData.add("福島");
liveData.add("郡山");
liveData.add("茨城");
liveData.add("水戸");
liveData.add("栃木");
liveData.add("日光");
liveData.add("宇都宮");
liveData.add("群馬");
liveData.add("前橋");
liveData.add("高崎");
liveData.add("埼玉");
liveData.add("千葉");
liveData.add("成田");
liveData.add("木更津");
liveData.add("船橋");
liveData.add("松戸");
liveData.add("東京");
liveData.add("銀座");
liveData.add("浅草");
liveData.add("池袋");
liveData.add("上野");
liveData.add("新宿");
liveData.add("渋谷");
liveData.add("品川");
liveData.add("巣鴨");
liveData.add("八王子");
liveData.add("神奈川");
liveData.add("横浜");
liveData.add("川崎");
liveData.add("横須賀");
liveData.add("相模原");
liveData.add("山梨");
liveData.add("甲府");
liveData.add("新潟");
liveData.add("佐渡");
liveData.add("富山");
liveData.add("石川");
liveData.add("金沢");
liveData.add("福井");
liveData.add("長野");
liveData.add("軽井沢");
liveData.add("松本");
liveData.add("岐阜");
liveData.add("飛騨高山");
liveData.add("静岡");
liveData.add("富士");
liveData.add("浜松");
liveData.add("愛知");
liveData.add("名古屋");
liveData.add("三重");
liveData.add("伊勢");
liveData.add("津");
liveData.add("滋賀");
liveData.add("大津");
liveData.add("京都");
liveData.add("大阪");
liveData.add("堺");
liveData.add("東大阪");
liveData.add("兵庫");
liveData.add("神戸");
liveData.add("姫路");
liveData.add("奈良");
liveData.add("和歌山");
liveData.add("鳥取");
liveData.add("島根");
liveData.add("出雲");
liveData.add("松江");
liveData.add("岡山");
liveData.add("広島");
liveData.add("福山");
liveData.add("山口");
liveData.add("下関");
liveData.add("徳島");
liveData.add("香川");
liveData.add("高松");
try {
SN = getSerialNumber();
}catch (Exception e){
SN = "mji123456";
}
//
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread paramThread, Throwable paramThrowable) {
myHandaling(paramThread, paramThrowable);
}
});
connectFtp();
tapiaGet = new TapiaGetJson();
setWalkpaper();
// longPressRunnable = new Runnable() {
// public void run() {
// if(currentMode.equalsIgnoreCase("talk")){
// myTTS.stopSpeak();
// mySTT.stop();
// checkHandler98_BLUE.removeCallbacks(checkRunnable98_BLUE);
// isListen = false;
// tapiaAnimation.playColor1(1);
// String [] SpeakArray = {"またあとでね", "またね", "あとでね", "ちょっとひとやすみ", "休憩するね"};
// Random ran = new Random();
// int index = ran.nextInt(SpeakArray.length);
// String toSpeak = SpeakArray[index];
// //Toast.makeText(getApplicationContext(), toSpeak,Toast.LENGTH_SHORT).show();
// myTTS.TapiaSpeak(toSpeak);
// //iv.setImageResource(R.drawable.black);
// myTTS.player.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
//
// @Override
// public void onCompletion(MediaPlayer mp) {
//// Intent intent = new Intent(context, StartActivity.class);
//// startActivity(intent);
// count98 =0;
// checkStateHander.postDelayed(checkStateRunnable,5000);
// handler98.postDelayed(runnable98,800);
// setSleepMode();
// }
//
// });
// }else if(currentMode.equalsIgnoreCase("sleep")){
// setTalkingMode();
// checkStateHander.removeCallbacks(checkStateRunnable);
// handler98.removeCallbacks(runnable98);
// needForHelp("なにかご用ですか?");
// }
// }
// };
//
createDirIfNotExists("/sdcard/TapiaData/Send/");
createDirIfNotExists("/sdcard/TapiaData/Receive/");
public void run() {
Log.d("Tapia","Check 98");
if(count98==0){
boolean check = false;
boolean check2 = false;
String path = "/Tapia/"+seatNumber+"/";
allFileName = ftpPrintFilesList(path);
if(allFileName.size()==0){
}else{
for(String filename :allFileName){
if(filename.endsWith("98.trg")){
if(!fileObjectDAO.checkFileExit(filename)){
fileObjectDAO.addFile(filename);
isDelete = true;
check = true;
Log.e("checking","98");
ftpDownload(path + filename, "/sdcard/TapiaData/Receive/" + filename);
break;
}
}
}
}
if(!check){
path = "/Tapia/ALL/";
allFileName = ftpPrintFilesList(path);
if(allFileName.size()==0){
}else{
for(String filename :allFileName){
if(filename.endsWith("98.trg")){
if(!fileObjectDAO.checkFileExit(filename)){
fileObjectDAO.addFile(filename);
isDelete = true;
check2 = true;
ftpDownload(path+filename,"/sdcard/TapiaData/Receive/"+filename);
break;
}
}
}
}
}
count98++;
handler98.postDelayed(this, 1000);
}else{
count98++;
if(count98==10)count98=0;
handler98.postDelayed(this, 1000);
}
}
};
Trust me it works!!!
PS. This is 300 out of 3000 lines from one Class
public class MetricsChecker
{
protected const string AwaitingRecognitionCountMetricName = "AwaitingRecognitionCount";
protected const string AwaitingExportCountMetricName = "AwaitingExportCount";
protected const string NotYetDownloadedEventCountMetricName = "NotYetDownloadedEventCount";
...
public virtual void PublishNotYetDownloadedEventCounts()
{
this.logger.Trace($"Starting to gather and publish {NotYetDownloadedEventCountMetricName}(s).");
...
}
...
}
// What they did:
var serverCommands = {};
for(var each in commandList.general)
(dmCommands[commandList.general[each].type] ? dmCommands[commandList.general[each].type] +=
(config.prefix + each + (commandList.general[each].args ? ' ' + commandList.general[each].args : '') +
': ' + commandList.general[each].description + '\n') : (dmCommands[commandList.general[each].type] =
'\u200B'+ config.prefix + each + (commandList.general[each].args ? ' ' + commandList.general[each].args : '') +
': ' + commandList.general[each].description + '\n'))
// What they should've done:
let srvrCmds = new Map();
let gldCmds = commandList[message.guild.id];
for (let each in gldCmds) {
const cur = gldCmds[each];
const text = `${config.prefix + each + (cur.args ? " " + cur.args : "")}: ${cur.description}\n`;
const srvrCmdType = srvrCmds.get(cur.type);
srvrCmds.set(cur.type, (srvrCmdType || "\u200B") + text);
}
if HOST == 'AdaLovelace' or HOST == 'vbu' or HOST == 'asus':
urlpatterns += patterns('',
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': MEDIA_ROOT}),
)