Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Friday, October 2, 2009

What's Your View?

When I was a student, my supervisor often asked me the question. It confused me, which meant that I didn't understand what I was talking.

Although the relationship between understanding the contents and grasping the view is bi-directionally, it is worth trying to grasp the view of a given research first, then understand the remains. This strategy is easier, particularly for me. Never forget to look for the author's viewpoint. Ask myself: "What's the view of the research?" Now I must be able to find the goal of the research easily.

Programming Language as Human Interface

5 Reasons Why People Use This Language

There are a lot of programming languages both in the real world and in the academic experimental world. Everybody knows the common function which Professor Turing defined among the languages. Although almost all programming languages which are used as a production can be ultimately written in a single language, we tend to use specific languages for some reasons.

  1. Our project has used this language.
  2. Our project needs a specific library written in this language.
  3. We're excel at this language.
  4. A specific functionality of this language is absolutely effective on our project.
  5. The syntax of this language is good.

This order means the order of impact. Yes, unfortunately the syntax matters the least.

Note that only (3) and (5) are independent on a specific project, and (3) can be said a consequence of (5). Therefore it is deducted that (5) is worth studying.

Human Computer Interaction

According to wikipedia, human computer interaction, also known as the study of human interface, is defined as the study of interaction between people and computers. In other words, human computer interaction is the combination of computer science, behavioral sciences, design and several other fields of study. The goal of HCI (Human Computer Interaction) is to improve the interactions between users and computers by making computers more usable and receptive to the user's needs.

I think that the biggest challenge of this field is how to evaluate the goodness of a given hypothesis. We cannot deductively prove the new theory certainly makes a system more usable easily. We cannot numerically measure how the new theory certainly improved the usability easily.

Programming Language as Human Computer Interaction

Remember the conclusion of the reason why we use a specific programming language, which is previously described: "because the syntax of this language is good." Here we have to consider how to evaluate the goodness of the language. It is difficult for language designers and users to objectively explain how good their language syntax is. This circumstance is highly similar to the issue of HCI.

For example, some people agree the following example: Ruby is better than Java because of the simple "Hello, world!" sample obviously.

# Ruby
puts 'Hello, world!'

/* Java */
class HelloWorld {
  public static void main(String argv) {
    System.out.println("Hello, world!");
  }
}

It is easy for me to disagree the opinion. I don't think I have to declare the reasons here because you can presume easily.

So, how can we evaluate the goodness of language syntax without any controversial counterargument? What points of view are desirable for the purpose? This issue is worth studying.

Conclusion

Programming language has aspects of the study of human computer interaction. I showed only the importance of syntax as one of aspects, but there are some other features include being able to complete by editors and type system for human aid. It turns out that it is good to improve it with the similar ways of previously used in HCI studies.

Other Miscellaneous Comments

According to ACM, HCI is defined as "a discipline concerned with the design, evaluation and implementation of interactive computing systems for human use and with the study of major phenomena surrounding them." In short, HCI is for implementation of interactive computing system. Whereas my view on this entry is for implementation of implementation of interactive computing system. It can be said as higher order HCI.

Thursday, October 1, 2009

Google Earth In Canada

Google Maps in Canada is sometimes insufficient. Information on the map in Canada isn't as rich as in Japan or in the US. The satellite is outdated.

Today I installed Google Earth on my MacBook Air and viewed my neighborhood. I surprised that Google Earth is absolutely greater than Google Maps regarding to the contents.

vpl1

http://home.graffiti.net/rec_images01:graffiti.net/nutcrew/7th20/Vancouver_public_library_vancouver_british_columbia.jpg

This is my nearest public library.

In Google Earth,

vpl

It's amazingly real.

Monday, September 21, 2009

Beautiful and Functional English Writing Software

These days I am concentrated in improving my English skill; particularly in listening and writing. Actually now I'm under increasing pressure because the score of the result of my last TOEFL exam was bad rather than insufficient. So I decided not to code programs too much as my hobby, but to write English essays more and more. I have less time to do all things what I like than usual.

To write English essays more efficiently, I wish such editors:

  • Beautiful rendering with proportional fonts
  • Rich functionalities

When I mentioned about "rich functionalities" in the context of text editing, it stands for Vim. But unfortunately Vim doesn't support proportional fonts but supports only monospaced fonts. Monospaced fonts are beautiful in programming languages, but in natural English language, they aren't.

So I wrote a patch for supporting proportional fonts on MacVim.

1

Building MacVim with my patch

First of all, fetch the MacVim source and build plain Vim.

$ git clone git://repo.or.cz/MacVim.git MacVimUjihisa
$ cd MacVimUjihisa/src
$ ./configure --enable-gui=macvim
$ make

Create the following patch file on a.patch:

diff --git a/src/MacVim/MMTextStorage.m b/src/MacVim/MMTextStorage.m
index 0d272b2..0327a8f 100644
--- a/src/MacVim/MMTextStorage.m
+++ b/src/MacVim/MMTextStorage.m
@@ -656,12 +656,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
         cellSize.width = ceilf(em * cellWidthMultiplier);

         float pointSize = [newFont pointSize];
-        NSDictionary *dict = [NSDictionary
-            dictionaryWithObject:[NSNumber numberWithFloat:cellSize.width]
-                          forKey:NSFontFixedAdvanceAttribute];

         NSFontDescriptor *desc = [newFont fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dict];
         font = [NSFont fontWithDescriptor:desc size:pointSize];
         [font retain];

@@ -680,21 +676,18 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";
         boldFont = [[NSFontManager sharedFontManager]
             convertFont:font toHaveTrait:NSBoldFontMask];
         desc = [boldFont fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dict];
         boldFont = [NSFont fontWithDescriptor:desc size:pointSize];
         [boldFont retain];

         italicFont = [[NSFontManager sharedFontManager]
             convertFont:font toHaveTrait:NSItalicFontMask];
         desc = [italicFont fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dict];
         italicFont = [NSFont fontWithDescriptor:desc size:pointSize];
         [italicFont retain];

         boldItalicFont = [[NSFontManager sharedFontManager]
             convertFont:italicFont toHaveTrait:NSBoldFontMask];
         desc = [boldItalicFont fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dict];
         boldItalicFont = [NSFont fontWithDescriptor:desc size:pointSize];
         [boldItalicFont retain];
     }
@@ -714,32 +707,25 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar";

         float pointSize = [newFont pointSize];
         NSFontDescriptor *desc = [newFont fontDescriptor];
-        NSDictionary *dictWide = [NSDictionary
-            dictionaryWithObject:[NSNumber numberWithFloat:2*cellSize.width]
-                          forKey:NSFontFixedAdvanceAttribute];

-        desc = [desc fontDescriptorByAddingAttributes:dictWide];
         fontWide = [NSFont fontWithDescriptor:desc size:pointSize];
         [fontWide retain];

         boldFontWide = [[NSFontManager sharedFontManager]
             convertFont:fontWide toHaveTrait:NSBoldFontMask];
         desc = [boldFontWide fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dictWide];
         boldFontWide = [NSFont fontWithDescriptor:desc size:pointSize];
         [boldFontWide retain];

         italicFontWide = [[NSFontManager sharedFontManager]
             convertFont:fontWide toHaveTrait:NSItalicFontMask];
         desc = [italicFontWide fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dictWide];
         italicFontWide = [NSFont fontWithDescriptor:desc size:pointSize];
         [italicFontWide retain];

         boldItalicFontWide = [[NSFontManager sharedFontManager]
             convertFont:italicFontWide toHaveTrait:NSBoldFontMask];
         desc = [boldItalicFontWide fontDescriptor];
-        desc = [desc fontDescriptorByAddingAttributes:dictWide];
         boldItalicFontWide = [NSFont fontWithDescriptor:desc size:pointSize];
         [boldItalicFontWide retain];
   }

Then apply it:

$ patch -p2 < a.patch
$ xcodebuild

Then run it:

$ open build/Release/MacVim.app

Then fix its font config.

Known Bugs

  • In insert mode, the location of cursor is far from correct location.
    • a
  • Vertical split is broken.
    • b
  • Handling screenwidth. Now Vim wraps in a strange position.

Now I don't have time to fix the problems.

What's the Difference Between Rip and Bundler?

In the Rip mailing list, defunkt says:

Bundler is for installing gems. Rip is for managing your load path and installed packages.

Rip isn't yet ready to manage your deployments, whereas I think bundler is.

This short answer could be helpful.

Sunday, September 20, 2009

How To Skim Long Sentences Quickly

How can non-English speaking people skim long sentences quickly? Today I saw the light with the hack:

One way to increase your comprehension is to ignore all the extra words in a sentence -- trim the fat.

-- Cracking the TOEFL iBT 2008 edition

It could applied for only formal sentences.

To examine how it works, let me demo with the following sentences:

The Leland Stanford Junior University, commonly referred to as Stanford University or Stanford, is a private research university located in Stanford, California, United States. The university was founded in 1885 by United States Senator and former California governor Leland Stanford and his wife, Jane Lathrop Stanford, as a memorial to their son Leland Stanford Jr., who died of typhoid in Italy a few weeks before his 16th birthday. The Stanfords used their farm lands in Palo Alto to establish the university hoping to create a large institution of higher education in California.

Stanford enrolls about 6,700 undergraduate and about 8,000 graduate students from the United States and around the world every year. The university is divided into a number of schools such as the Stanford Business School, Stanford Law School, Stanford School of Medicine, and Stanford School of Engineering. The university is in Silicon Valley, and its alumni have founded companies including Nike, Hewlett-Packard, Electronic Arts, Sun Microsystems, Nvidia, Yahoo!, Cisco Systems, Silicon Graphics and Google.

The USNWR ranked Stanford's undergraduate program fourth in the nation, and Stanford is consistently ranked high in other college and university rankings. Stanford is one of two private universities that compete in the Pacific-10 Conference. Stanford's main athletic rival is Cal, and the two schools meet annually in the Big Game, a football game in which the winner is awarded the Stanford Axe.

-- http://en.wikipedia.org/wiki/Stanford_University

They become the followings:

  • The Leland Stanford Junior University is a private research university. The university was founded. The Stanfords used their farm lands.
  • Stanford enrolls. The university is divided. The university is. Its alumni have founded companies.
  • The USNWR ranked. Stanford is ranked. Stanford is one of two private universities. Stanford's main athletic rival is Cal.

Of course the fat part which is eliminated is also important for understanding what the sentences are stating, but it doesn't base the structure.

I thought skimming English sentences meant that just see each word flatly and quickly, but it was wrong. It is important for particularly non-English speaking people to catch only the important parts, in this case which are Subject, Verb and Object in each sentences.

Saturday, September 19, 2009

Integrative Biology 131 - Lecture 01: Organization of Body

Integrative Biology 131 - Lecture 01: Organization of Body by Professor Merian Diamond

http://www.youtube.com/watch?v=S9WtBRNydso

Story

  1. She likes starting her class with the phrase "Good morning!" because of the words' positive thought for nervous systems.
  2. Did you introspect? Learn who you are. Be healthy.
  3. First question: how many of you know the structural and functional unit of the lung?
  4. Second question: how many of you know the structural and functional unit of the compact bone?
  5. Third question: how many of you know the structural and functional unit of the most complex part in the earth?
    • A: Human brains
  6. Remember the names of the people who are sitting next to you within 2 minutes.
  7. Every week I pick two students randomly to go to lunch with.
  8. General information (Office hours, books and etc.)
  9. Biology terminologies are mostly from Greek or Latin
  10. Anatomy: Greek; up dissent
  11. Genitals: bird
  12. Carotid: in neck take blood to brain - stupor
  13. Uterus: hysteria
  14. Femur: thigh
  15. Penis: tail
  16. Once you know you never forget them
  17. Techniques to study: gross anatomy c naked eyes ("c" is an abbreviation of "with")
  18. In past we could research dead tissues but these days we can research living tissues with NMR.
  19. Muscles and bones are growing up

Followers