Counting sheep outloud in Javascript

Recently, I’ve decided that I need some ******** skillz so now I’ve gone through a process of doing some Kata right before bed time.

This one is for counting sheep. This is for my own development and journal so if you’re going at it own your own, BIG SPOILER ALERT below

eace2bb3908e359c0f591b65ce32b374.jpg

When given a function(3), return a string of “1 sheep…2 sheep…3 sheep…”


var countSheep = function (num){

  //start with a counter i = 1
  // increment i
  // stop until i == num
  // "interpolation" to insert variables
  // return joint array
    let smallArr = "";
    for (let x = 1; x <= num; x++)
    {
       smallArr += `${x} sheep...`
    } 
    return smallArr;
};

Iron Mask Prototype - Face tracking filer in SparkAR

Imagine the man in the iron mask is stuck in a dungeon under water. This is what it would look like. Dark thoughts, I know but was the ‘mood’ at the time.

Created using SparkAR.

Assets

  • Blarney Castle

  • Black glowing lotus

Learnings

  • SparkAR is actually very intuitive to use. The Patch Editor needs a lot of UX work to make useful but the currently state is logical enough that after a new trials and errors, it’s possible to create (o stumble) upon some cool effects

  • Next steps: Create scaled animation and add materials to bubbles

Building a multi layers game using Unity and C#

Building a 2D game where the cube goes around the farm field to collect pieces of gold. It’s COVID time, every one needs to earn a bit of extra income, including once-upon-a-time in-animated objects.

The project goal was to get familiarized with the Unity and Visual Studio Code environments and begin to build a game scene with multiple layers and inter-activities.

The game object [box] should be able to:

  • Obey the rules of gravity and physics

  • Move with left, right, top, down by ADWS and by keyboard arrows

  • Jump with space bar

  • Stalked by the main camera object

Assets:

  • PBR Brack Material (free)

  • ADG_Textures (free)

  • Prototyping_Pack_Free

Settings: Getting the cube to obey the rules of gravity and physics

Code and assign a rigidbody to the cube (see code below) and makes sure Mesh Collider is enabled for planes and terrain

In progress #1

In progress #1

Grass material

Grass material

In progress #2

In progress #2

In progress #3

In progress #3

Gif Demo

Gif Demo

Code: Getting the cube to move with left, right, top, down by ADWS and by keyboard arrows + Jump with space bar

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class cubeBehavior : MonoBehaviour
{   
    private Light myLight;
    private new Rigidbody rigidbody;

    // jump variables
    public float jumpHeight;

    // rotate variable
    public Vector3 rotateAmount;

    // Start is called before the first frame update
    void Start()
    {
        print( message: "Hi from start method");
        myLight = GetComponent<Light>();
        rigidbody = GetComponent<Rigidbody>();
    }
    // declare the light variable
    // grab the light variable
    // Update is called once per frame
    void Update()
    {
        // print( message: "Hi from update method");
        // script to turn light on / off the light variable

        if (Input.GetMouseButtonDown (0)) {
            print ("The Left mouse button was pressed");
            myLight.enabled = !myLight.enabled;
            // rigidbody.MovePosition(transform.position + transform.forward);
            rigidbody.transform.Rotate(new Vector3(0, -10, 0));
            // rotate the cube wieh clicks rigidbody.transform.Rotate(new Vector3(3, 4, 1));
        }

        if (Input.GetMouseButtonDown (1)) {
            print ("The Right mouse button was pressed");
            myLight.enabled = !myLight.enabled;
            // rigidbody.MovePosition(transform.position + transform.forward);
            rigidbody.transform.Rotate(new Vector3(0, 10, 0));
            // rotate the cube wieh clicks rigidbody.transform.Rotate(new Vector3(3, 4, 1));
        }
        // adding keyboard navigation
        if (Input.GetKey (KeyCode.W)) {     
            transform.Translate (0.0f, 0f, 0.01f);
            }
        if (Input.GetKey (KeyCode.S)) {
            transform.Translate (0.0f, 0f, -0.01f);
            }
        if (Input.GetKey (KeyCode.D)) {
            transform.Translate (0.01f, 0f, 0f);
            }
        if (Input.GetKey (KeyCode.A)) {
            transform.Translate (-0.01f, 0f, 0f);
            }
        // adding arrows navigation
        if (Input.GetKey("up")) {     
            transform.Translate (0.0f, 0f, 0.01f);
            }
        if (Input.GetKey("down")) {
            transform.Translate (0.0f, 0f, -0.01f);
            }
        if (Input.GetKey("right")) {
            transform.Translate (0.01f, 0f, 0f);
            }
        if (Input.GetKey("left")) {
            transform.Translate (-0.01f, 0f, 0f);
            }
        if (Input.GetKey("space")) {
            print ("the space button was pressed");
            rigidbody.AddForce(Vector3.up * jumpHeight);
        }
        
    }
}

Code: Getting the Main camera to stalk the cube

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class cameraController : MonoBehaviour
{   public float turnSpeed = 4.0f;

   //create a myCube variable
    public Transform myCube;
    // create offset camera
    public Vector3 cameraOffset;

    // Start is called before the first frame update
    void Start()
    {
        cameraOffset = new Vector3(myCube.position.x, myCube.position.y + 4.0f, myCube.position.z + 3.0f);
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    void LateUpdate()
    {
        cameraOffset = Quaternion.AngleAxis (Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * cameraOffset;
        transform.position = myCube.position + cameraOffset;
        transform.LookAt(myCube.position);
    }
}

Learnings

I think that Unity and its integration with Visual Studio Code is a good smart relationship. What’s not as smooth is the constant drag and drop and assignment that needs to happen in Unity after the code is in VSC. How come Unity doesn’t allow for code editing in-app? Seems like a mis-opportunity to me.

What’s next:

  • Switching that cube into a farmer, because yes - I’m biased to the pre-conception that a farmer should be on a farm vs. a cube

  • Create a reward interactive whereas upon coming into contact, the gold would turn into dust with some magical animation that celebrates the user’s winning moment

  • Change the keyboard movement to reset based on current cube direction and not original orientation

How I rewire and mod up a Mid Century Modern spring loaded lamp with no prior experience. Insane? I think not!

Ingredients:

Tools:

Time: 4 hrs 
(No cost attached, especially not at a consultant’s hourly rates :P)


 How did you end up rewiring a lamp, Thu? Isn’t there something else you should be doing instead?

Practice what you preach.

That old wisdom that makes doers do and makers make. I don’t claim to be an exceptional doer nor a gifted maker but my obsession with fine handcrafts is real. Craft is at the center of what I do: our startup, our consulting work, our clients, and how I spend my weekend. I also have a soft spot for anything well designed. Call it a professional hazard.

That’s why when I saw a virtual auction for all things Mid Century Modern (MCM), my head followed my heart and my heart followed my hands as I clicked away and watched item after item slipping away under my tight purse string. As a startup dreamer who recently went through a job transition, I can’t compete with what seemingly are the ‘bottomless’ wallets of Long Islanders. Tough competition where I am when it comes to collecting and preserving a piece of history.

When hope just started to dwindle, an item caught my eyes at the end of the auction— a spring loaded lamp, MCM, with original fiberglass and teak wood. I told you I’m slightly obsessed. No shame needed.

“Have got to be in the 50–60s" 

> “must be expensive” 

>> “but it’s so beautiful”

>>> “ok, fine. let me see the price. prepare for impact…”

>>>> “8 bucks?!?! That’s unreal. What’s wrong with it?”

That’s exactly my thought process and sure enough, the description read “Trio spring lamp for repairs. Condition as is.”

The wires were badly damage. The fiber glass — which is a staple design feature of the MCM area and a signifier of authentic pieces — was also cracked and dented.

What could be wrong? Maybe I can fix it. Imagine IF!

This is almost always how I start any project. By being attracted to the problem and not always knowing the solution😅.


Not all those who wander are lost?

I have never wired anything. I have no electrical tools and I’m pretty sure the investment up front to buy wire cutter, stripper, plus electrical wires, plugs, bulbs++ is fueled by the excitement to do. Imagine a world where I can wire a lamp!

If you’ve read this far and thought 'What is the point of this?’ Well, the point is I’m prepared to share How I wired a lamp. And the second point is that there is no point, no agenda. I just felt like I did something good today, and positivity is best shared in a time like this.

Sometimes we fall apart just so we can put ourselves back together

#1: Taking all of the pieces apart and trying to memorize where everything was.

#2: Clip away old damaged wires with the Wire Cutter. Hint: leave enough extra wires on everything you cut. I had to threw out a socket because I got excited using the cutter and cut too close (hence there was not enough wire to reattach.) 

#3: Using the Wire Stripper, remove the wire from your new wires about 0.5 inches or .75 cm and replace the old damaged wires with the new ones. Hint: Be sure to find out for yourself which one is the Hot wire and which one is the Neutral wire. Don’t throw away the packaging like I did and had to Google for it.

What you’re seeing down here is the switch wires setup— the ability to turn on the switch and only certain lamp would lit up. I had to follow the wiring that was here so be sure to take note when you take things apart.

Usually, the Hot wire is black or have special marking and the Neutral wire is white. This is important for safety and to reduce over heating.

#4: Attaching the wires to the light sockets using a screw driver: the Hot wire to the Brass / Bronze color screw and the Neutral wire to the Silver / White color screw. Screw tight!

#5: Once you feel that the wires are secured onto the socket, attach the socket only the lamp itself. Depending on which lamp you have, the components may be different. For me, they come in brass screw and teak wood. MCM all the way!

#6: This lamp has some badly damaged fiber glass parts due to age and usage. (Also tbh I think the positioning of these original screws are not optimal for weight distribution since two out of the three lamps have damage in this way. Even the MCM design masters have something to improve.) Using super glue, I pieced them back together and Pi the Husky inspected along the way.

#7: To avoid further weight damage to the lamps, I invented a new way to keep the screws from damaging the wood and fiberglass. Cutting a simple clear padding and middle hole to allow for extra protection. Super excited for this trick.

#8: Holding my breath and turning on the lamp. 

It is alive!


Now — a spring loaded lamp is cool because it can stand just by using the pressure made by the inner spring. Mr. Frankenstein will have something to have his tea by, and Pi agrees this is a good addition to our home.

Authenticator - Working with Username and Password in Ruby

users = [
  {username: "mashrur", password: "password1"},
  {username: "jack", password: "password2"},
  {username: "arya", password: "password3"},
  {username: "jonshow", password: "password4"},
  {username: "heisenberg", password: "password5"}
]

def auth_user(username, password, users)
  users.each do |user_record|
    if user_record[:username] == username && user_record[:password] == password
      return user_record
    end
  end
  "Credentials were not correct"
end

puts "Welcome to the authenticator"
25.times {print "-"}
puts "This program will take the input from the user and compare password"

attempts = 1
while attempts < 4
  print "Username:"
  username = gets.chomp
  print "Password:"
  password = gets.chomp
  authentication = auth_user(username, password, users)
  puts authentication
  puts "Press n to quit or any other key to continue"
  input = gets.chomp.downcase
  break if input == "n"
  attempts +=1  
end

puts "You have exceeded the number of attempts" if attempts == 4

Creating a simple calculator using branching concept in Ruby

Photo by Editors Keys on Unsplash
Preview

Preview

def multiply (num_1, num_2)
num_1.to_f * num_2.to_f
end

def divider (num_1, num_2)
num_1.to_f / num_2.to_f
end

def addition (num_1, num_2)  
num_1.to_f + num_2.to_f
end

def subtraction (num_1, num_2)  
num_1.to_f - num_2.to_f
end

def mod (num_1, num_2)  
num_1.to_f % num_2.to_f
end

puts "Simple calculator"
25.times {print "-"}
puts "Enter the first number"
num_1 = gets.chomp
puts "Enter the second number"
num_2 = gets.chomp
puts "What do you want to do?"
puts "Enter 1 for multiply, 2 for division, 3 for addition, 4 for subtraction, 5 for mod"

user_entry = gets.chomp

if user_entry == "1"  
puts "You've chosen to multiply"  
puts "The multiplication is #{multiply(num_1, num_2)}"

elsif user_entry == "2"  
puts "You've chosen to divide"  
puts "The division is #{divider(num_1, num_2)}"

elsif user_entry == "3"  
puts "You've chosen to addition"  
puts "The addition is #{addition(num_1, num_2)}"

elsif user_entry == "4"  
puts "You've chosen to subtract"  
puts "The substraction is #{subtraction(num_1, num_2)}"

elsif user_entry == "5"  
puts "You've chosen to mod"  
puts "The mod is #{mod(num_1, num_2)}"

else   
puts "Invalid"

end

Manipulate Strings in Ruby

puts "What's your first name?"
first_name = gets.chomp
puts "What's your last name?"
last_name = gets.chomp
full_name = "#{first_name} #{last_name}"
reverse_name = full_name.reverse
puts "Your full name is #{full_name}."
puts "Your full name is reverse is #{reverse_name}."
puts "Your name has #{full_name.length - 1} characters in it."

What’s your first name?

Thu

What’s your last name?

Do

Your full name is Thu Do.

Your full name is reverse is oD uhT.

Your name has 5 characters in it.

An optimistic alliance in the time of change

We think of change as what’s happening around us, but maybe we are the ones who are changing.

Like a Planet which spins while orbiting around its Star, we too go through the Phases and Seasons in life.

The world and how it works does not fit us, and so as makers we have to make things to fill in the gap. But how do we know to make the right things? How do we know if the way we are approaching it is the only way, the right way?

Have you every wonder why there are so many words to describe the same thing, in different languages? Cup. Cốc. La taza. A word: like a circle, is made up with points of view—infinite. The more points that make up the circle, the closer to the 'true circle’. A moving target of truth. The more words and different languages to describe an object, the more accurate and complete the object in focus. Maybe one language isn’t enough to describe a ☕ or 🍵 or 🥤. Maybe we need to have different perspectives to make a more complete picture.

The strength of human creativity is what makes us unique and still further ahead than the machines.

In Design specifically, there has been a rise of production tools to shortcut process such as Principle in taking out the labor in keyframe animation or Figma in file versioning and sharing. When reading the threat of automation, we often exclude Design out of the danger zone — self-convinced that since it is a 'tech' and 'creative' field, the change will come last. This is wishy washy thinking, and that replacement and automation for parts is already here. Even Computer Science, the King of employable, is faced with tools, framework, and no-code movements that getting production closer to 'hit this button’.

Because of this, Designers are moving closer to Business Problem Solving and Ideation vs. Production. To problem solve, we need to enlist the help of others around us and not just ourselves. All we have is the collective human creativity power. I hope it is all we need.

This is a time of pandemic, economic uncertainty, and isolation. But maybe this is also a time when we can dig deeper to think introspectively of the words we would use to describe the world and listen to those around us on how they would describe the same world. Free from the noises and the distractions, maybe this is the time we can get closer to what is true to our values and passion — to know that we even have a passion.

Change is the only constant. Be the Change.

My love letter to you all. Stay strong and stay positive.

Product behaviors in Asia through current culture, economy, and society lens

I have always identified to the Beatles song ‘Nowhere Man

He’s a real nowhere man
Sitting in his nowhere land
Making all his nowhere plans for nobody

Doesn’t have a point of view
Knows not where he’s going to
Isn’t he a bit like you and me?

I left my hometown Vietnam when I was 15. Although my entire childhood was filled with Eastern tradition and beliefs, my early adulthood is shaped entirely by Western ideology, conviction, and education. Inside me is a wealth of knowledge for someone who needs yet another artifact for the effects of Nature versus Nurture casework.

I have always felt a little bit like a Nowhere Woman, with feet in two different continents. And while this creates a lot of dilemma, hilarious misunderstandings, and a more than usual rate of enlightenment, I have never felt qualified to speak on behalf of one culture — I’m most often not entirely Vietnamese, and nowhere near enough American.

What I do feel enticing to talk about is the emerging pattern and behaviors as I hop between these two continents. After all, I live through these differences myself, and as a UX Designer whose job it is to observe, I have keenly been doing so in my last 15 years trying to blend in <> stand out.

“This year, let’s have a point of view to mark the half way point (15–15).”

Let’s talk about how the 3 ways that culture, the economy, and society affect the way Asia consumes her Product.

  • Aging vs. Booming

  • Credit vs. Cash

  • The Commodity that is Luxury Local Goods

Just to be clear, I’m not talking about the Hofstede’s Cultural Dimensions Theory, in which the world spins around 5 dimensions: power distance, collectivism vs. individualism, femininity vs. masculinity, uncertainty avoidance, and long vs. short-term orientation. While I admire and love this framework (classic!), many of them have been discussed to the core (cue collectivism vs. individualism) and they can lean on the side of theoretical. I’m also not speaking to some of the more obvious cultural examples that have an effect on Design such as written language directions and color significance. No, the examples I am sharing below are much more personal from my own real life experiences.

Fitting format for two age spectrums

From Facebook (text-based) to Instagram (image-based) to now Tik Tok (video-based), the moving image is moving faster everyday to catch up with our ADD tendency. By the time you read this message, we may have to use a device to help us slow down the image rate, to scavenger hunt the hidden message in between. Call it a glimpse into the future.

The aging population of the Western world can be explained by the increasing options that women gain and the rising cost in raising a child. On the other hand, relaxed population control and increased economical power exponentially boost the young population in Vietnam while still keeping a traditionally aging population on the two spectrums of the population.

When I go home to visit my parents, I am amazed at their super active engagement on Facebook. An entire generation mobilized by the ‘thumbs-up’ and ‘views’. Why Facebook and not Instagram or TikTok?

Platform like Facebook allows for long-form, deeper, and more diverse set of content

— hence allow for a more well-established technical behavior without having to learn yet another platform.

On the other hand, the increasingly young population in Vietnam drives product trial and adoption at a staggering rate.

Video content that plays into national pride and local culture attract Millions of views per month

— like this dance video using Vietnamese music, dance choreography, minority tribal traditional clothing, performed in the heart of Hanoi — my city. My sister, who by now should earn a YouTube scavenger expert badge (if there is ever one), convincingly told me that content which inherently retain a tie to Vietnamese culture (a folk melody perhaps) does much better than foreign-borrowed content. Acknowledging that we’re next to an entertainment powerhouse that is South Korea, I’m so proud every time I see the youth of my city owns up to their strength.

DUYÊN ÂM — HOÀNG THÙY LINH Dance Cover & Choreography by C.A.C

Cash is Queen

Being a design consultant, I have to travel a lot. When I travel in the US or in Europe, I make sure to have two types of card: a credit card and a debit card. Sure, I might exchange a few bucks into local currency — but as long as we have those cards, we’ll be ok. The Card Overlords will take care of us.

It’s a different story when I travel in Asia or other parts of the world — Cash is still Queen. My friends do not understand why I would carry thousands on the plane with me from US to Vietnam. ‘Because I need cash to spend over there.’ It seems natural to me.

One time, I stayed in the US for 3 years before going back to Vietnam. The moment I got home, armed with a sense of familiarity carried over from the US, I gingerly set up my Grab app (the equivalent of Uber). I ordered a car and naively sat there until I reached my grandparent house. The moment we hit the gate of my childhood home, it dawned on me that I have no Cash, and what follow was a quick exchange, a few side glances and watchful eyes as the driver watched me, a grown damn woman, walked into my grandpa home to ask if I can borrow 60,000 VND = $3 for my cab ride.

The cash economy in Asia is so strong, that people would choose to keep cash with them and only refill their debit card months at a time.

Source: Grab

Source: Grab

The Commodity that is Luxury Local Goods

I remember a time when an acquaintance from Vietnam would ask me to buy a $150 Gucci belt on a trip back. I also remember a time when a co-worker in the US asked me to buy a Louis Vuitton knock-off purse from Vietnam. Sure, luxury brands such as Gucci and LV will always have a space in the luxury landscape.

However, there rises a few wave of local mid-market luxury goods from Vietnamese and Asian designers: Hanoi Silk House is such an example where 1 meter (~3.2 ft) of silk commands $20. To put in perspective, when we prototype the made to measure shirts for TAILORU, the silk materials alone is about 3 meters ($60) per shirt. Worth it, since the silk is organic, made by hand, and is machine washable. This material, once only accessible to the like of Kings and Queens, are now within reach of the commoner.

Source: Kenny Luo&nbsp;on&nbsp;Unsplash

Source: Kenny Luo on Unsplash

Hoi An, a small city of 150,000 people, is home to the best handmade shoes, bags, and tailored suits in Vietnam — and arguably (I think!) the top three in Asia. Here, luxury is defined by how fast you want the goods, because quality and price are both guaranteed. Westerners and Asians come from all around the world to enjoy the luxury in life. In a way, places like Hoi An has replaced the like of Florence (for leather goods) in terms of comparable quality and affordability.

In Asia — When labor is cheap and the materials are abundant, what is then the differentiating factor? It used to be that whoever can have access to the latest style from the West will attract the most intra-continental and oversea customers. However, there has been an oversaturated reach of Western culture in Eastern culture, resulting in a fighting, kicking reversed trend to embrace and explore the East.

Within a global landscape where every thing blends, the countries who successfully export culture win.

Designers need to find a way to express their local flavor with mass global appeal — resulting in a GLOCAL trend that ranks more highly to the elite and the middle class than global mass-produced luxury goods. In many ways, the luxury market in Asia is more fierce than anywhere in the world, having the production of the largest luxury brands in the world while growing young numerous hungry luxury local brands.

We’re the same, just slightly different.

I have always believed that both of my homes have something to offer and never before do I feel so much pride in seeing Asia finding her own voice. For brands and startups who want to enter this young and dynamic market, my advice is to pay close attention that not all the rules apply the same way as in the West. Sometimes, we just need to bring a little bit more Cash.

Read more at Medium

The principles of human craftsmanship design

As I was reading Don Norman’s Design of Everyday Things, I came across the quote “Why do we put the requirements of machines above those of people?”

This quote sparks a lot of thoughts in me. I am spending a significant amount of time in the last three years working on TAILORU — a tech platform to help artisans gain more income and do better work through modern technology, as well as a few other startups that focuses specifically on preserving the best of human craftsmanship through tech.

My journey with TAILORU started in my homeland Vietnam when I noticed that there is a disproportionate gap of income between the artisans doing the work and the amount of money the customers oversea pay. Such inequality is abhorrent in itself, seeing the beautiful silk or embroidery which took days to make, and the minuscule payment that comes back. All would be well if the artisans were being content with the amount that they get. But the fact of the matter is that they have many more different options for income. Sure, these factory jobs are not glamorous, but they pay.

The best of human craftsmanship is fading away into a thing of the past.

Immediately, my thoughts at that time is to use Technology to help modernize these thousand years old crafts. “It must be that Human are falling behind and we must catch up to Technology, to the MODERN WORLD.” I have thought.

My experience as a User Experience Designer gets me excited to solve this handmade problem the digital way.

THE CONVERSATIONS THAT UNLOCK THE PRINCIPLES OF DESIGN

Just today I had an interesting conversation with an Engineer, truly in a Design <> Code fury exchange of ideas. She shared “I’m always fascinated with the way artists think. They seem boundless and unbothered by guidelines.” We then ventured into a discussion on the role of Logic in Design vs. Programming process. Reflecting on my experience as a Designer / Instructor and current experience learning Ruby, I shared that:

  • Design uses Logic as a guide to unlock a more fluid Creativity process, exemplified in the Affinity Mapping method to arrive at Ideation, or the Grid to arrive at UI layouts

  • Whereas Code uses Logic is a must-have as the core step-by-step process in its entirety, as seen in the pseudocode or simply in if/else statements

Of course this is a simplified view of Design and Programming process, for no one in their sane mind would refute that Coding requires a different kind of abstract creativity that even the Designer envies. My point in the conversation rests in the Logic entry points and usage ratio each of these disciplines.

What is the balance between Logic and Creativity in the modernization human craftsmanship?

I believe Craft is closer to Design, so (I) Creativity supported by Logic

The second conversation I have today was with a student around the topic of Animal <> Human language. “How come that the bird can flap its wings a few times, chirps a few times, and be able to communicate better than Human?” For him, the Animals communicate while Human just talk.

As I ruminate on the question, thoughts come to mind that it’s not that the bird can communicate better, it is that the vocabulary that they are using is more limited, defined and hence is less prone to misunderstandings and errors. Human language, similar to handmade skills, are more quirky, diverse, and open to interpretation. the more complex and varied something is, the more it is likely to attracts errors. (II) Simplicity over Complexity

Lastly, my new conversation with Don sparks the question of Machine <> Human needs.

Recently, we are working on a UX / Dev project called TAILOAR which provide people a way to measure themselves at home, thus allowing tailors to get more customers and these crafters to earn more livings. As we’re prototyping this solution, we were asking the users to match the accuracy of the Machine requirement. “You captured 34.46 cm, which is outside of the range of 35 to 40 cm.” Ambitious, and totally irrelevant based on the following user testing and interviews that we did. This is putting the requirements and needs of the Machine first: Accuracy.

Instead, what we should do is to put the User needs first: help me achieve my goal of measure myself with ease. I already trust that you have the accuracy down if it seems easy to do. (III) Ease over Accuracy

Whether we are working on a Human problem or an inherent Technology problem, the end user / operator will be Human. As such, we need to be able to communicate in ways that bring together:

  • (I) Creativity supported by Logic

  • (II) Simplicity over Complexity

  • (III) Ease over Accuracy

This way, we will be able to preserve the best of Human abilities, what makes us different and (still) a leg up from our Machine counterparts.

As seen on Medium.

This article was originally written on TAILORU. You can see the full snapshot and more content here.

Sorting Algorithms Visualization

Found this visual and audible manifestation of the Sorting Algorithms from Timo Bingmann and it is MESMERIZING.

Visualization and "audibilization" of 15 Sorting Algorithms in 6 Minutes. Sorts random shuffles of integers, with both speed and the number of items adapted ...

Prime time

In this exercise, the task is to determine whether a number is prime or not. To do so, first I have got to think about what makes a prime number, here are a few requirements in my mind:

  • Not negative

  • Not 0

  • Not 1

  • Can divide by 1 and itself

  • Can not divide by other numbers such as 2, 3, 5, etc

    At first, i thought about whether or not i should go about dividing this number to every other prime that i can think of; but then what if i miss one?

Source: ImgFlip

Source: ImgFlip

SourceL ImgFlip

SourceL ImgFlip

Ok, one thing first - I need to check to see if num is a positive > 1. Because no matter what people say, 1 is not a prime number. Sad but true.

To iterate through and harness the power of CPU, I need to go through each of the number from 2 to less than num integer to determine if num is divisible.

The code is then below. If you’re studying, this is the part where I tell you there is a spoiler alert.

[ ]

[ ]

[ ]

def prime?(num)
  if num <= 1
    return false
  else
    (2..(num-1)).each do |n|
      return false if num % n == 0
        n += 1
      end
      true
  end
end

This exercise has been fun to do because I learned a new way to create a range of number for iteration (x..y). Onward!

The Deli Counter is counting down my patience!

Let’s just say I’m two months in the deli challenge with no way out. Let’s just say I see the sausage in front of me, just passing by on that sushi belt but with no way to reach it. Let’s just say it has been two months with no treats. I’m a cat too, I need to be treated like a cat!

OK, enough of this. Let me Google.

As I’m going through the Deli Counter challenge, it’s clear to me there are three main things to accomplish:

  • If there’s no one in line, say so.

  • If there’s a line, help people stay sane by telling them where they are in line.

  • If it’s someone’s turn, help them celebrate that small victory in their day, and swiftly send them on their way out of the line.

Supposedly simple, definitely not so.

One of the challenges that I met was with the mixing definitions of the number of people in a katz_deli, a queue, and the customer’s position in the queue. Quite helpful to make these distinction because then it helps with the strings later on.

SETTING UP katz_deli:

katz_deli = []  
def line(katz_deli) 
   position = 1 
   queue = []

DISPLAYING WHEN THE DELI IS EMPTY:

   if katz_deli.length == 0     
      puts "The line is currently empty."   
   else 
      katz_deli.each do |customer|     
      queue.push("#. #")     
      position +=1   
   end   
   puts "The line is currently: #{queue.join(" ")}"   
   end 
end

MANAGING THE QUEUE STATUS:
I’ve found that the exercise (now simply) allows various use of :

  • .push - adding to the end of an array

  • .join - concatenate into an array

  • .shift - remove from the beginning of an array

  • .empty? - checking if an array is empty

def take_a_number(katz_deli, customer)   
   katz_deli.push(customer)   
   puts "Welcome, #. You are number # in line." 
end  

def now_serving(katz_deli)   
   if katz_deli.empty?     
      puts "There is nobody waiting to be served!"   
   else     
      puts "Currently serving #."   
      katz_deli.shift 
   end 
end

I’ve really struggle with coming up with a fresh-from-the-start solution, as if I’m Ada Lovelace inventing computer languages for the first time. It’s more clear to me now that in order to learn, I need to tread on the path that my fore friends have gone before me. Googling and learning from past solutions are not a crime, it’s the learning of English vocabulary from simple TV programs before I could mimic a sentence and talk like an American with a broken English accent. This experience has kept me humble and push me to keep going.

Until the next struggle, my friends.

Ruby - Building the Tic Tac Toe game

My first encounter with Ruby has been quite wonderful. Even with the guidance by the Flatiron curriculum and the team there, it was a really big challenge for me. However, we know have a working game! I want to share my learnings below in hope that maybe it would help others - and even more so, for myself to keep going!

Below is my first attempt to rebuild a basic game of Tic Tac Toe.

HOW THE GAME WORKS

  1. Two player starts with a blank board of 9 spaces on a 3 x 3 grid

  2. Each play takes turn to place either an “X” or “O” (a marker) on the board

  3. The game is won when one player achieve three markers in a row - horizontally, vertically, or diagonally

  4. The game is draw when the board is full and there is no winning moves

  5. The program needs to guide players along the way and announce the winner if game is won

SETTING UP THE GAME IN BIN

#!/usr/bin/env ruby

require_relative '../lib/tic_tac_toe'
puts "Welcome to Tic Tac Toe!"
board = [" ", " ", " ", " ", " ", " ", " ", " ", " "]
play(board)

SETTING UP THE BOARD & DEFINE WINNING COMBINATIONS

# -> lib/tic_tac_toe.rb

def display_board(board)
  puts " # | # | # "
  puts "-----------"
  puts " # | # | # "
  puts "-----------"
  puts " # | # | # "
end

# TROUBLESHOOTING: This was easy to get wrong because of all the spacing and number of dashes. The test specs was written quite specifically so you should pay attention to the details.

DEFINE PLAYER’S MOVES AND CONVERT THEM TO INTEGERS

def input_to_index(user_input)
  user_input.to_i - 1
end

def player_move(board, index, marker)
 board[index] = marker
end

# TROUBLESHOOTING: I was amazed at how simple it is to convert a player’s input into integer ( .to_i) Super important: the use of = (assignment) is different then == (comparison). It took me 2 hours to figure out that I got an extra =.

CONDITIONS LOGIC TO CHECK IF POSITION IS TAKEN AND IF IT’S A VALID MOVE

def position_taken? (board, index)
  if board[index] == "" || board[index] == " " || board[index] == nil
    return false
  else
    return true
  end
end

def valid_move?(board, index)
  if !position_taken?(board, index) && (index).between?(0,8)
    return true
  else 
    return false
  end
end

# TROUBLESHOOTING: The use of ! in front of !positiontaken?(board, index) reads as position is NOT taken. This is a better way to set condition vs. before I was using the positiontaken?(board, index) == false. Linking || (or) && (and) is also very helpful.

ASKING FOR PLAYERS’ INPUTS, KEEP TRACK OF THE TURNS AND PLAYER’S MARKERS

def current_player(board)
  turn_count(board) % 2 == 0? "X" : "O"
end

def turn(board)
  puts "Please enter 1-9:"
  user_input = gets.strip
  index = input_to_index(user_input)
  if valid_move?(board, index)
    player_move(board, index, current_player(board))
    display_board(board)
  else
    turn(board)
  end
end

def turn_count(board)
  counter = 0
  board.each {|space|
    if space == "X" || space == "O"
      counter += 1   
    end
  }
  counter
end

# TROUBLESHOOTING: Again I was amazed at how simple it is to write the second the last line above: Is turncount(board) is divisible by 2 -> return “X”, if not, return “O”. It’s important that the playermove includes the current_player(board) so as to display the marker “X” or “O”.

CONDITIONS LOGOC TO FIND OUT IF THE GAME IS WON, FULL, DRAW, OR OVER

WIN_COMBINATIONS = [
  [0, 1, 2],
  [3, 4, 5],
  [6, 7, 8],
  [0, 3, 6],
  [1, 4, 7],
  [2, 5, 8],
  [0, 4, 8],
  [2, 4, 6]
]

def won?(board)
  WIN_COMBINATIONS.each do |single_win_combo|
    win_index_1 = single_win_combo[0]
    win_index_2 = single_win_combo[1]
    win_index_3 = single_win_combo[2]
    
    position_1 = board[win_index_1]
    position_2 = board[win_index_2]
    position_3 = board[win_index_3]
   
    if position_1 == position_2 && position_2 == position_3 && position_taken?(board, win_index_1)
      return single_win_combo
    end
  end
  return false
end

def full?(board)
  if board.any? {|index| index == nil || index == " "}
    return false
  else
    return true
  end
end

def draw?(board)
   if !won?(board) && full?(board)
     return true
   elsif!full?(board) && !won?(board)
     return false
   else won?(board)
     return false
   end
end

def over?(board)
  if draw?(board) || won?(board) || full?(board) 
    return true
  else
    return false
  end
end

# TROUBLESHOOTING: It’s important to think of position_1, position_2, position_3 as reusable and that they will cycle through all 9 spaces on the board. The elegance of comparing them to each other also got me. In draw?(board), the appearance and sequence of won?(board) and full?(board) matter.

SET UP FOR THE ENTIRE PLAY AND WINNER ANNOUNCEMENT

def winner(board)
  if won?(board)
    return board[won?(board)[0]]
  end
end

def play(board)
  counter = 0
  until counter == 9
  turn(board)
  counter += 1
  end
end

def play(board)
  until over?(board)
    turn(board) 
  end
  if won?(board)
    winner(board) == "X" || winner(board) == "O"
    puts "Congratulations #{winner(board)}!"
  else draw?(board)
    puts "Cat\'s Game!"
  end
end

# TROUBLESHOOTING: I had a hard time (still do) associating and differentiating won?(board)[0] and single_win_combo and position_1. I think an important take away for me is the difference between being INSIDE the method vs. ability to use output OUTSIDE of the method.

Reach out if you’re learning too and want to share.

Son Doong Cave - Explore The Largest Cave in the World

Why am I writing this blog post?

It's important to state clear my intention in writing this post. I want to preserve Son Doong Cave as it is, despite all of efforts to commercialize into massive tours. Ironically, the way to preserve is through more people seeing Son doong either through small guided eco-tours or by reading about it. Hope you will see that Son Doong is a world treasure belonging to everyone, not just a person or a country. I hope the Unesco sees this cleary as well.

My second goal is to share my own experience in prepping and exploring the cave with the hope to peak your interest and prepare you for the AMAZING adventure!

What makes Son Doong Cave unique?

You might have heard that Son Doong is the largest cave in the world. What does that mean really? Son Doong Cave is 9 kilometres (5.6 mi) long, 200 metres (660 ft) high and 150 metres (490 ft) wide. That's twice the size of the next largest passage in Malaysia. To put that in perspective, you can fit the Giza pyramid inside sections of Son Doong. It is estimated to be between 2 and 5 millions years old.

Source: Oxalis Adventure Tour Co.

Source: Oxalis Adventure Tour Co.

Son Doong is also unique because it has been preserved since the Earth creation and was only explored thoroughly starting 2009. When you are in Son Doong, every rock, trees, drop of water, might not have been touch for millions of years. Just there patiently waiting and evolving.

There are two forests within Son Doong, situated at the two dolines (openings made when part of the cave collapsed) along the long cave. Multiple freshwater pools, fossils, vegetation and ecosystem made the ecosystem in Son Doong one of the most ancient and untouched in the world.

The people behind Son Doong Cave discovery:
1990 Ho Khanh
2009 British Cave Research Association led by Howard Limbert
The porters

I was fortunate to speak to both of these adventurers. Howard told me "I've been actively taking people one by one to Son Doong so that they realize how special it is. [That] it is something we need to preserve and protect. The Vietnamese should see for themselves and know what they have."

I would argue that not only the Vietnamese but the world should recognized Son Doong for the natural wonder that it is.

Can't wait to hear more? Email me.

Making a continent green - how Asia is rescuing itself from self-destruction

THE SITUATION The world depends on Asia to deliver cheap goods at lighting speed. Many of the world’s largest corporations hold production facilities in countries such as China, Vietnam, Thailand, and Myanmar. If China can build a 57-story building in 19 days[1], of course, China can produce 15 billion disposable plastic lunch boxes every year[2]. The world demands products that are cheap, fast, and of good quality, no matter the cost.

THE CHALLENGES

As a result of these forcible productions, Asia is facing issues of startling growth, rapid urbanization, and natural resource depletion. In 2016, Asia is the largest producer of carbon dioxide[3]. China, the number one country on the carbon dioxide emissions list, has the total CO2 emissions of the next four countries combined. According to the Population Reference Bureau, more than 60 percent of the increase in the world's urban population over the next three decades will occur in Asia, particularly in China and India, but also in Pakistan, Bangladesh, the Philippines, and Vietnam.[4] The growing concentrated population in cramped space threatens stable building developments, reliable transportation infrastructure, and healthy living spaces.

The rest of the world is worried. How can we help Asia cool down before the damages are spilled into other parts of the world? How can we infuse sustainable practices into some of the world's fastest growing economies while running at their exponentially growth rate?

Some say we need to apply pressure from the outside, pressure from powerful forces such as the U.S. and the European Union. However, the true answers come from within Asia, where a growing number of sustainable design advocates are bonding together, gaining governmental supports and taking initiatives on their own to ensure a better state for the continent. They are addressing Asia’s challenges in ways that only insiders with a global perspective can.

Below we’ll discuss some of the initiatives taking shape in Asia with a focus on those happening in mega cities such as Seoul, Kuala Lumpur, and Taipei (to name a few). These cities and their people are leading the charge to integrate green spaces and sustainable practice into the urban city layout and the modern consumption behaviors.

Skygarden brings green back to city center | Seoul, Korea

Seoul, South Korea’s capital and economic center, has 10.1 million residents which make up a fifth of the South Korea’s population.[5] To fight back the color of concrete and bricks, the city of Seoul is transforming the 938-meter section of an elevated highway into public space[6] and gives it a name of Seoul Skygarden. This once brick-and-mortar structure will house over 254 species of plants[7], not so foreign from the NYC’s Highline. Seoul plans to complete the Seoul Skygarden in 2017.[8]

LEDs lid up the streets | Hanoi, Vietnam

According to the Southeast Asia LED Lighting Market Scale and Trends in 2016, Vietnam has the most rapid growth in LED lighting market share among the major Southeast Asian nations, maintaining a year-over-year increase of more than 60 percent between 2013 and 2015.[9] In the capital, Hanoi, the government and the public are pushing to replace the public street light system with LED lights.[10]

Creating a cycling kingdom | Taipei, Taiwan

“How can cycling contribute to urban transportation? Can the European models for ‘cycling cities’ be adapted to Asia?” These are the throbbing questions at the Velo-city Global 2016 cycling conference in Taipei.[11] Started by the European Cyclists’ Federation in 1980, the Velo-city global conference series is designed to “plug cycling as a sustainable mode of transport for a liveable city”.[12] Previous host cities have included London, Vienna, Barcelona, Vancouver, and Adelaide. This year, the conference is hosted in Taipei, Taiwan, a city with challenges not unknown to other Asian cities: limited land, dense population, and unbelievable growth. As of 2015, Taipei has 112-kilometer riverside bike paths, 382-kilometer urban bike lanes, ten leisure bicycle rental stations, and 26,000 bicycle parking spaces across the city. [13] Besides its world class’ YouBike public bike-sharing system[14], the city plans to introduce shared cars and electric motorcycles. By 2020, commutes via green transport should account for 70% of all trips with cycling taking up 12%![15]

Building to last | Kuala Lumpur, Malaysia & Ho Chi Minh City, Vietnam

Asia is growing quickly in the green building category.  By 2020, Asia is estimated to be the fastest-growing region of the world at 7% a year[16]. In Singapore, 1,800 buildings are listed with Green Mark. In Malaysia, more than 500 are registered on the country’s Green Building Index.[17] Though these numbers seem small in comparison to those from the European cities or the United States, they mark Asia’s positive focus on green and smart buildings.

 

The recent International Construction Week Southeast Asia 2016 (April 11-15, 2016) in Kuala Lumpur[18] also shows the continent’s interest in sustainable construction. The conference attracted 100+ exhibitors and 10,000 attendees.[19] It brings together corporations and industry experts to share and learn from the cutting edge sustainable technologies in building constructions and infrastructure. The conference hosts seminars with special a focus on nuclear energy and technology. In addition, its three subsections: EcoBuild, EcoLight, and Solar Asia each deals with the latest technology and management to promote long-lasting, energy-saving and human-centric solutions in these respective fields.

Learning from this conference show positive developments in many Asian countries. According to EcoLight and LEDInside[20], Indonesia holds great LED market potential due to its government commitment to the energy saving policies[21], the fast growing economy in Vietnam will strongly stimulate demand for LED lighting products[22], and the India government plans to completely replace home-use lighting and street lamps in 100 cities by March 2019.[23] Additionally, according to research and consulting firm GlobalData, the Asia-Pacific (APAC) region will overtake Europe to become the largest contributor to global solar Photovoltaic (PV) capacity installations, increasing its cumulative installed capacity 5 times by 2025.[24]

On the architectural front, architects like Vo Trong Nghia[25] represents a new breed of talented passionate architects in Asia who care about green tech and green energy. His firm pioneers the use of bamboo as the alternative building material through projects such as the Vietnam Pavilion for Expo Milan 2015. In responding to the theme “feeding the planet, energy for life”, the temporary bamboo structure can be easily dissembled and reused after the event.[26] Bamboo, also known as green steel, is durable, inexpensive, and sustainable. Vo’s other projects such as the rooftop pavilion made entirely of bamboo and ropes[27] or plant-covered municipal building with green balconies on every level[28] explore the possibility of using sustainable local materials to achieve high aesthetic.

Upcycle in India

India is leading the charge in reusing and recycling every day’s objects. According to the Environmental Protection Agency, 15.1 million tons of textile waste was generated in 2013, of which 12.8 million tons were discarded.[29] The United States is the biggest exporter of used clothes, and the top importing countries of used clothing are India, Russia, and Pakistan.[30]

In India, a small startup named Bakeys[31] found a problem so unnerving and a solution so human, their Kickstarter campaign[32] beat the goal by 500%. Bakeys has found a market and a niche to produce edible utensils. According to the company’s claim, they can produce 100 sorghum-based spoons with the energy it takes to produce 1 plastic one[33], which makes this solution an attractive alternative to disposable plastic/wood cutlery and bamboo chopsticks.[34] The edible utensils are even made with flavors that are deeply rooted in the Indian culture: hot n spicy, onion and tomato, garlic, ginger, spicy or sweet.

MOVING FORWARD

In order to drive these initiatives forward, Asia has to rely on the governmental and private funding, support, and its young highly educated workforce, all are in abundant supply.

Asian countries and governments are stepping up to the challenge of building a more sustainable system that can support their exponential growth. The word “innovation” is repeated 71 times in the Chinese government’s next five-year plan.[35] China’s National Energy Administration (NEA) announced that 2016 starts off right with 52% increase in solar capacity[36], getting towards its promise to cut power sector emissions 60% by 2020.[37]

In addition, both private funds and governments throw money into the pot to encourage startups and expand opportunities for social enterprises in Asia. Thailand government recently launched a $570 millions venture fund to launch its startup scene.[38] Well-positioned startup funds such as 500 Startups is also pouring funds into Southeast Asia, with its most recent $10M pump into Vietnam.[39] If this is not impressive enough for you, the Chinese state-backed VCs managed about 2.2 trillion yuan ($339 billion), ready to give out to ventures.[40]

Not only is Asia well funded and has accumulated tremendous support from its governments, it also retains a highly educated work force. In 2015, 459,800 Chinese students alone went abroad to study[41]. Not to mention India, Vietnam, Korea, Thailand. Of the 4.2B people in Asia[42], we have enough people to start a green movement, and we hope you’ll join us.

[1] http://www.theguardian.com/world/2015/apr/30/chinese-construction-firm-erects-57-storey-skyscraper-in-19-days

[2] http://www.scmp.com/article/1711744/china-produces-about-third-plastic-waste-polluting-worlds-oceans-says-report

[3] http://www.statista.com/statistics/271748/the-largest-emitters-of-co2-in-the-world/

[4] http://www.prb.org/Publications/Articles/2001/UrbanizationTakesonNewDimensionsinAsiasPopulationGiants.aspx

[5] https://en.wikipedia.org/wiki/Seoul

[6] https://www.mvrdv.nl/projects/seoul-skygarden

[7] https://www.mvrdv.nl/projects/seoul-skygarden

[8] http://www.futurarc.com/index.cfm/projects/2016-jan-to-jun/2016-mar-apr-seoul-skygarden/

[9] http://www.ledinside.com/node/25219

[10] http://www.ledinside.com/news/2016/4/vietnam_capital_pushes_for_led_public_lighting_system

[11] http://www.star2.com/travel/adventure/2016/04/16/cycling-your-way-to-a-traffic-jam-free-city/

[12] http://www.star2.com/travel/adventure/2016/04/16/cycling-your-way-to-a-traffic-jam-free-city/

[13] http://www.velo-city2016.com/index.php/en/about/why-taipei-taiwan

[14] https://taipei.youbike.com.tw/en/index.php

[15] http://www.star2.com/travel/adventure/2016/04/16/cycling-your-way-to-a-traffic-jam-free-city/

[16] http://nesea.org/conversation/community-blog/southeast-asia-expanding-market-green-buildings

[17] http://sea-globe.com/whos-afraid-of-the-big-green-monster-green-architecture-vietnam-southeast-asia-globe/

[18] EcoBuild Southeast Asia Conference http://www.ecobuildsea.com/

[19] http://www.ecobuildsea.com/NEWS/Press-Release-1

[20] http://www.ledinside.com/

[21] http://www.ledinside.com/news/2016/3/indonesian_led_lighting_demands_propelled_by_increasing_electrification_ratio

[22] http://www.ledinside.com/news/2016/4/vietnam_capital_pushes_for_led_public_lighting_system

[23] http://www.ledinside.com/news/2016/3/bengaluru_gives_out_more_than_5m_led_bulbs_to_local_residents

[24] http://cms02.ubmmalaysia.com/Portals/19/SolarAsia%202016_lowres.pdf?timestamp=1450066750551

[25] http://votrongnghia.com/

[26] http://www.designboom.com/architecture/vietnam-pavilion-expo-milan-2015-vo-trong-nghia-05-04-2015/

[27] http://inhabitat.com/vo-trong-nghia-builds-a-lush-rooftop-pavilion-with-nothing-but-bamboo-pegs-and-rope/usersoonishikunikodesktop308_gallery-mapublishdwggma_sec-2/

[28] http://inhabitat.com/green-city-hall-proposal-in-vietnam-doubles-as-a-verdant-vertical-park/

[29] http://www.npr.org/2016/04/08/473513620/what-happens-when-fashion-becomes-fast-disposable-and-cheap

[30] http://www.npr.org/2016/04/08/473513620/what-happens-when-fashion-becomes-fast-disposable-and-cheap

[31] http://www.bakeys.com/

[32] https://www.kickstarter.com/projects/1240116767/edible-cutlery-the-future-of-eco-friendly-utensils?ref=nav_search

[33] https://www.kickstarter.com/projects/1240116767/edible-cutlery-the-future-of-eco-friendly-utensils/description

[34] https://www.kickstarter.com/projects/1240116767/edible-cutlery-the-future-of-eco-friendly-utensils/description

[35] http://techcrunch.com/2015/12/26/china-scaling-the-worlds-highest-innovation-peaks/

[36] https://cleantechnica.com/2016/04/26/total-cumulative-solar-capacity-china-passes-50-gw/

[37] http://www.theguardian.com/environment/2015/dec/02/china-says-it-will-cut-power-sector-emissions-60-by-2020

[38] https://www.techinasia.com/thailand-fund-startups

[39] http://500.co/vietnam/

[40] http://www.dealstreetasia.com/stories/china-government-is-bankrolling-the-boom-in-startup-fundraising-38950/

[41] http://monitor.icef.com/2015/03/number-of-chinese-outbound-students-up-by-11-in-2014/

[42] https://en.wikipedia.org/wiki/List_of_Asian_countries_by_population