List Files In a Directory Using PHP

This handy PHP script will print out all the specified files (.jpg and .png):


<?php
// open this directory
$myDirectory = opendir(".");

// get each entry
while($entryName = readdir($myDirectory)) {
$dirArray[] = $entryName;
}

// close directory
closedir($myDirectory);

// count elements in array
$indexCount = count($dirArray);

// sort 'em
sort($dirArray);

// print 'em

// loop through the array of files and print them all
for($index=0; $index < $indexCount; $index++) {
if ((substr("$dirArray[$index]", -4, 4) == ".jpg") || (substr("$dirArray[$index]", -4, 4) == ".png")){ // only list jpg and png files
print('<img src="'.$dirArray[$index].'">');
}
}

?>

Went to Whitetail Myself

My wife and kids didn’t want to join me today; therefore, I went solo. Even though Whitetail was crowded, I didn’t have to wait long in the single line. The back lift also opened; therefore, I stayed at the back side until I needed to come back to the base.

I started out snowboarding for five runs. Came back to the base and ate some smoked salmons. I switched to ski and did three more runs. I spent about three hours and went back home. It was a great day.

Mad props to the snowmaking team at Whitetail. They have been making snow any chance they get. As long as the weather stays low, the next few weeks will be nice.

Bảo Chấn: Nơi ấy bình yên

Chín tình khúc nổi tiếng một thời của nhạc sĩ Bảo Chấn được nhạc sĩ Đức Trí hòa âm lại theo phong cách thính phòng nhẹ nhàng. Ngoài những giọng hát quen thuộc như Mỹ Hạnh, Lê Hiếu, Uyên Linh, Lân Nhã còn có những giọng hát chưa quen (với tôi) đã đóng góp trong album.

Hakoota Dũng Hà có chất giọng trầm ấm và anh trình bài “Biển chờ” qua giai điệu blues-jazz thật nồng nàn. Qua giọng hát mềm mại truyền cảm, Bích Trâm thể hiện ca khúc “Mùa thu” với phần đệm acoustic mộc mạc thật êm ái và cảm xúc. Cece Trương chuyên chở giai điệu funk-jazz trong “Chiếc lá vô tình” thật dễ thương.

Một lần nữa, Đức Trí đã thực hiện một sản phẩm giá trị về phần hòa âm phối khí phù hợp cho từng giọng hát và phong cách của ca sĩ. Chỉ có một thiếu sót (cá nhân) nho nhỏ. Tôi rất muốn được thưởng thức giọng hát Thùy Chi trong album này.

The Whole Family Went to Whitetail

Even my mother-in-law came to Whitetail with us. Of course she didn’t ski nor snowboard, but hanging out at the lodge chatting with my friend’s mother.

I took Vương to the learning center to teach him to pizza and turns. He was doing really well all by himself. I shouldn’t have used the harness in the previous two seasons. It slowed down his progression. Xuân also taught Vương how to turn. We did three runs on the green.

After that I switched to snowboard and did three runs on the blue trails by myself. We packed up and went to Sushi Bomb for dinner.

I am exhausted once again. I still want to go back to Whitetail tomorrow by myself and have many runs before returning to work on Tuesday.

Nguyễn Tuấn Anh: Hồi ký không tên

Nguyễn Tuấn Anh có chất giọng trầm ấm nhưng không mấy lôi cuốn. Anh trình bày những tình khúc của nhạc sĩ Vũ Thành An không ấn tượng lắm tuy cách hòa âm phối khí của nhạc sĩ Nguyễn Quang sang và đẹp. Nguyễn Tuấn Anh không tạo được nét riêng của mình mà bị gò bó hát cho đúng theo lời dạy của thầy.

Soccer, Ski & Snowboard

Couldn’t sleep last night so I got out of bed around 7:00 am and decided to play some soccer. One of my teammates twisted his knee. He could barely walk. He would need a long time to recover. I couldn’t afford to be out during the skiing and snowboarding season; therefore, I played with care. Nevertheless, I played hard for two hours. I was dead tired.

I came back home, ate a bowl of rice, read a few pages, and fell asleep for a bit. I woke up and felt recharged again. I asked my family if anyone wanted to join me for a late-afternoon skiing and snowboarding. Only Đạo (my oldest son) and Xuân (my third son) wanted to join me.

We arrived at Whitetail around 3 pm. The express lift was not working; therefore, there was only one blue trail. The condition was not so good. New snowboarders and skiers were falling everywhere. I did three runs on skis and three runs on snowboard. Around 5 pm, we called it the day. We went to Chili’s for dinner and drove home.

These days I am more active than my kids. I ski, snowboard, skate, and play soccer. My 45-year-old-out-of-shape body is holding up surprisingly well. I hope I can continue to stay active for many years to come.

Sức mạnh tiềm ẩn của Mẹ

Thứ Bảy vừa rồi tôi lái xe chở cả gia đình và mẹ vợ đi trượt tuyết. Từ khách sạn đến khu trượt tuyết thường chỉ mất khoảng nửa tiếng đồng hồ nhưng hôm đó trời tuyết, mưa, và đông đá. Mấy lần xe của chúng tôi bị trượt qua làn đường đối diện.

Vì đam mê trượt tuyết mà tôi đã đưa bảy mạng vào những giây phút nguy hiểm nên tôi rất lo âu. Lúc phải chạy lên núi, đường trơn trượt và đóng băng nên chiếc xe không lên dốc nổi. Cố gắng hết sức cũng chỉ kéo được 5 dặm một giờ. Nhìn vào kính xe, tôi thấy một đoàn xe ở sau chúng tôi.

Không biết phải làm gì hơn, tôi cầu xin: “Mẹ ơi, giúp con vượt qua đoạn đường này nhé mẹ”. Cố gắng đạp ga xe từ từ để nó không bị lùi lại. Chỉ vài phút sau, bỗng dưng có một chiếc xe tải cào tuyết từ đường bên trái chạy ra trước xe chúng tôi. Xe tải vừa cào sạch tuyết vừa rải muối để cho xe tôi cũng như cả đoàn xe đằng sau chạy dễ dàng.

Tôi nhìn lên trời, nở một nụ cười, và vô cùng cảm ơn Mẹ. Một lần nữa, Mẹ đã dùng sức mạnh tiềm ẩn để che chở cho gia đình chúng tôi. Lần nào con cầu cứu Mẹ, Mẹ cũng trả lời và lần này sự linh thiêng chỉ trong vòng vài phút.

Nỗi đớn đau không còn có Mẹ trên cõi đời này cũng xoa dịu trong tôi theo thời gian. Tuy thể xác Mẹ không còn ở trần gian nhưng Mẹ vẫn mãi mãi bên tôi. Bất cứ ở thời điểm, địa điểm, và hoàn cảnh nào, tôi chỉ cần gọi “Mẹ” là có Mẹ ngay. Tôi tin chắc là như vậy.

Simple Slideshow

I needed a simple slideshow to display images on a large-screen TV and I came across Simple Fullscreen Image Slideshow. It was exactly what I needed and the codes are just so simple. I loved it so much, I replaced all my Flickity slideshows with this one. Here’s an example. Although it works as webpage, my goal is to create a digital display slider. Here’s the entire page:


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Slideshow</title>
<style>
@keyframes fadey {
0% { opacity: 0; }
15% { opacity: 1; }
85% { opacity: 1; }
100% { opacity: 0; }
}
body {
  font-family: Avenir, Arial, sans-serif;
  font-size: 0;
  background: #000;
}

body, figure {  margin: 0; padding: 0;}

figure#slideshow {
  width: 100%;
  margin: 0 auto;
  position: relative;
  /*border: 1px solid #000;*/
  cursor: pointer;
}
figure#slideshow img {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: auto;
  opacity: 0;
}
figure#slideshow img:first-child { position: relative; }

#container:fullscreen {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}
#container:-moz-full-screen figure, #container:-ms-full-screen figure, #container:-webkit-fullscreen figure, #container:fullscreen figure {
  width: 100%;
  margin: 0 auto;
  background: #000;
}
:-webkit-full-screen {
  width: 100%; height: 100%;
}
*:-moz-full-screen {
  background: #000;
}
*:-webkit-full-screen {
  background: #000;
}
</style>

<script>
function cancelFullScreen() {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
} else if (document.msCancelFullScreen) {
document.msCancelFullScreen();
}
link = document.getElementById("container");
link.removeAttribute("onclick");
link.setAttribute("onclick", "fullScreen(this)");
}

function fullScreen(element) {
if (element.requestFullScreen) {
element.requestFullScreen();
} else if (element.webkitRequestFullScreen) {
element.webkitRequestFullScreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
}
link = document.getElementById("container");
link.removeAttribute("onclick");
link.setAttribute("onclick", "cancelFullScreen()");
}

window.onload = function() {
  imgs = document.getElementById('slideshow').children;
  interval = 8000;
  currentPic = 0;
  imgs[currentPic].style.webkitAnimation = 'fadey '+interval+'ms';
  imgs[currentPic].style.animation = 'fadey '+interval+'ms';
  var infiniteLoop = setInterval(function(){
imgs[currentPic].removeAttribute('style');
if ( currentPic == imgs.length - 1) { currentPic = 0; } else { currentPic++; }
imgs[currentPic].style.webkitAnimation = 'fadey '+interval+'ms';
imgs[currentPic].style.animation = 'fadey '+interval+'ms';
  }, interval);
}
</script>
</head>
<body>
<figure id="container" onclick="fullScreen(this)">
<figure id="slideshow">
<img loading="lazy" src="img/01.jpg" alt>
<img loading="lazy" src="img/02.jpg" alt>
<img loading="lazy" src="img/03.jpg" alt>
</figure>
</figure>
</body>
</html>

Statement of Research Interests

As a web designer and an adjunct professor who has a passion for typography, I researched and wrote a book on web typography. Professional Web Typography was my independent study in pursuing my Master of Arts (MA) degree in graphic design at George Mason University.

The first edition of Professional Web Typography was released as a web book in 2015 when web fonts started to take off. At the time, I could not find a book that combined typography principles with web technologies; therefore, I decided to write the book myself.

With my experience of designing websites for over two decades, I understood the importance of legibility, readability, usability, and accessibility when setting type on the web; therefore, I delved into topics such as selecting body text, choosing headlines, picking type for user interface, and discerning typographical details.

My goal was to prove that typesetting on the web was fun and rewarding—not intimidating. As a result, I kept the technical aspects as simple as possible. Back in 2015, variable font was still in its infancy. Not all browsers adopted variable fonts. Today, browser makers, type creators, and web designers are all on board.

My current research is to show the benefits of variable fonts for designing web experiences. Using just a few lines of CSS, designers can have a wide range of possibilities including setting specific weight, width, and optical size.

My future research is to expand the power of variable fonts to make the web experiences more diverse. One of my research interests is language support. As a native Vietnamese speaker and writer, my goal is to see more support for the Vietnamese in typefaces.

Checked Out Whitetail

I skied and snowboarded at Whitetail for the first time this season. The condition was surprisingly good given the warm weather in the past week and the heavy rain on Tuesday. Only two blue trails and the learning center opened. I practiced carving on both ski and snowboard on the blue trails. I was not complaining. It was better than nothing. I hope they’ll be able to make more snow in next few weeks.

Contact