Skip to content

Instantly share code, notes, and snippets.

@biscuitrainbow
biscuitrainbow / Email.java
Created April 9, 2017 13:00
6. ระบบสามารถส่งไฟล์ข้อมูลไปยัง E-Mail Address ได้
private MimeMessage createMessageWithAttachment(Email email) throws MessagingException {
Properties properties = new Properties();
Session session = Session.getDefaultInstance(properties, null);
MimeMessage mimeMessage = new MimeMessage(session);
mimeMessage.setFrom(new InternetAddress(email.getSender()));
mimeMessage.addRecipient(javax.mail.Message.RecipientType.TO, new InternetAddress(email.getReceiver()));
mimeMessage.setSubject(email.getSubject());
APP_ENV=local
APP_KEY=base64:btxr07ejaDhDMAr3F2EfuOQBqh6NDywFuGKl3eG1cj8=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
#include<stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#define ROT 13
#define MAXCHAR 1000
char *readfile(FILE *fp){
int get_tsp(int current_city, int matrix[][10], const int visited_cities[], int n_cities) {
int city, nearest_city = 999; // ให้ค่าตำแหน่งของเมืองที่ใกล้ที่สุดเริ่มต้นเป็น 999 ตำแหน่งของเมืองก็พวก 1 2 3 4
int minimum = 999; // ให้ระยะทางที่ใกล้ที่สุดของเมืองปัจบันเป็น 999 ระยะทางก็พวก 5 0 6 9
for (city = 0; city < n_cities; city++) { // สร้างลูปโดยมีรอบตามจำนวนของเมือง
if ((matrix[current_city][city] != ITSELF) && (visited_cities[city] == UNVISITED)) { // เชคว่าเมืองปัจจจุบันใช้เมืองตัวเองไหม และ เคยไปมาหรือยัง
if (matrix[current_city][city] < minimum) { // ถ้าระยะห่างของเมืองปัจจุบันน้อยกว่า minimun ตัวก่อน (ตอนแรกคือ 999)
minimum = matrix[current_city][city]; // ให้ minimum เป็นระยะห่างของเมืองนั้น (เมืองที่ใกล้ที่สุดในตอนนั้น)
minimum(0) ->get_tsp(0) return 2 print 1--> ปล. 1 มาจาก 0 + 1
minimum(2) ->get_tsp(2) return 1 print 3--> ปล. 3 มาจาก 2 + 1
minimum(1) ->get_tsp(1) return 3 print 2--> ปล. 2 มาจาก 1 + 1
minimum(3) ->get_tsp(3) return 999 print 4--> ปล. 1 มาจาก 3 + 1
minimum(0) print 1 ปล. 1 มาจาก 0 + 1
รวมกันเป็น 1-->3-->2-->4-->1
int nearest_city;
visited_cities[city_idx] = VISITED;
// ให้เมืองที่ city_idx มีค่า = VISITED(1) สมมุติว่า city_idx คือเมืองที่ี 2 ก็จะใช้เมืองที่ 2 เป็นเมืองที่ีเคยไปแล้ว
printf("%d-->", city_idx + 1); // print เมืองปัจจุบันออกหน้าจอ เชน 2-->
fprintf(fp, "%d-->", city_idx + 1); // print เมืองปัจจุบันลงไฟล์ เช่น 2-->
<?php
define("DOUBLE_SLASH", "//");
$workingCode = 0;
$commentCode = 0;
$fp = fopen("index.html", "r");
while ($line = fgets($fp)) {
if (strstr($line, "//")) $commentCode++;
@biscuitrainbow
biscuitrainbow / style.scss
Created January 27, 2018 03:37
style.scss
// http://ionicframework.com/docs/theming/
// App Global Sass
// --------------------------------------------------
// Put style rules here that you want to apply globally. These
// styles are for the entire app and not just one component.
// Additionally, this file can be also used as an entry point
// to import other Sass files to be included in the output CSS.
//
// Shared Sass variables, which can be used to adjust Ionic's
// default Sass variables, belong in "theme/variables.scss".
var config = {
apiKey: "AIzaSyDzyh0iEfidKaearbjZQNDR2Dv_tihbpD4",
authDomain: "ionic-course-2892e.firebaseapp.com",
databaseURL: "https://ionic-course-2892e.firebaseio.com",
projectId: "ionic-course-2892e",
storageBucket: "ionic-course-2892e.appspot.com",
messagingSenderId: "55718317701"
};
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/dormitory/public
<Directory /var/www/dormitory/public>
AllowOverride All
</Directory>