2015-10-25

Never too late to learn computer: What does it mean 8GB on my USB stick?

Introduction

I recently help some people who said ``I don't understand how to use my computer, but I want to do something.'' I found these people have interesting questions. So I write them that story here.

What does it mean 8GB on my USB stick?

Some of my friends work on a social movement. They want to study something, they want to tell something to people and they want to discuss about it with others. For example, what is nationality of children when a couple married internationally? Are there any rights differing with others? They want to study these questions themselves. Usually it is deeply connected to their life.
Here is a woman, who researched on a certain subject. She got a video materials and she wanted to share it with others. ``I don't know how to do that, but I want to show these materials to some people.'' This time I have a chance to help her. What she wanted was to show this video to around 30 people by a video projector.

She told me a compute is just a magic. However, she has a desktop computer and she can read and write emails. She can also browse the web pages. I thought that is enough. She can use a computer. If she told me, ``I can not type the keyboard,'' that would be hard. However, she has already had some knowledge. So we started.

First, we got a permission from the producer and the director to show it under some condition. Also she found a small place for 30 people with a video projector. One of her friends rents her a notebook computer, but it has no DVD drive. Her friend told her, ``you need a USB stick to hold the video.''  So the question was,
``I have 8GW stick, unused, does it work?''
8GW?  That's the power more than Kashiwazaki-Kariwa nuclear power plant, the largest nuclear power plant in the world. What on the earth does she have in her hand? It turned out 8GB. In German, W and B have somewhat similar pronunciation.

She told me, she has no idea, what these numbers and words, like what does GB means. She wanted to know it. I started explaining, but how much I should explain was not clear. There was a back and forth. At the end, the explanation was the following.

A computer usually stores information as `a file.' It originally means a paper file. It holds some papers to organize them. Computer uses this as an analogy to keep the information. A file in a computer has a size. The unit of size is called byte, written as 'B'.

One byte (1B) can hold roughly one Latin character information. If you need to remember 10 characters, then you need 10 bytes (10B). Computers only remember numbers, thus 1B storage actually holds a number. 1B can hold a number from 0 to 255. A typical Latin characters are: numbers ('0', '1', ..., '9'), small letters ('a', 'b', ..., 'z'), capital letters ('A', 'B', ..., 'Z'), symbols ('!', '#', '*', ...). 256 is enough large number to distinguish them. There are some tables that which number is corresponding to which character. The most widely used table is called ASCII (American Standard Code for Information Interchange. See https://en.wikipedia.org/wiki/ASCII). For instance, the character 'A' is represented by 65. (However, you see this method can only keep 256 kinds of characters and cannot hold Chinese or Japanese characters.)

Now you know what is `B' in 8GB. What is `G' after the 8?  This `G' is called SI metric prefix (https://en.wikipedia.org/wiki/Metric_prefix). It represents a large number of a small number with a power of ten. SI stands for ``Le Système International d'Unités'' in French, it means a International Systems of Units. Does it sound too complicated? I believe you already know some of them. For example, a prefix represents 1000 is k, called kilo. One thousandths is m, called milli. (Actually a computer usually uses binary numbers, so it is 1024 instead of 1000 for kilo. However, I explain the system with decimal numbers here for simplicity. Let's learn one by one.)

Examples of SI prefixes.

Multiples Symbol reading Word origin
l/1000000000 
n
nano
``dwarf'' in Greek
1/1000000
μ
micro
``small'' in Greek
1/1000
m
milli
``thousandth'' in Latin
1
1000
k
kilo
`thousand'' in Greek
1000000
M
Mega
`Great'' in Greek
1000000000
G
Giga
`Giant'' in Greek
1000000000000
T
Tera
`Monster'' in Greek

1KB means 1000B (in decimal). 1KB memory can store 1000 Latin characters. 1MB is a million B, and 1MB memory can store one million Latin characters.

These prefixes are based on Greek or Latin, so you can find related words. Sometime you can say something large things as Giga- or Mega-. There is a product called ``iPad nano.'' This means a small iPad. A small film is called microfilm. A small software company called Microsoft, ... no, this case, it is just a name. :-)

These k or M are prefixes and not only for B (byte). You can use them for other units, too. For example, m is a unit of length (meter). You can put k before m, km (kilometer). I don't see 1 Mm, still it should be valid. I don't know why I don't see 1Mm, it is usually written as 1000km. If you put a mass unit, g, 1000g is 1kg (kilogram). The unit of power is W (Watt), 1000W is 1kW, and 1000kW is 1MW.

Here is a rule of thumb of the size: a standard CD-ROM (compact disk read only memory) can hold approximately 650MB. A standard DVD-ROM (digital versatile disc read only memory) can hold 4.7GB. There are a few different format, so the size may differ, but there are good approximations. How long music or movie can these size hold? That actually depends on encoding/compression technology. Typically, a CD-ROM can hold 70 minutes sounds and a DVD-ROM can hold a two hours movie. Your computer's hard disk size is typically a few hundreds GB or a few TB in 2015.

The first question of my friend was ``I have 8GB stick, unused, does it work?'' (Here I fixed 8GW to 8GB.) If I know what is the size of her documentary movie files, then I can answer the question. She had 5 movie files, each of them is around 3 to 4 GB, but all of them are less than 4GB. They are 90 minutes to 120 minutes movie files. So, the answer is `No.' We need at least a 20GB USB stick if she wants to put all the movies in one USB stick.

I hope now you understand what the meaning of this three letters, 8GB. (I have not explained what is `8', but I think you know it.)

Summary

  • I think you have an ability to use the computer if you can use emails and you can search on the web. I found some people just afraid a computer, but it is just a tool. Of course, you need some cautious to use a computer. But, you don't need to afraid of it. You can learn and understand it at some extent.
  • How much information can a compute hold is measured by the unit B (byte). One byte can hold one Latin character.
  • To express a large number or a small number easily, we use SI-prefixes. For example, 1,000 is represented by k (kilo), 1,000,000 is represented by M (mega).
  • 8GB USB stick can hold around 8,000,000,000 Latin characters. This can usually hold two two hours movies.

2015-09-27

Egon the rabbit and me: Refugees

I: These days, a lot of war refugees are coming.

Egon: If you talk about nothing can help human being, I had enough from you. You could live like rabbits. You could live like clever dolphins.

I: When I think about the cause, yes, nothing can help human being. The people who made the cause don't care at all at far distance. I just think about connection with me.

Egon: You have any connection with refugees?

I: Refugees are enormous chance for this country, at the same time, they are huge danger, too. This country has the aging problem, decreasing population problem. If 800,000 refugees could be the positive power for this country, this country would have huge success. If they join to the industry of this country, contribute to the knowledge, pay tax, pension, medical insurance, ... what a enormous chance. On the other hand, if they became just a burden, that would be a huge problem.

Egon: Human always fail since they are stupid. Even they know it, they will fail.

I: I think this is similar to the child education. Child education is a enormous chance. But if someone did without love, the failure is unavoidable. I teach math to children two hours per week. I hope this helps children. Actually, this helps me a lot. I found it is fun. Taking care of my friend's children is also fun. Although, that might be because it is just a one or two days per month.

Egon: Then, you are now talking with a rabbit. Are you OK? I am afraid that your math students are OK or not.

I: Actually, I like people of this country. Well, probably a specific country doesn't matter. I like people in general.

Egon: You sounds like strange as a human being.

I: I would like to teach math to children of refugees. If my German or English is fine, I would like to teach if there is some demand. I would like to learn their idea.

Egon: Is it your idea? How much you can do? It doesn't make sense if you could not continue for a long time.

I: I think I can do it two hours per week.

Egon: Humm. You sounds like you are a big mouse and do too little.

I: I did teach four hours per week for two years, I still want to teach Berlin kids two hours per week, so maybe two hours per week for refugees is a good amount.

Egon: ...

I: A big chance is simultaneously a big danger. In the case of the child education, you usually have more time. But, I am thinking two years later. In 2017, the people of this country don't like foreign people or not is depends on now.

Egon: What is your expectation?

I: I don't know. One of my friends, who is not a xenophobia, expects the government will fail.

Egon: First of all, a xenophobia cannot be your friend. You don't need explain that. Will you prepare to run away from here?

I: Not really. One man in this country attacked me. But many people accepted me. So I will be a part time fighter.

Egon: Fighter? A part time?

I: A fighter to incomprehension and intolerance. I will fight them by part time, two hours a week, with a weapon called teaching. No military power won incomprehension and intolerance. I believe my part time fight has much more chance.

Egon: You can always win by a military power. Human being has a power to self destruction. Only human being can be incomprehension and intolerance. Think logically, if there is no human being in the world, all the problem will be solved.

I: When all the strange people like me, and everyone becomes normal. The self destruction of human being will be realized. So I just postpone to think about that happens when it happened.

Egon: Then, where do you start.

I: This one. Conversation with you, Egon.

Egon: ...

To the Readers of this blog. When you know something I could do for refugees in Berlin. Please leave it as a comment. Thank you!

Egon the rabbit and me: Inconvenient brain

``If the school year was a month, I would be 25th grade.'', said a eight  years old girl to me. ``Yes, if a month had four weeks, and a week was the school year, what you will be?'' But she has already lost her interest. I usually found her idea interesting.

I: Egon, do you love someone?

Egon: Love? What does it mean?

I: ... It's hard to explain. If I love someone, I care someone, I wish this someone is all right, I wish this someone is happy.

Egon: If that is the love, maybe I love everything.

I: I love someone. But not everyone.

Egon: Why not?

I: I don't know. If I love a woman, I wanted to be with her. But not all women.

Egon: I see you love someone, but why you want to be with her?

I: I don't know why. But usually if I love someone, I want to be with someone.

Egon: Sounds good.

I: I don't know. Actually it's not good in case that someone whom I love doesn't like me. A few women honestly told me that is disgusting and two women made it clear that I am disgusting.

One of Egon's ear is listening to me, but the other ear is pointed to somewhere else. Maybe he is bored talking with me.

I: I like a story. In the story, one man send a flower everyday to a woman. He spends some time with her every day. But the woman is sick or something and may not survive so long. One day, a gray man came to him and said he was wasting his time.

Egon: ...

I: I think he is not wasting time.

Egon: Wasting time or not is just a perception.

I: A gray man's point is he could find other woman who could spend more time with him. One point in the future, he lost her and it would be hard for him.

Egon: Every second there is a chance to lose something. A long life is not necessary good.

I felt a cool wind, I felt gentle sunshine. I heard Egon is eating leaves.

I: Are you happy, Egon?

Egon: I don't know what your question is. Why you asked me?

I: I use to think happiness is important. But, I am now not sure of that. When I see you, I think that thinking happiness sometimes causes me unhappy.

Egon: But you cannot stop thinking, can you?

I: I cannot.

Egon: You were also once like that eight years old girl. She told me you look sometimes sad.

I: I am not sure I am sad or not. But I better consider her intuition.

Egon: It seems you know what your heart talk, but you cannot follow that. I found your brain is inconvenient. You can think, you can feel, that makes you sad.

An inconvenient brain. Too much is too less. If I could think more, that makes me sad. If I could feel joy more, I can also feel more pain. The gray man also represents so called reasonable idea. What did Bernard Shaw say about a reasonable person...

By the way, 100th grade is the answer of the early question. You would say that I only have a lot of stupid answers, but I don't have any important answer, Egon.

Acknowledgments


I thank to I.M.R. who told me a grade could be just an arbitrary number.


2015-09-26

Egon the rabbit and me: The wonder of finding an invisible planet (3)

Part 3

I: We could continue the story about cage. I actually think thorough it. However, I haven't had a clear idea on it yet. I would like to back to the story about finding invisible planet. How the wonder changes to a great thing.

Egon: ...

I: A person found the ``Things fall down'' and ``how the planets move'' are based on the same rule. People calculate the orbit of planets, they found every planet follows the rule. Someone found a new dwarf planet by a telescope, it also followed the rule. At least people could not find a planet that doesn't follow the rule in the solar system. When a better telescope was created, the telescope found a new planet, still the planet follows the rule. People started believing ``Things fall down in the universe.''

Egon: You, or human being observes the universe and found the same rule many times. No exception could be found.

I: Actually they found an exception. One planet doesn't follow the rule exactly. Its orbit was only slightly differs from the expected orbit, but still unexpected. People had two opinions for this. The first idea is the rule, the law of gravity, has something wrong. It maybe a good approximation, but not exactly correct.

Egon: ...

I: The second idea is we have an invisible planet somewhere, that causes this unexpected movement. The second idea still believes the law of gravity is correct, just we don't have enough knowledge of the solar system yet.

Egon: You believe the ``Things fall down'' rule, and tend to have the second idea. When everything is expected, you think your knowledge of the solar system is completed.

I: Yes. Maybe that is the reason I don't feel this is a magic. If we could not find the invisible planet as we computed, this is more big problem for me. Since the law of gravity doesn't work, ``Things doesn't fall down there.'' Things doesn't fall at somewhere, I could not believe that. So I rather believe there is an invisible planet. Then, people found the planet as they computed, this is no magic, but it is a great things. We maybe have some understanding of part of the universe. I still have a consistent world. That could be the foundation of the next understanding. Isn't it a great thing?

Egon: I'm not sure. You told me you don't know the origin of the gravity. You only know how it behave as a law. Your law of gravity could be a special case of more large law.  Then your friend may think, there could be a planet that doesn't follow the law of gravity. Because it is just a special case. It's great if you can fly around without wings. ``Things fall'' can be wrong at somewhere in the universe.

I: I cannot against that idea. I only know the law. It's like when I try to fix my program, I only know when I push this button, then the program crashes. But I don't know why, what did I wrong. I only know the push-this-button-crash-the-program as a law.  You might be right. But, the physicists observe the universe quite a lot and they now believe ``Things fall down in the universe.'' I also believe it. The law of preservation of energy, the law of inertial, and so on, are basically the same. Ultimately, we don't know why, but the observation are the same all the time, therefore, we call them ``a law.''  It is always so, I don't feel it's a magic.

Egon: Your friend might be a genus. Since she might think it is a magic.

I: By the way, one of my physics teacher asked me at one exam, ``Why the things fall?'' I answer, ``I don't know.'' The teacher said, ``Because there is the law of gravity.'' So, I understood this teacher doesn't know what the law of gravity means.

Egon: People tend to think if there is a name, they think they know it. First time we met, you ask to kids, ``What is this?'' ``It's  Egon the rabbit.'' ``I see.'' What did you see, really? What did you know about me?

I: I just know you have a name. I know nothing about you, of course. I lived in not my born place. Some people asked me, ``Where are you come from?'' I answered my born country's name. It is nice if the conversation expands, but, some people behave as they understand my personality and everything because where I was born. I know that's impossible. When I know you are a rabbit, how I could understand any of your personality? I know I just know you are a rabbit whose name is Egon.

Egon: OK.

I: ... I feel no magic on some preservation law. For me, something is gone, it means someone took it. Things don't magically disappear. If I keep some cookies at my home and one point they disappear, at that time, one of my friend visited my place. I don't eat that cookies, then?

Egon: You don't think your cookies walk away. You think your friend ate them.

I: Yes. There is the preservation law of cookies. The amount of cookies in my home are preserved unless someone ate them. I believe the preservation law of cookies. If I cannot see them, someone ate them. Even I didn't see who ate them, I believe someone must ate them. It's the same that a visible planet moves unexpected way, there must be an invisible planet.

Egon: You are old, you just forget you ate them. ``Things fall down.'' Your cookies may fall down under the table.

I: If I forget, well, still someone (which is me) ate them. So the cookies preservation law still hold. Under my table is still in my room. The cookies preservation law holds, either. This comes from Feynman 's ``Dennis the Menace'' story. This story is fantastic and ...

Egon: You believe in your small world. It sounds like against your learning story.

I: If I just believe it, I stay in my world. But, I will see outside based on my belief, and this is a difference from just staying my world. I always look outside based on my belief to expand my ``consistent'' world. I am standing inside my world, but, look at outside.

Egon: ...

I: When I found a case that doesn't hold the preservation law, I know I am on the edge of my world and I am facing the outside of my world. If I could not find my cookies, I could not find it in my room, friends were there but they didn't take them, I haven't eaten them either... But I found my room has more carbon dioxide than before and increasing the temperature a bit. Maybe my friend burned my cookies whatever the reason. These cookies are still in the room by the form of carbon dioxide gas. I need to expand my cookie preservation law. It looks no more cookies, but atoms are preserved. This is how science progress. To make my own world larger, I always need to find something wonder. When we understand them, we lost a wonder, but still we have a new great thing. This is one of my favorite part of science.

Egon: Then, you still believe the cookie preservation law holds in other houses on the earth. It's like a religion that you ``believe'' it.

I: I think science is a kind of religion. The dogma is ``human being can correctly understand a part of universe.'' But, we need facts that can be measured by machines. Someone said this is right doesn't matter in the science, we always need to reproduce the law independently. There is a small difference from many other religions.

He seems to lost the interest of the conversation with me. I explained the Feynman's ``Dennis the Menace'' story to him. But, Egon continues to eat leaves of carrots without any words.

Acknowledgments


Thanks for H.H. to give me the hint of this story. Thanks for my friends who discuss about the wonder with me. Thanks to my small students and also my small teachers who always gave me hints to re-think myself. I hope R.M. enjoy this story who inspire me a lot.

2015-09-24

Egon the rabbit and me: The wonder of finding an invisible planet (2)

Part 2

I: Something rings a bell. Why I don't feel wonder for finding an invisible planet by the law of gravity. One reason may be because my world has been a little bit expanded. However, I don't think that is enough large. I feel there still is a huge world that I don't know yet. So I hope I am not such arrogant that I think I know everything and thus I don't feel wonder anymore. I think I learn a little bit, so the wonders became knowledge. Some wonder and magic has changed to some great things, knowledge.

Egon: ...

I: I didn't find these knowledge by myself, I just learned. I hope I understand them, not just memorized them.

Egon: ...

I: It's not exactly accurate words, but the law of gravity is all about ``Things fall down''. Human being observed the universe for a long time, literally a few thousand years. And people found ``Things fall down'' in many places in the universe.

Egon: Human being accumulate such knowledge for a long time.

I: We don't know the reason of gravity. Recently, there is some progress about Higgs boson, thus, our knowledge is a bit expanded about the gravity. But, I think we still don't understand the origin of the gravity. Nevertheless, we always see the ``things fall down''.  I throw a stone, it falls down. Someone throws a ball, it falls down. If I jump, I fall down to the earth. If you jump, you will fall down to the earth.

Egon: No rabbit can be kept in the air. Some might say.

I: You might think it is normal. But ``normal'' is how I or you ``feel'', usually it is a fact that is familiar with me. However, familiar fact is not necessary to be a universal fact. It is just ``that was always true in my town.'' This is not necessary true in other towns.  We see ``things fall down'' on the earth all the time. But is it general in the universe?  How is it at 1000 light years away? How can you think the law of gravity is the same to on the earth at such far distance? If we visit to the moon, our weight becomes lighter. Do you still think the law of gravity is the same everywhere in the universe? (Though, the law of gravity on the moon is actually the same to the earth.)

Egon: Something is normal on the earth doesn't necessary true somewhere in the universe. Sounds reasonable.

I: I always see ``things fall down.'' Sometimes I think I found exceptions. For example, a bird flies, or a fire balloon floats, but if I think them more deeply, I always found they are not exceptions. A fire balloon falls down when it lost the heat, a bird cannot fly forever.  I don't know why, but ``Things always fall down.'' Physics can only describes how that force behaves, not why: Between two objects, there is a pulling force each other. That force is proportional to each mass, reciprocal to the square of the distance, and it is proportional to a constant.

Egon: That is just a detail.

I: We can write it as F = GMm/r^2. This is independent from some natural language, for instance, English, Japanese, German. And there is less ambiguity. So I found it useful, but, the meaning should be the same in any languages, English, German, Japanese, or math. One of the meaning of this is ``Things fall down.''

Egon: ...

I: ``Feeling normal'' is a kind of easy. But if I stay always in a certain normal situation, I could not expand my world. I could stay there. But, the world catches me at some point. Because the world is always changing. If I would like to live in the changing world, I need to update my world, too, I would like to expand my world bit by bit. I think this is learning. I am an software engineer. If I stop learning, I will be useless at some point. Because the technology is always evolving. I constantly need to expand my world, the world here is my knowledge and skills. I am in my knowledge world, that is easy since I already understand them. But, I cannot stand still if I work on this world. I need to study, confuse, make mistakes to understand the new area. That is a quite cumbersome work.

Egon: You made your cage and became familiar with that. But when you don't satisfied it anymore, you need to update it. Or the cage doesn't work at some point. On the other hand, your cage gives you some safety and comfort. You don't know whether your new cage will be comfortable and safe.

I: Any cage became old and I cannot live in it forever. Either I need to update my cage continuously or I need to build again when the cage collapsed. I rather try to update it continuously rather than experiencing a disaster. Most of catastrophe can be avoided if you respond early. I want to learn from other catastrophe.

Egon: You may need courage. You can ignore the outside of your world. You can hate the change and new things. You could hope you can still hide your mother's behind.  ``Please don't open the door. Let me alone. I love now, I familiar with it. Stop the world.'' This could be one way to live.

I: That's a choice. What is important is the issue. Any animal that has no interesting to the outside of the world, they usually tend to extinct. So the extinction is not an issue, such life is fine.

Egon: Even one is protected by a cage?

I: No cage can be perfect. It will break one day. I am just talking about the nature. If a group stays only one small place and never go outside of the region, they are in danger. For instance, natural disaster can destroy them. An outbreak can destroy them.  But this group is interested in outside the world, they will spread. Even one part of the group eliminated by a natural disaster or a disease outbreak, spread group has more chance to survive.  It is just a risk management. Don't put all one's eggs in one basket. Children are usually curious for many things. Because they need to adapt to the surrounding world. A life form has more chance to survive if it constantly breaks the own cage, expand to larger world, adapt to the world. Because the risk is distributed. I think it is wisdom to survive that people encourage to curious to other world. It is a kind of investment. There is a risk to expand, however, no investment means no success. Moreover, we have children. Children are new of the group. If you want to have nothing new, children are harmful for that idea. But, I think if we don't refuse existence of children, I don't see the future.

Egon: Future may be overrated. Some might welcome extinction. How you are so sure that having a future is good thing. Or you can be one of domestic animal. Someone else takes care of your cage. That would be one way to live.

I: I am not attracted those ideas.

Egon: I can imagine, a lot of people will take one month food for freedom and life.

I: ...

Egon: You once told me the difference between human and animal is human can see the future and make a plan for it, animal is otherwise. The world of rabbit and the world of human, which has more future?

I: ... ``If the bee extincted, all the life on the earth would die. If the human extincted, all other life would be flourish.''...

Egon: ...

The discussion goes to a bit different direction. I thought the feeling of wonder is needed for expanding my own world and break my cage. If I don't feel the wonder anymore, and I stop looking outside of the world, that day my mind and my possibility would die. It is hard to keep up the world. Sometimes I just wanted to stop looking around. Rejecting new idea and people sounds easy. I could stop learning something new. The problem is the time doesn't stand still. At this moment, someone new is born, someone find a new idea. The world is always changing. The old would die soon or later. Will I die together with them, or will I create the new world?  This is my decision. If a system harm us, will I die together, or will I create a new better system with some cost? I was thinking these ideas next to Egon.


(To be continued)

2015-09-23

Egon the rabbit and me: The wonder of finding an invisible planet (1)

Part 1


I feel peace when I sit beside Egon. He is just eating leaves of carrot. I talk with him. In reality, I may just talk with myself. Still I feel there is a conversation with him.

I: One of my friends told me, ``It's a wonder that mathematics and physics find an invisible planet by computing something. It's like a magic.''

Egon: ...

I: Actually I don't feel wonder. It's great we can find a planet, but I don't feel it as a magic.

Egon: ...

Egon usually doesn't answer a topic which he is not interested in. I thought he was not interested in this topic, but, actually not.

Egon: Thinking something wonder, it is great, I presume.

I: Humm, well, there is the law of gravity, and if you think it is real, finding an invisible planet is not a magic. It is a great thing, but not a magic.

Egon: Not that. The greatness of thinking wonder. I think you saw a lot of wonder or magics in the world when you are a child.

I: ...

Egon: If you lost your sense of wonder, I recommend that you think about it. Why you had a lot of wonder.

I: Why I had a sense of wonder. I still feel wonder, it is just different from before.

Egon: You are sure? I feel wonder when I couldn't find it in my world. I never saw something like that.

I: My world has expanded. So I lost the wonder?

Egon: The world, or the universe is huge. I don't know how large your world is. But, I bet your world is less than half of the universe.

I: ...

Egon: What do you say if I said, ``I am a rabbit, so I know everything about rabbit.''

I: I believe you don't know something about rabbit.

Egon: You gave me a mushroom yesterday. It was delicious. That was my first time of eating mushroom. It was a new discovery. I suppose there are more food in the world which I don't know yet.

I: Do you suggest that I don't look outside anymore because I am satisfied current my world?

Egon: Your friend is not a scientist, and not a child, isn't she?

I: No, she isn't.

Egon: That friend said, ``It's a wonder that mathematics and physics find an invisible planet by computing something. It's like a magic.'' How nice it is.

I: Someone who don't see the outside their world doesn't feel any wonder. Because everything around is familiar. Do you think I am in that situation?

Egon: Maybe.

I: I need to think what I still feel wonder.

Egon: Sounds good.

I try to remember when I had a lot of sense of wonder. Most of everything was magic. At that time, touching new knowledge was fun.  My family had a series of encyclopedia. I spend a lot of time for reading them: World climate, world map, history, plants, insects, fish, human body, and so on. I still remember the illustration of inside the earth, explanation of plate tectonics and the mechanism of earthquake. It also shows how the plates organized and the distribution of earthquake points and volcanoes, they match. It shows how we understand the relationship between earthquake and volcanoes. I just realized, my parents gave me some milestones here and there, even they didn't understand what is in the encyclopedia.

I and Egon had no words for a while. Because I was thinking about the wonder. I don't know why Egon was silent. Maybe he just didn't have a thing to talk. I wonder: Did I become arrogant? Did I think my world is enough large? Is that the reason I lost the sense of wonder?... Maybe I became arrogant, at least partially. But I think I am not yet completely arrogant. Some wonder might diminished because I could understand some of them now. I became familiar with my world. But I still have a huge unknown world beyond the edge of my small world. Expanding my world a bit, that might be a leaning. Therefore, my wonder thing became a great thing. I slowly started talking again.

(To be continued)

2015-09-10

Cover the bad 2015

Today I would like to introduce our new product, ``Cover the bad 2015 (model: black).''

Cover the bad 2015 (model: black)

I know, you think this is just a normal duct tape, but this product will improve your quality of life.

You identify a bad.
When you see this kind of sticker, that expanding a hate, it is not good  for your healthy mind. I know you pay the tax, you pay the pension for the elders, ... You wonder why someone returns the words like this. You must be shocked!

Now you can use ``Cover the bad 2015 (model: black)''. Let's cover it like this.

Usage of cover the bad 2015
How is that? Your pocket has a room for ``Cover the bad 2015 (model: black)''. For fashionable person like you, we have various models: red, yellow, orange, gray. Try it out today!

2015-08-27

Egon the rabbit and me

``Do you have a voice?'', I spontaneously asked a rabbit, when I was reading a economy book. ``It seems people's productivity is increasing, the world population is saturating, why does the world still have a lot of problems?''

The rabbit was looking at me. His name is Egon. Today is Stig's first day of school. ``You don't know why?'' Egon said so, or maybe a part of me told me as Egod told me. I answered, ``Yes, I don't know. I can say human being is stupid, but, that answer doesn't help me even if it is true.'' Egon kept silence, so I thought it was some audible hallucination.
Egon

I looked at the cage. ``Is your cage too small for you?'' I asked Egon.

Egon: ``It's small. I rather want to have large one. How is yours?''

I: ``... Mine? I don't have one.''

Egon: ``Don't you see yours? You made it yourself, and you put yourself in it. As far as I know, only human being does that.''

I: ``Do you mean jail? Usually no one wants to put themselves in it.''

Egon: ``No. don't you build a cage, called a city?''

I: ``... How a city can be a cage?''

Egon: ``Before you build a city. Everyone can sit anywhere. Now you can only freely sit your small part. Some people even doesn't have own place. Most of the city you cannot sit freely. Maybe you don't see the physical cage, but, what is the difference?''

I: ``... I see, interesting. I haven't think about the city in that way.''

Egon: ``Not only the physical ones. You build a system called capitalism or whatever. Then you put yourself in it. Even if you think it will be collapse or is dangerous, people like to put themselves in it. You even afraid to lose your cage.''

I: ``...''

Egon and me

Egon stopped talking here. I start realizing I am actually in a cage. No, I am in multiple cages. A city, political system, energy system, language I can use, ... I thought these are for better life, but Egon told me all of them can be limitation... a cage. I thought the human being is the third clever animal on the earth, but now I am thinking we are behind the rabbit, so at least forth.

Egon: ``You might overrated your life too much. You could find some balance.''

I: ``I overrated it too much. We made nations, army, political system, economy system, energy system, etc. to protect us, but actually they could also destroy us. Do you think this is our problem?''

Egon: ``Maybe so, maybe not.''

Sun is going down. Stig took out Egon from his cage and put him into his sleeping cage.  ``Egon, do you have a voice, like audible voice?'', I asked again. ``Is it really important? You take care the overrating something.'', he answered.

He was busy to eat his vegetable in the cage. ``Did he mean this is a kind of another cage? I always want to hear some audible voice? That is actually not so important?'' I am not sure at that time, but I think I saw Egon was smiling.

2015-08-10

Semi-automate timing generation method of video subtitles

Abstract

I voluntarily work on for free mathematics material translation for everyone. I have three main tasks in my workflow of this work: 1. script translation on a srt file, 2. dubbing the video, 3. subtitle generation. I found the subtitle timing generation is a time consuming task, so I want to reduce this. When I generate a subtitle, I already have the translated script and its video sound. So, I try to use these data to semi-automate the subtitle timing generation. This time I use the YouTube's transcript function to generate the subtitle timing. This can reduce the time of timing generation task. I implemented a srt file to text file conversion script since YouTube's transcript function requires text format data. YouTube's transcript function performs  not only the timing generation, it also edit the lines (put some newlines). Therefore, I implemented subtitle line concatenation script, too. One experiment shows that whole manual work took 4.5 hours to generate the subtitle timing for a 13 minutes video. With this method took around 3 hours to generate for similar length video. These scripts are published with new BSD license, so anyone can use freely.

Semi-automate timing generation method of video subtitles

I voluntarily work on for free mathematics material translation for everyone. These videos explain ``why a fraction division make the fraction upside down and multiply it?'' or ``In the first place, what  the meaning of division by a fraction? I know what is divided by  means, but what is the meaning of divided by 2/3?'' I also  subtitles for these videos, but it took a lot of time to generate subtitle timing. For example, once I took four and half hours to generate the subtitle timing for a 13 minutes video.

I voluntarily work on for free mathematics material translation for everyone. These videos explain ``why a fraction division make the fraction upside down and multiply it?'' or ``In the first place, what  the meaning of division by a fraction? I know what is divided by  means, but what is the meaning of divided by 2/3?'' I also  subtitles for these videos, but it took a lot of time to generate subtitle timing. For example, once I took four and half hours to generate the subtitle timing for a 13 minutes video.

But, when I generate the subtitle timing, I have already a translated script and the voice. I try to use these data to generate the subtitle timings as much as possible. This is a SubdayResearch theme this time.

One of my friend made a software that analyze mp3 file by FFT and get the rhythm from the file. He has an input device of a game, ``dance dance revolution'', however, he didn't have the game software. So, he wrote a game software to use the device. I first thought I needed to analyze the video file to generate the timing. Thus I discuss with him. However, he suggested me that first I should search such software, maybe I could find some free software to do that. In my case, I need Japanese voice analysis.

I search a subtitle generation software, and found some including YouTube's functionality. I found a software that generates many language subtitles. I read the document of it and found this software first generate the video language's subtitle by YouTube's automatic subtitle generation functions, then uses the Google translate to generate the other language subtitles.

As an experiment, I tried YouTube's automatic subtitle generation function. But, I could not get enough precise result by my voice. The precision of the timing seems fine, but the text quality is not. However, I only need the timing information, since I have already translated script. If I could map only the timing of automatically generated subtitle to the manually translated script, it would work. So, we have the following ideas:
  • Can we search the corresponding strings between automatically generated subtitle and the manually translated script assuming some amount of error in the strings?
  • If we have corresponding points, can we minimize the distance to compensate the errors? This could be an optimization problem respect to the string distance.
However, when I checked some automatically generated subtitles, the strings have too much errors and it seems difficult to use this idea.

I assume voice analysis is a difficult task, so I try to avoid to do that. I would like to solve my problem as less effort as possible. Though, I will put some effort if it is really needed.

I continue the discussion a few times in our lunch break (The discussion of SubdayResearch is usually at lunch break or in a party), we realized that my real problem is not the subtitle generation, but the subtitle timing generation. So, I search again with ``subtitle timing generation,'' not ``subtitle generation.'' Then, I found that YouTube has transcript function. This function generates a subtitle from the video and its contents text. Currently 10 languages are supported to generate the timings by YouTube.

The input of the transcript is a text + alpha. I manually generated a text file from a srt file and tried this function. The result is enough precise to use. However, the text is cut sometimes, maybe it try to fit the text in some length. I need to remove this for the further processing. At the end, I fine turn the result by amara or Camstasia (both are the software that can adjust the subtitle timing manually).

In the end, I need two simple filter scripts for my workflow.
  • A filter converts a srt file to text format
  • A filter removes the subtitle newlines in a  srt file

Implementation

These filters a published at the following URL:

The license is new BSD license, so everyone can use freely.

Experimental result and conclusion


I made two videos, both length are around 13 minutes about multiplication table. I generate the subtitle by fully manually and it took 4 hours 27 minutes for the first video. I use this method for the second video, it took 2 hours 37 minutes for the second video.

I think one and half hours is a good time reduction for this video.

Future work


I would like to try this method for further video creations.

I also look for any other (simple/easy) methods to reduce video creation
time.

Acknowledgments

Thanks for Dietger, Daniel, Jörg for discussions and ideas.


2015-07-28

70 years later

July 25th, 2015, we gathered in front of the building, that Harry S. Truman ordered to use atomic bombs. We made lanterns with praying we never use the atomic bombs again for killing. I feel praying only cannot solve anything. But I start praying and I would like to tell others there are some people who pray that.
Making lanterns

Put lanterns on the lake
Lanterns

2015-06-10

Learning Scratch (2)

My last blog entry, I briefly talk about what is Scratch. There are ``events'' and that is the trigger of the program. In this article, I would like to talk about one of my students who made a character animation program by Scratch.

Scratch provides key events. When I push the right arrow key, then ``right arrow key push event'' is triggered. When that event happened, I add 10 to the x coordinate of the cat. This means, when the right arrow button pushed, the cat move to the right for 10 steps. If I add more programs like the up arrow moves the cat to upper direction, I can control the cat position by the arrow keys. This is a cat control program.

Today, my student used a dragon. He wrote the same program with the cat. Then, the cat and the dragon move exactly the same way. Of course they should. A current computer is very fast, very precise, and very stupid. It does only what the developer wrote. My student asked me, how he can make the dragon faster. I answered, increase the moving step. Currently one key push moves the dragon ten unit steps. A speed is a moving distance in a certain time. If the step was increased to twenty from ten, the speed of the dragon becomes twice. While after, when I came back to him, he duplicated the key events. Interesting.

His method is the following: when the right arrow push event was triggered, two programs started in parallel. One program change the dragon's x coordinate plus 10, and another program does the same. In the end, the dragon's x coordinate increased by twenty. It seems the Scratch environment takes care the parallel change (i.e., locking), so this program works correctly. When he wanted to move the dragon three times faster than the cat, he copied the program again. What an interesting idea he had! Out of the blue, I recalled one scene of a cartoon, JoJo's Bizarre Adventure. (If you don't know it, please ignore the rest of the paragraph.) It's a scene that Jotaro floated in the air using his stand. He can move in the air by pushed his stand. My idea was increase the speed of the stand, but my student idea was increase the number of stands. Two stands can push twice faster, three stands can push three times faster.

But this student's idea can only make whole number times speed. He cannot make the dragon 1.5 times faster than the cat. Of course one program can push the dragon ten steps and another program can push the dragon five steps, make it 1.5 times faster. But then, there is not so much difference from one program pushed fifteen steps. His idea is just coping all the events and nothing more, still he can change the speed twice. However, if you learn the idea of generalization from mathematics, you will realize that which method can be applied to more situations. In this case, changing the speed itself in one program is better since you are not limited to multiple of positive integer (not only fractional times speed up, but you can stop and can also go backwards). If you learn computer science, the one program is considered better since the resource consumption of multi-threading, synchronization overhead, and so on. Also code maintenance point of view, one program is much easy to manage in general compare to the multiple copies of the program. Despite these disadvantages, I still like his idea, so free and unique.

When I saw 20 key events for handing four direction's control to speedup dragon five times faster (Figure 2), I was surprised by his idea, especially how freely and creatively he can think. At the same time, I felt the importance of the learning of basic concepts. I wish he will continue to learn without forgetting this thinking way, a free and creative way of thinking.

Figure 2. Using multiple same key events

Learning Scratch (1)

I teach Scratch [1], a computer programming language, to 10 to 12 years old students from last year. Sometimes they show me an interesting creative idea. I would like to write one of them here.

Before I explain what my students did, I will explain what is Scratch. First I will explain it in a conceptual way, then with an example. If someone can understand a conceptual explanation, he/she can apply the idea to many cases, but this is a bit difficult since their understanding must be deep. An explanation by example is rather easy to understand since it is shallow, that means you don't know it is still true in other cases. So there is a trade-off.

Scratch is a computer language, but also a programming environment.  In the environment, the developer writes event driven programs to control many sprite [2] characters. You can think each sprite character an object. Each event invokes a program and each program runs in parallel.

Maybe this explanation doesn't make sense for whom has never written a program. There are many conceptual words here: programming environment, sprite, event, object, and so on.. Each term is a concept in programming and we need to lean them. But I usually don't explain these concepts to 10 years old students. So I use examples. But I hope they can understand the concept in the future.

When you start scratch programming environment, there is a cat (Figure 1).  The developer writes a program what the cat does when something happened. ``Something happened'' means, for instance, a key is pushed, a mouse button is pushed. These ``something happened'' is called an ``event.'' An event starts a program. Such program can also create other events. This type of program is called an event driven program. Each character, for instance, a cat, a dog, and so forth, usually has an own state. The developer uses this state to write a program. Here ``a state'' is for example, where is the cat (position), which direction the cat is looking at (directional angle). An object is a programming instance that has a state. Here, you can consider that a cat is an object, a dog is also an object.
Figure 1. Scratch programming environment
In the scratch environment, the green flag button is the start button of the program. Most of the scratch programs use this green flag as the start event. For example, when the green flag button is pushed, the cat moves to the center of the screen and says ``Hello!'' I usually first tell my students about ``a coordinate system.'' My explanation is simple as ``x'' means left or right, ``y''means up or down. If you set both value to 0, the character moves to the center of the screen. When you make the x value large, the character moves to the right. In the scratch environment, the coordinates x and y are always shown. So I can show how the coordinates change as I move the character. When I catch the cat by the mouse (I mean a computer mouse), I say ``See, when the cat move to the right, the x value becomes larger.''  I drag the cat and move it around to show them.

This time I explained briefly what is Scratch. In the next blog entry, I would like to talk about 10 years old student story who made a character animation program on Scratch.

References

2015-06-06

Inter process communication by a shared memory

I made an experience for an inter process communication using a Unix shared memory on a host. I look up on the Internet, but I could not find a good example code. In the end, I found some explanation articles, some Stack overflow threads. (I might do something wrong when I search...)

Some pages suggest to use shmem_open() and mmap(), that is the POSIX direction. I think I can believe the discussion, so I implemented it the following way.

The basic idea is the following:
  1. A process creates an shared memory area using shm_open().  To identify the shared memory area between processes, we use an identifier string (e.g., ``identifier''). (On Linux environment, You can see via /dev/shmem, e.g., /dev/shmem/identifier .)
  2. All processes map that shared memory are to main memory using mmap(). When we succeeded mmap(), we obtained a shared memory pointer (shared_ptr).
  3. The processes can communicate via shared_ptr.
  4. When we finished to use the shared_ptr, remove the map using munmap().
  5. One of the process removes the shared memory object using shm_unlink().
The following implementation shows how two processes (server and client) communicate each other via a shared memory area. Here, the number of server processes and the number of client processes are both one. In this example, each process only writes a value to own area. Thus, we don't need a lock. Each process reads the other process's value and write one grater value of the read value at the own area. This is simple, but enough to demonstrate how to communicate between processes via a shared memory on a host. 

The following is the source code (shmem_test.cpp). You can find how to compile and run in the comment of the code.

/*
  Shared memory inter process communication minimal example
  Copyright (C) 2015 Hitoshi

  Compile:
    g++ shmem_test.cpp -o shmem_test -lrt

  Run (as a server):
    shmem_test server

  Run (as a client)
    shmem_test client

  Note: no locking. (but writes are not the same location.)

  Basic idea: server, shared memory creator

  1. Create a shared memory object by shm_open().
  2. Change the shared memory object by ftruncate().
  3. mmap the shared memory object to access via a pointer.
  4. Use the pointer to share the memory (may need lock, etc.)
  5. munmap the shared memory object
  6. Remove the shared memory object by shm_unlink()

  Basic idea: client

  1. Open the created shared memory object by shm_open().
  2. mmap the shared memory object to access via a pointer.
  3. Use the pointer to share the memory (may need lock, etc.)
  4. munmap the shared memory object

 */

#include <iostream>

#include <fcntl.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>

//----------------------------------------------------------------------
/// shard memory identifier name
const char* SHMEM_NAME = "/test.shmem";
/// shared memory size (align to the page size)
const size_t SHMEM_SIZE = 4096;

//----------------------------------------------------------------------
/// print out the usage and exit of this example
void usage_exit()
{
    std::cerr
        << "Shard memory inter process communication minimal test\n"
        << "shmem_test [server|client]\n"
        << "  server ... create/read/write shared memory\n"
        << "  client ... read/write shared memory"
        << std::endl;
    exit(1);
}

//----------------------------------------------------------------------
/// server
void run_server()
{
    // create/open the shared memory object
    int fd = shm_open(SHMEM_NAME,
                      // oflags
                      O_CREAT|  // create if not exist
                      // O_TRUNK|  // destroy once if exists
                      O_EXCL|   // error if exists
                      O_RDWR    // read/write
                      ,
                      // mode
                      S_IRUSR|  // user read
                      S_IWUSR   // user write
        );

    if (fd >= 0)
    {
        std::cout << "server: shmem_open succeed fd: " << fd << std::endl;
    }
    else
    {
        std::cerr << "server: shmem_open failed: " << fd
                  << ", if /dev/shm"    << SHMEM_NAME
                  << " exists, remove it." << std::endl;
        exit(1);
    }

    // resize the shmem object
    const int ret = ftruncate(fd, SHMEM_SIZE);
    if (ret != 0)
    {
        std::cerr << "Server: failed to ftrancate to " << SHMEM_SIZE
                  << std::endl;
        exit(1);
    }

    // get shmem address
    const size_t access_offset = 0;
    void* shmem_adder = mmap(0, SHMEM_SIZE,
                             // memory protection mode
                             PROT_READ| // Pages may be read.
                             PROT_WRITE // Pages may be written.
                             ,
                             // mapping flag
                             MAP_SHARED, // Share this mapping with other process
                             fd,
                             access_offset);
    if (shmem_adder == 0)
    {
        std::cerr << "Serevr failed to mmap." << std::endl;
        exit(1);
    }
    close(fd);                 // fd is no longer needed

    // server process work
    int* int_ptr = reinterpret_cast<int*>(shmem_adder);

    // initialize
    int_ptr[0] = 0;
    int_ptr[1] = 0;

    for (int i = 0; i < 10; ++i)
    {
        int my_int    = int_ptr[0];
        int other_int = int_ptr[1];

        if (my_int <= other_int)
        {
            my_int = other_int + 1;
            int_ptr[0] = my_int;
            std::cout << "I am taller. " << my_int << ", "
                      << other_int << std::endl;
        }
        usleep(800000);
        std::cout << "Checking client " << i << std::endl;
    }
    std::cout << "Quit server: " << int_ptr[0] << ", " << int_ptr[1] << std::endl;

    // unmap
    int ummap_ret = munmap(shmem_adder, SHMEM_SIZE);
    if (ummap_ret != 0)
    {
        std::cerr << "Failed to munmap. " << ummap_ret << std::endl;
        exit(1);
    }

    // remove shmem object
    int unlink_ret = shm_unlink(SHMEM_NAME);
    if (unlink_ret != 0)
    {
        std::cerr << "Failed to shm_unlink. " << unlink_ret << std::endl;
        exit(1);
    }
}

//----------------------------------------------------------------------
void run_client()
{
    // open the shared memory object
    int fd = shm_open(SHMEM_NAME,
                      // oflags
                      O_RDWR    // read/write
                      ,
                      // mode
                      S_IRUSR|  // user read
                      S_IWUSR   // user write
        );

    if (fd >= 0)
    {
        std::cout << "shmem_open succeed fd: " << fd << std::endl;
    }
    else
    {
        std::cerr << "shmem_open failed: " << fd
                  << ", Are you running the server?" << std::endl;
        exit(1);
    }

    // get shmem address
    const size_t access_offset = 0;
    void* shmem_adder = mmap(0, SHMEM_SIZE,
                             // memory protection mode
                             PROT_READ| // Pages may be read.
                             PROT_WRITE // Pages may be written.
                             ,
                             // mapping flag
                             MAP_SHARED, // Share this mapping with other process
                             fd,
                             access_offset);
    if (shmem_adder == 0)
    {
        std::cerr << "Failed to mmap." << std::endl;
        exit(1);
    }
    close(fd);                 // fd is no longer needed

    // server process work
    int* int_ptr = reinterpret_cast<int*>(shmem_adder);

    // initialize
    int_ptr[0] = 0;
    int_ptr[1] = 0;

    for (int i = 0; i < 10; ++i)
    {
        int my_int    = int_ptr[1];
        int other_int = int_ptr[0];

        if (my_int <= other_int)
        {
            my_int = other_int + 1;
            int_ptr[1] = my_int;
            std::cout << "I am taller. " << my_int << ", "
                      << other_int << std::endl;
        }
        usleep(500000);
        std::cout << "Checking server " << i << std::endl;
    }
    std::cout << "Quit client: " << int_ptr[0] << ", " << int_ptr[1] << std::endl;

    // unmap
    int ummap_ret = munmap(shmem_adder, SHMEM_SIZE);
    if (ummap_ret != 0)
    {
        std::cerr << "Failed to munmap. " << ummap_ret << std::endl;
        exit(1);
    }
}

//----------------------------------------------------------------------
/// main
int main(int argc, char* argv[])
{
    if (argc == 1)
    {
        usage_exit();
    }
    else if ((argc == 2) && std::string(argv[1]) == "server")
    {
        run_server();
    }
    else if ((argc == 2) && std::string(argv[1]) == "client")
    {
        run_client();
    }
    else
    {
        usage_exit();
    }

    return 0;
}

I hope someone can find this example useful.