Some days ago I described the steps involved in configuring a CentOS WebServer VM with virtual hosts here manually. In this post I will describe the steps involved to install Webmin .
Creating a repository file for Webmin
cd /etc/yum.repos.d/
sudo vi webmin.repo
[Webmin]
name=Webmin Distribution Neutral
#baseurl=http://download.webmin.com/download/yum
mirrorlist=http://download.webmin.com/download/yum/mirrorlist
enabled=1
At the time of writing the Stack is running on Ubuntu 14.04 which can be downloaded from here. Since it is 64Bit make sure that Visualization is enabled in the bios settings.
Import the VM in VMware Player or Virtual box, make sure that the network settings are configured correctly so that the VM gets an IP accessible from the host machine. I personally configured it to Bridged Adapter for this exercise and have a habit of Regenerating the MAC Address.
If the VM does not get assigned an IP the configuration is wrong and I wouldn’t bother trying to fix it from inside the VM (you could) but I rather fix it from the hyper-visor settings because the stack is pre-configured to work.
Login and change password
Visit the IP in the browser to check if it is working in my case http://192.168.101.12
Enabling Laravel
Bitnami LAMP Stack comes with several pre-configured frameworks of which all are disabled by default. One must enable the framework that is required. ( I am nto sure if you can enable more than one at the same time)
Steps:
cd /opt/bitnami/apache2/conf/bitnami
sudo vi bitnami-apps-prefix.conf
Remove the hash from laravel’s line and save and close :wq
Restart Apache
sudo /opt/bitnami/ctlscript.sh restart apache
The location where Laravel apps Live is
/opt/bitnami/frameworks/laravel/app/http
Browser URL
http://192.168.101.12/laravel/ where 192.168.101.12 is your VM’s IP
Configuring FTP
Enabling FTP for easy editing/upload of files ( Note this is a development machine for experimentation so I will not go on explaining issues with FTP and security, but you should consider reading about the risks. )
sudo vi /etc/vsftpd.conf
go to the bottom of the file and change
listen_address=127.0.0.1
to
listen_address=0.0.0.0
:wq
Allow connections to port 21 (FTP port)
sudo ufw allow 21
Restart FTP
sudo service vsftpd restart
Change bitnamiftp password
sudo passwd bitnamiftp
Configure Filezilla
Connected
Now you may play around with Laravel through FTP 🙂
Let external connections to MySQL
1)
cd /opt/bitnami/mysql
sudo vi my.cnf
Comment out
bind-address = 127.0.0.1
by putting a # infront of it and Esc :wq
2)
mysql -u root -p
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option
To me this seemed like a base64 encoded string prefixed with Stage 2: meant I somehow solved the first Stage. Not being satisfied I decided to decompile the class back to java which produced the following code:
There is a conditional looking for a file named gotostage2.txt, so in reality the first stage was to create an empty text file named gotostage2.txt and execute the run_me.bat.
another fact seems like that from “STAGE 1 COMPLETE! 4 STAGES LEFT!” this competition has 5 stages.
One of the most popular problems presented during the initial stages of IT recruitment is that of finding a place in a sequence of integers which divides it into two groups of equal sum, i.e., at a position where the sum of the prefix is equal to the sum of the suffix. Your task is to find this position.
Input
The first line contains exactly one numbert,representing the number of data sets. Each data setiis a single line, consisting of the sequence lengthmiand exactlymiintegers which form the sequence. Numbers in data sets are separated by spaces.
Output
For each data seti print the shortest possible length of the prefix for which the sum of elements is equal to the sum of elements of the determined suffix. If desired number does not exist, then print 0. Answers for data sets should be separated by new lines.
#include
int main(void) {
int instances;
scanf("%d", &instances);
int n;
int i;
for(i = 0 ; i < instances ; i++){
scanf("%d", &n);
int entries[n];
int j;
for(j = 0 ; j < n ; j++){
scanf("%d", &entries[j]);
}
int sumA[n-1];
int total = 0;
int k;
int flag1 =1;
for(k = 0 ; k <= n-2 ; k++){
if(entries[k] != entries[n-(k)]) // Check for palindrome
flag1=0;
total +=entries[k];
sumA[k] = total;
}
if(flag1 == 1 && entries[n/2] == entries[(n/2)-1])
return (n/2)-1;
total +=entries[n-1];
int flag = 1;
if(total%2 == 0){ // If it is odd it cannot be split
int j;
int tot2 = total/2;
for(j = 0 ; j <= n-2 ; j++){
if(sumA[j] == tot2){
printf("%d\n", j+1);
flag = 0;
break;
}
}
}
if(flag ==1)
printf("0\n");
}
return 0;
}
Your program is to use the brute-force approach in order tofind the Answer to Life, the Universe, and Everything.More precisely… rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at input are integers of one or two digits.
Example
Input:
1
2
88
42
99
Output:
1
2
88
Answer
#include
int main(void) {
int i;
while (scanf("%d", &i)==1){
if(i == 42) break;
printf("%d\n",i);
}
return 0;
}
There will be provided certain number of data sets for the problem. Each data set consist of two integer numbersaiandbiseparated with a space, whereiis the number of the data set. Data sets are separated with a new line.
Output
Forithdata set print the value ofai+bi. Answers should be separated with a new line.
In the first line there will be a number of the data setst. In the nexttlines data sets follows. Each data set is a line of numbers separated by spaces. First numberniis the length of the array. Nextninumbers are the values in array.
Output
Forithdata set write values from array in reversed order. Numbers should be separated by spaces and answers for data sets should be separated by a new line.
Every year Megabyteland hosts The Great Gluttony Festival. According to tradition, during the first day of the festival all participants eat cookies nonstop for 24 hours (with not even a fraction of a second’s break!). As soon as a glutton has finished eating one cookie, he immediately stars to eat the next one (this does not apply only to the situation at the end of the day, when the participant is not allowed to start eating a cookie if he knows that he cannot finish eating it before the end of the day). Another important part of the tradition is that each glutton eats a single cookie at his very own constant characteristic pace.
For the coming festival, the organizers have invited only those gluttons who have already participated in the previous editions. This means that the pace of each glutton is already known (they don’t really like to change their natural pace). Based on this data, the organizers of the festival want to determine how many cookies they need to buy. However, the cookies in the shop are sold in boxes of fixed size, thus they may have to buy more cookies than the number that is going to be eaten.
Your task is to establish the number of boxes with cookies that are needed to carry out the competition. The number of participants, along with the pace of each of them (given in seconds needed to eat a single cookie) will be given.
Input
The first line of input contains the number of test cases t. Each test case has the following form: two numbers N and M, separated by a space, in the first line (1 ≤ N ≤ 10000, 1 ≤ M ≤ 1000000000). The first number N is the number of invited gluttons and the second number M is the numbers of cookies in the box. Each line of the next N lines contains a single integer number, representing the pace of the glutton. The pace of the glutton is expressed as the number of seconds (not greater than 100000) needed to eat a single cookie.
Output
For each test case you need to write exactly one integer denoting the number of boxes which have to be bought by the organizers to carry out the contest. Answers for distinct test cases should be written in separate lines.
#include
#include
int main(void) {
int n;
int invites;
int nBox;
int i;
scanf("%d", &n);
for(i = 0 ; i < n ; i++){
scanf("%d %d", &invites,&nBox);
double total = 0;
int j;
for(j = 0 ; j < invites;j++){
int time;
scanf("%d",&time);
total += 86400/time;
}
printf("%d\n",(int)ceil(total/nBox));
}
return 0;
Python 2.7
import math
contestDuration = 86400
instances = int(raw_input())
for v in range(0,instances):
data = raw_input().split(" ") # Invited/Cookies
i = int(data[0])
cookies = int(data[1])
total = 0
for k in range(0,i):
total = total + contestDuration/int(raw_input())
print int(math.ceil(total/cookies))
Java 7
import java.util.*;
import java.lang.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
int instances = Integer.parseInt(r.readLine());
for(int k = 0 ; k < instances; k++){
String [] data = r.readLine().split("\\s+");
int invites = Integer.parseInt(data[0]);
double total = 0;
for(int i = 0 ; i < invites; i++){
total += 86400/Integer.parseInt(r.readLine());
}
System.out.println((int)Math.ceil(total/Integer.parseInt(data[1])));
}
}
}