diff --git a/app/controllers/volume_controller.rb b/app/controllers/volume_controller.rb index c76c8e2..88d2d4f 100644 --- a/app/controllers/volume_controller.rb +++ b/app/controllers/volume_controller.rb @@ -24,7 +24,6 @@ class VolumeController < ApplicationController else String state = (df.include? volume['Volume Name'].delete(' ')) ? "mounted" : "unmounted" volume['Mount State'] = state - if state.eql? "mounted" s = df.split("\n") s.each do |t| @@ -34,7 +33,6 @@ class VolumeController < ApplicationController end end end - @volumes << volume volume = Hash.new end @@ -70,21 +68,13 @@ class VolumeController < ApplicationController end end mnt_dest = mnt_dir + "/" + file.original_filename - - puts "upload start" - # get permission -# dir_left = mnt_dir[0..mnt_dir.rindex('/')] -# dir_right = mnt_dir.split(dir_left)[1] -# pe = `ls -al #{dir_left} | grep #{dir_right}`.split(" ")[0] - -# puts "111" + dir_left -# puts "222" + dir_right -# puts "333" + pe - + # change permission + command = String.new + command << "sudo chmod 777 " + mnt_dir + puts command + `#{command}` u = AvatarUploader.new(mnt_dir) u.store!(file) - puts "upload end" - redirect_to '/volume/index' end diff --git a/app/uploaders/avatar_uploader.rb b/app/uploaders/avatar_uploader.rb index 0a81dca..7d9da63 100644 --- a/app/uploaders/avatar_uploader.rb +++ b/app/uploaders/avatar_uploader.rb @@ -11,14 +11,14 @@ class AvatarUploader < CarrierWave::Uploader::Base # storage :fog @path - def initialize(dest = "/mnt/dir") + def initialize(dest) super @path = dest end # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: - def cache_dir + def store_dir @path end diff --git a/public/uploads/tmp/1473923269-10904-0001-1439/1366.cpp b/public/uploads/tmp/1473923269-10904-0001-1439/1366.cpp deleted file mode 100644 index 77c9499..0000000 --- a/public/uploads/tmp/1473923269-10904-0001-1439/1366.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#define min(a,b) ((a)<(b)?(a):(b)) - -using namespace std; -const int MAX_N = 6; -const int INF = 1e9; -const char interval[12][3] - = {"A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"}; -int n, m; -int str[MAX_N]; -int tune[MAX_N]; -int music[MAX_N]; -int difficulty[MAX_N]; - -/* -6 3 -E A D G B E -E G# B -6 3 -E E B G# B E -E G# B -6 3 -E E G# B A A -E G# B -6 3 -E E G# B B A -E G# B -6 3 -A A A A A A -E G# B -*/ - -int solve(int x) -{ - if(x == n) - { - int cnt = 0; - bool chk[6] = {false}; - - for(int i = 0; i < n; ++i) - { - bool is_harmony = false; - - for(int j = 0; j < m; ++j) - { - if(str[i] == music[j]) - { - chk[j] = true; - is_harmony = true; - } - } - - if(!is_harmony) return INF; - } - - for(int i = 0; i < m; ++i) - if(!chk[i]) return INF; - - int high = 0, low = INF; - - for(int i = 0; i < n; ++i) - { - if(tune[i] == str[i]) continue; - ++cnt; - - int diff = min((tune[i] - str[i] + 12) % 12, (str[i] - tune[i] + 12) % 12); - - if(high < diff) high = diff; - if(low > diff) low = diff; - } - - if(!cnt) return 0; - if(cnt == 1) return high + 1; - return high - low + 1; - } - - int ret = INF; - - for(int i = 0; i < 12; ++i) - { - str[x] = i; - int tmp = solve(x + 1); - ret = min(ret, tmp); - } - - return ret; -} - -void get(int *cord) -{ - char in[3]; cin >> in; - for(int i = 0; i < 12; ++i) - if(!strcmp(in, interval[i])) *cord = i; -} - -void proc() -{ - cin >> n >> m; - for(int i = 0; i < n; ++i) get(&tune[i]); - for(int i = 0; i < m; ++i) get(&music[i]); - - if(!n || !m) {cout << 0; return;} - - cout << solve(0) << "\n"; -} - -int main() -{ - proc(); - return 0; -} diff --git a/public/uploads/tmp/1473923499-10904-0002-5947/1366.cpp b/public/uploads/tmp/1473923499-10904-0002-5947/1366.cpp deleted file mode 100644 index 77c9499..0000000 --- a/public/uploads/tmp/1473923499-10904-0002-5947/1366.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#define min(a,b) ((a)<(b)?(a):(b)) - -using namespace std; -const int MAX_N = 6; -const int INF = 1e9; -const char interval[12][3] - = {"A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"}; -int n, m; -int str[MAX_N]; -int tune[MAX_N]; -int music[MAX_N]; -int difficulty[MAX_N]; - -/* -6 3 -E A D G B E -E G# B -6 3 -E E B G# B E -E G# B -6 3 -E E G# B A A -E G# B -6 3 -E E G# B B A -E G# B -6 3 -A A A A A A -E G# B -*/ - -int solve(int x) -{ - if(x == n) - { - int cnt = 0; - bool chk[6] = {false}; - - for(int i = 0; i < n; ++i) - { - bool is_harmony = false; - - for(int j = 0; j < m; ++j) - { - if(str[i] == music[j]) - { - chk[j] = true; - is_harmony = true; - } - } - - if(!is_harmony) return INF; - } - - for(int i = 0; i < m; ++i) - if(!chk[i]) return INF; - - int high = 0, low = INF; - - for(int i = 0; i < n; ++i) - { - if(tune[i] == str[i]) continue; - ++cnt; - - int diff = min((tune[i] - str[i] + 12) % 12, (str[i] - tune[i] + 12) % 12); - - if(high < diff) high = diff; - if(low > diff) low = diff; - } - - if(!cnt) return 0; - if(cnt == 1) return high + 1; - return high - low + 1; - } - - int ret = INF; - - for(int i = 0; i < 12; ++i) - { - str[x] = i; - int tmp = solve(x + 1); - ret = min(ret, tmp); - } - - return ret; -} - -void get(int *cord) -{ - char in[3]; cin >> in; - for(int i = 0; i < 12; ++i) - if(!strcmp(in, interval[i])) *cord = i; -} - -void proc() -{ - cin >> n >> m; - for(int i = 0; i < n; ++i) get(&tune[i]); - for(int i = 0; i < m; ++i) get(&music[i]); - - if(!n || !m) {cout << 0; return;} - - cout << solve(0) << "\n"; -} - -int main() -{ - proc(); - return 0; -} diff --git a/public/uploads/tmp/1473923531-10904-0003-1499/1475.cpp b/public/uploads/tmp/1473923531-10904-0003-1499/1475.cpp deleted file mode 100755 index d8e3af3..0000000 --- a/public/uploads/tmp/1473923531-10904-0003-1499/1475.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#define max(a,b) ((a)<(b)?(b):(a)) - -int main() -{ - int counter[10] = {0}; - char number[100]; - - scanf("%s", number); - - int len = strlen(number); - for(int i = 0; i -#include -#include -#include - -using namespace std; -const int MAX_N = 100; -const int INF = 1000000007; -const int dy[] = {0, 0, 1, -1}; -const int dx[] = {1, -1, 0, 0}; -int n, m; -char maze[MAX_N+2][MAX_N+2]; -int dist[MAX_N+2][MAX_N+2]; - -int solve() -{ - for(int i = 0; i < n; ++i) - for(int j = 0; j < m; ++j) - dist[i][j] = INF; - queue > q; - q.push(make_pair(0, 0)); - dist[0][0] = 0; - - while(!q.empty()) - { - int y = q.front().first; - int x = q.front().second; - q.pop(); - - for(int i = 0; i < 4; ++i) - { - int ny = y + dy[i]; - int nx = x + dx[i]; - - if(ny >= 0 && ny < n && - nx >= 0 && nx < m && - (dist[ny][nx] > dist[y][x] + (maze[ny][nx] == '1'))) - { - dist[ny][nx] = dist[y][x] + (maze[ny][nx] == '1'); - q.push(make_pair(ny, nx)); - } - } - } - - return dist[n - 1][m - 1]; -} - -void proc() -{ - cin >> m >> n; - for(int i = 0; i < n; ++i) - cin >> maze[i]; - cout << solve() << endl; -} - -int main() -{ - proc(); - return 0; -} diff --git a/public/uploads/제10회_공개SW_개발자대회_심사기준_안내.pdf b/public/uploads/제10회_공개SW_개발자대회_심사기준_안내.pdf deleted file mode 100644 index e4046e0..0000000 Binary files a/public/uploads/제10회_공개SW_개발자대회_심사기준_안내.pdf and /dev/null differ