書式保持メモ †
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'production': {
'format': '%(asctime)s [%(levelname)s] %(process)d %(thread)d '
'%(pathname)s:%(lineno)d %(message)s'
},
},
'handlers': {
'file': {
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/var/log/django/django.log',
'formatter': 'production',
# 'level': 'INFO',
'when': 'D',
'interval': 1,
'backupCount': 14,
},
},
'loggers': {
'': {
'handlers': ['file'],
# 'level': 'INFO',
'propagate': False,
},
'django': {
'handlers': ['file'],
# 'level': 'INFO',
'propagate': False,
},
},
import sys
import os
import glob
import random
import shutil
import errno
args = sys.argv
try:
os.makedirs( "./test" )
os.makedirs( "./train" )
os.makedirs( "./valid" )
except OSError as e:
if e.errno != errno.EEXIST:
raise e
fileList = glob.glob( "./*.mid*" )
#print( "hello" )
#print( args[1] )
for file in fileList:
randNum = random.randint(0,11)
if 0 == randNum:
shutil.copy( file, "./test" )
elif 1 == randNum:
shutil.copy( file, "./valid" )
else:
shutil.copy( file, "./train" )
sys.exit()
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main( void )
{
int rtnCod = 0;
char strArr[10][9] = { "", };
int intArr[10] = { 0, };
int cnt = 0;
int num = 0;
srand( (unsigned int)time( NULL ) );
for( cnt = 0; 10 > cnt; cnt++ )
{
intArr[cnt] = rand();
printf( "%x\r\n", intArr[cnt] );
snprintf( strArr[cnt], 9, "%x", intArr[cnt] );
printf( "%s\r\n", strArr[cnt] );
num = strtol( strArr[cnt], NULL, 16 );
printf( "%x\r\n", num );
}
return( rtnCod );
}
#include <stdio.h>
#include <sys/stat.h>
//#include <time.h>
#include <stdlib.h>
int main( void )
{
int rtnCod = 0;
int cnt = 0;
int num = 0;
int bBuf = 0;
int eBuf = 0;
int fSize = 0;
FILE* INFO = NULL;
struct stat st; /* for stat() */
char *inBuf; /* メモリ作業領域 */
char fileName[8] = "./a.gem";
char word[9] = "";
stat( fileName, &st );
fSize = st.st_size;
inBuf = (char*)malloc( fSize );
INFO = fopen( fileName, "r");
fread( inBuf, sizeof(char), fSize, INFO );
fclose( INFO );
// printf( "%s\n--end--\n", inBuf );
for( cnt = 0; fSize > cnt; cnt++ )
{
if( ' ' == inBuf[cnt] )
{
eBuf = cnt + 1;
snprintf( word, eBuf - bBuf, "%s", &(inBuf[bBuf]) );
bBuf = cnt + 1;
num = strtol( word, NULL, 16 );
printf( "%x\n", num );
}
}
free( inBuf );
return( rtnCod );
}