Wednesday, November 16, 2011

Pathfinder


This is Assignment #6 of Stanford's CS106B class last Spring Quarter 2011.

This is an assignment on graphs. It includes an implementation of Dijkstra's shortest path algorithm and of Kruskal's minimum spanning tree algorithm.

Here is a screen-shot of the minimum spanning tree of the graph data in the file "USA.txt" (included in the project).


You can play with this app by downloading the .exe file along with the other files here.

You can download the source files here.

You can download my code here.

You can download my code here.

You can download the problem specification here here.

Have fun!!!


Monday, November 7, 2011

Some Quotes from "The Magic of Thinking Big"


When I believe I can do it,
the how to do it develops.

A person is a product of his own thoughts.

How to develop the power of belief:
1. Think Success, don't think failure
2. Remind yourself that you are better than you think you are
3. Believe big

The more successful an individual the less inclined he is to make excuses

The right attitude and one arm will beat the wrong attitude and two arms every time

What you can do to lick health excusitis:
1. Refuse to talk about your health
2. Refuse to worry about your health
3. Be genuinely grateful that your health is as good as it is
4. Remind yourself often, "It is better to wear out than to rust out."

The thinking that guides your intelligence is much more important than how much intelligence you have.

Stick with one thing until it's over.

Stickability is 95% ability.
You must like everybody: your subjects, proffessors, fellow students, etc.
Gain respect by cooperating

Knowledge is only potential power.
Knowledge is power only when put to use
--and then only when the use made of it is constructive.
It is more important to use your mind to think than to use it as a warehouse of facts.
The ability to knot how to get information is more important than using the mind as a garage for facts.
Be a person who can solve problems and can think up ideas.
A fact man cannot make up money.

To Cure Intelligence Excusitis:

1. Never underestimate your intelligence and
never overestimate the intelligence of others.

--It's not how many brains you've got;
but how you use your brain that counts.

--Mange your brains instead of worrying
about how much IQ you've got.

2. Remind yourself -
"My attitudes
are more important than my intelligence."

3. The ability to think is of greater value
than the ability to memorize facts.
Conquer luck excusitis:
1. Accept the law of cause and effect.
2. Don't be a wishful thinker.
Build confidence and destroy fear:
All confidence is acquired, developed.
Action cures fear.
Indecision, postponement fertilize fear.
Hope is start. But hope needs action to win victories.
Deposit only positive thoughts in your memory bank.
Withdraw only positive thoughts from your memory bank.
It is easy to forget the unpleasant if we simply refuse to recall it.
2 ways to put people in proper perspective:
1. Get a balanced view of the other fellow-- both of you are important and have desires, problems,...
2. develop an understanding attitude.
Doing what's right keeps your conscience satisfied. And this builds confidence.
To think confidently, act confidently.
You can't act devoted for too long without feeling devoted.
We can change our attitudes by changing our physical actions.
Confident action produces confident thinking.
Confidence-building exercises:
1. Be a front seater.
2. Practice making eye-contact.
3. Walk 23% faster.
4. Practice speaking up.
5. Smile big.
To think big we must use words and phrases which produce big, positive mental images.
"Practice adding value" exercises:
1. Practice adding value to things.
2. Practice adding value to people.
3. Practice adding value to yourself.
A good speaker has knowledge of what he's going to talk about and an intense desire to tell it to other people.
To eliminate quarrels, eliminate petty thinking. before complaining..ask first,"Is it really important?"
Ways to develop and strengthen our creative thinking ability:
1. Believe it can be done.
When you believe, your mind find ways to do.
Where there is a will, there is a way.
Capacity is a state of mind. How much we can do depends on how much we think we can do.
The success combination is do what you do better (improve the quality of your output) and do more of what you do (increase the quantity of your output).
The fellow who has plenty of time makes an ineffective work partner.
The bigger the person, the more apt he is to encourage you to talk; the smaller the person, the more apt he is to preach to you.
Big people monopolize the listening. Small people monopolize the talking.
In reaching creative decisions, the raw materials are the ideas or suggestions of others.
Test your own views in the form of questions--what do you think of this suggestion?...
Ideas are fruits of your thinking. But they got to be harnessed and put to work to have value.
Harness and develop your ideas:
1. Don't let ideas escape.
2. Next, review your ideas.
3. Cultivate and fertilize your ideas.
Thinking regulates actions.
Your actions are controlled by your thoughts.
How you think determines how you act.
How you act in turn determines how others react to you.
Your appearance talks.
Look important because it helps you think important.
Look your best and you will think and act your best.
Pay twice as much and buy half as many.
The key to winning what you want lies in thinking positively toward yourself.
A person who thinks his job is important receives mental signals on hoe to do his job better. And a better job means more promotions, more money, more prestige, more happiness.
The way we think towards our job determines how our subordinates think toward their jobs.
Practice uplifting self-praise. Sell yourself to yourself.
Think like important people think.
Respect yourself.
Is this the way an important person does it? Use this question to make you a bigger, more successful person.
Mind food is your environment--all the countless things that influence your conscious and subconscious mind.
The kind of mind food we consume determines our habits, attitudes, and personalities.
You are a product of your own environment.
Companionship with people with big ideas raises the level of our thinking; close contact with ambitious people gives us ambition.
What we should do to make our future environment pay off in satisfaction and prosperity:
Step 1. Recondition yourself for success.
Step 2. Never surrender.
People who tell you it cannot be done almost always are unsuccessful people, are strictly average or mediocre at best in terms of accomplishments. Opinions of these people can be poison.
Don't let negative thinking people - "negators" - destroy your plan to think yourself to success.
Study negators. Be extra careful.
Be careful about your source of advice.
Make it a rule toa seek advice from people who know.
Go first class in everything you do. You can't afford to go any other way.
How we think shows through in how we act. Attitudes are mirror of the mind.
When our attitude is right, our abilities reach a maximum of effectiveness and good results inevitably follow.
Make these 3 attitudes you allies:
1. Grow the attitude of I'm activated.
2. Grow the attitude of You are important.
3. Grow the attitude of Service first.
Enthusiasm can make things 1100% better.
Develop the power of enthusiasm:
1. Dig into it deeper (and you dig up interest).
2. In everything you do, life it up -- "I feel great today!"
3. Broadcast good news.
How we feel is in large part determined by how we think we feel.
Give me a good word or none at all.
Give them a good word or none at all.
The desire to be important is man's strongest, most compelling non-biological hunger.
People do more for you when you make them feel important.
It pays to make little people feel like big people.
When you hwlp other people feel important, you help yourself fee important too.
You must feel important to succeed.
1. Practice appreciation.
2. Practice calling people by thier names.
3. Don't hug glory. Invest it instead.
Praise is power.
Get the family on your team. Give them planned attention.
You cannot harvest money unless you plant the seeds that grow money.
The seed of money is service.
"Put-service-first" is an attitude which creates wealth.
Put service first and money takes care of itself - always.
Think right toward people and they will like and support you.
Success depends on the support of other people.
In at least 9 out of 10 cases, the "likeability" factor is the 1st thing mentioned. And in an overwhelmingly large number of cases, the "likeability" factor is given far more weight than the technical factor.
Every friend you make lifts you just one notch higher. And being likeable makes you lighter to lift.

Some Cryptic ERROR Messages of the Visual Studio 2008 C++ Compiler


Error    1    error LNK2019: unresolved external symbol "void __cdecl ReadData(class PathfinderGraph,class std::basic_string,class std::allocator >)" (?ReadData@@YAXVPathfinderGraph@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "int __cdecl Main(void)" (?Main@@YAHXZ)    pathfinder.obj    assn-6-pathfinder-pc

Cause: The function prototype is not the same as the function implementation.

Example:

/* function prototype */
void ReadData(PathfinderGraph & graph, string filename);

/* function implementation*/
void ReadData(PathfinderGraph graph, string filename)
{




notice the & in the function prototype.

Tuesday, November 1, 2011

Minimal BASIC


I am finished coding Minimal Basic - Assignment #3 of Stanford's CS106B class last Spring Quarter 2011.

You can download the problem specification here here.



I think the most significant part of this assignment is finding the right data structure to use in the Program class.

I thought of using the BST introduced in Chapter 13 of the Course Reader. But it might cause me a lot of trouble (a lot of code to debug).


So I choose to use the map data structure of the C++ STL.


You can download my code here.

You can download a stand-alone executable here.

You can download my code here.

You can download my code here.


Happy coding.


Monday, October 31, 2011

CS106B - Free Course from Stanford


CS106B is a free course from Stanford available online. This course is about data structures and recursion.

The latest free video lectures are made last 2011 Spring Quarter and you can access them at ClassX - CS106B: Programming Abstractions. The professor during this quarter is Steve Cooper. You can visit the CS106B's website in this quarter here. All lecture handouts, codes, the course reader, assignments and many other materials for the course are available in the website.

An older set of video lectures are available at SEE (Stanford Engineering Everywhere) - Programming Abstractions. Go to the bottom part of the web page to download the complete course materials.

If you are planning to do the assignments and compile the example codes during the lectures you'll need Visual Studio 2005 and the CS106 Library. If you have Visual Studio 2008 instead, please read Dani's article on how you can make the CS106B Library work with Visual Studio 2008.

Enjoy!

I have done some of the assignments last 2011 Spring Quarter. You can view my solutions here. Please pardon my code because they are not well structured and not commented. Thanks.



  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists
 


Visit Vitabase for Quality Health Supplements


Saturday, October 1, 2011

Your Ride Is Here

This is the problem specification of "Your Ride is Here" from USACO.

It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet.

Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "USACO" would be 21 * 19 * 1 * 3 * 15 = 17955. If the group's number mod 47 is the same as the comet's number mod 47, then you need to tell the group to get ready! (Remember that "a mod b" is the remainder left over after dividing a by b; 34 mod 10 is 4.)

Write a program which reads in the name of the comet and the name of the group and figures out whether according to the above scheme the names are a match, printing "GO" if they match and "STAY" if not. The names of the groups and the comets will be a string of capital letters with no spaces or punctuation, up to 6 characters long.

Examples:
Input
Output
COMETQ
HVNGAT
GO
ABSTAR
USACO 
STAY

PROGRAM NAME: ride

This means that you fill in your header with:
PROG: ride

INPUT FORMAT

Line 1: An upper case character string of length 1..6 that is the name of the comet.

Line 2: An upper case character string of length 1..6 that is the name of the group.

NOTE: The input file has a newline at the end of each line but does not have a "return". Sometimes, programmers code for the Windows paradigm of "return" followed by "newline"; don't do that! Use simple input routines like "readln" (for Pascal) and, for C/C++, "fscanf" and "fid>>string".


SAMPLE INPUT (file ride.in) 
COMETQ
HVNGAT

OUTPUT FORMAT

A single line containing either the word "GO" or the word "STAY".

SAMPLE OUTPUT (file ride.out)
GO

You can view my solution at PlanetSourceCode.com

 

Validation of viewstate MAC failed - ASP.NET Error




  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists
 



Server Error in '/Login' Application.

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.


What I did to solve this.


I removed the action attribute in the <form> tag.

I changed

<form id="form1" action="DisplayName.aspx" runat="server">

into

<form id="form1" runat="server">

and placed

Response.Redirect("DisplayName.aspx");

in code behind file.

Saturday, September 10, 2011

Milking Cows


This is the problem specification of the Milking Cows Programming Problem From USACO.

Milking Cows

Three farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The second farmer begins at time 700 and ends at time 1200. The third farmer begins at time 1500 and ends at time 2100. The longest continuous time during which at least one farmer was milking a cow was 900 seconds (from 300 to 1200). The longest time no milking was done, between the beginning and the ending of all milking, was 300 seconds (1500 minus 1200).

Your job is to write a program that will examine a list of beginning and ending times for N (1 <= N <= 5000) farmers milking N cows and compute (in seconds):

  • The longest time interval at least one cow was milked.
  • The longest time interval (after milking starts) during which no cows were being milked.

PROGRAM NAME: milk2


INPUT FORMAT

Line 1:
The single integer
Lines 2..N+1:
Two non-negative integers less than 1000000, the starting and ending time in seconds after 0500

SAMPLE INPUT (file milk2.in)

3
300 1000
700 1200
1500 2100

OUTPUT FORMAT

A single line with two integers that represent the longest continuous time of milking and the longest idle time.

SAMPLE OUTPUT (file milk2.out)

900 300
 
 
You can view my solution (source code) to this problem at PlanetSourceCode.com

Sunday, September 4, 2011

When the Siants Go Marching In By Greg Howlett and Andi Leftwich


Greg Howlett - Piano
Andi Leftwich - Fiddle

This is an excerpt from Greg Howlett's "Live in Charleston" DVD.

Click here for Greg Howlett's Explanation of "When the Saints".


Enjoy!

Friday, September 2, 2011

Recursion


This is Assignment #3 of Stanford's CS106B class last Spring Quarter 2011.

It consists of four problems and 2 warm-up problems.
(I only did 3 of the 4 problems because the last one was fairly difficult). Click here here to download the assignment handout.

The link for downloads below might not work. Please use this link to download all solutions to the problems.

Warm-up problem 0a. Binary encoding
Write a recursive function GenerateBinaryCode(nBits) that generates the bit patterns
for the standard binary representation of all integers that can be represented using the
specified number of bits. For example, calling GenerateBinaryCode(3) should produce
the following output:
000
001
010
011
100
101
110
111
Download my solution for Warm-up problem 0a here.
Warm-up problem 0b. Subset sum
The subset sum problem is an important and classic problem in computer theory. Given  a set of integers and a target number, your goal is to find a subset of those numbers that sum to that target number. For example, given the numbers {3, 7, 1, 8, -3} and the target sum 4, the subset {3, 1} sums to 4. On the other hand, if the target value were 2, the result is false since there is no subset that sums to 2.
 Download my solution for Warm-up problem 0b here.
Problem 1. Karel goes home
Your job in this problem is to write a recursive function
int CountPaths(int street, int avenue)
that returns the number of paths Karel could take back to the origin from the specified starting position, subject to the condition that Karel doesn’t want to take any  unnecessary steps and can therefore only move west or south (left or down in the diagram).
 Download my solution for problem 1 here.
 Problem 2. Balancing parentheses
Write a function
bool IsBalanced(string exp);
that takes a string consisting only of parentheses, brackets, and curly braces and returns true or false according to whether that expression has properly balanced operators. (Your function should operate recursively.)
Download my solution for problem 2  here.

Problem 3. Cell phone mind-reading
Write a function
void ListCompletions(string digits, Lexicon & lex);
that prints all words from the lexicon that can be formed by extending the given digit sequence. For example, calling ListCompletions("72547", english) should generate the following sample run:
palisade
palisaded
palisades
palisading
palish
rakis
rakish
rakishly
rakishness
sakis

 Download my solution for problem 3  here.

Problem 4. Stock Cutting
You are charged with buying the plumbing pipes for a construction project. Your
foreman gives you a list of the varying lengths of pipe needed. Home Depot sells stock
pipe in one fixed length. You can divide each stock pipe in any way needed. Your job is
to figure out the minimum number of stock pipes required to satisfy the list of requests,
thereby saving money and minimizing waste.

Your job is to write a recursive function

int CutStock(Vector<int> & requests, int stockLength);

that takes two arguments—a vector of the lengths needed and the length of stock pipe
that Home Depot sells—and returns the minimum number of stock pipes needed to
service all requests in the vector. For example, if the vector contains [ 4, 3, 4, 1, 7, 8 ]
and the stock pipe length is 10, you can purchase three stock pipes and divide them as
follows:

Pipe 1: 4, 4, 1
Pipe 2: 3, 7
Pipe 3: 8

Doing so leaves you with two small remnants left over. There are other possible
arrangements that also fit into three stock pipes, but it cannot be done with fewer.

Download my solution for problem 4 here or  here.
Happy coding!!!

Tuesday, August 30, 2011

Simple Project in Assembly Language - Menu


This was supposed to be my project in assembly language. (The truth is, I have never tried to master assembly language programming and I have already forgotten how the code below works. LOL! But I'm going to share it anyway.)

I thought I did not have a copy of this but I found a copy on my previous blog.

They called this "Menu"

The code below is just part of the program. Download the whole program here or here
This should be assembled using the A86 Assembler by  Eric Isaacson.


Enjoy!

start:
    ;set video mode
                mov     AH, 00h     ; I want to set the video mode...
                mov     AL, 03h     ; ...to 80x25x16
                int     10h         ; Call video interrupt

    call clear_screen

    ;--------------------------display choices
    mov ah, 09
    lea dx, box1
    int 21h
    

    mov ah, 09
    lea dx, choice
    int 21h
    

    call crlf

    mov ah, 09
    lea dx, choice1
    int 21h

    call crlf
    
    mov ah, 09
    lea dx, choice2
    int 21h

    call crlf   

    mov ah, 09
    lea dx, choice3
    int 21h

    call crlf 
    
    mov ah, 09
    lea dx, choice4
    int 21h
    
    call crlf 
    
    mov ah, 09
    lea dx, choice5
    int 21h
    
    call crlf 
    
    mov ah, 09
    lea dx, choice6
    int 21h

    call crlf 
    
    mov ah, 09
    lea dx, choice7
    int 21h

    call crlf

    mov ah, 09
    lea dx, box2
    int 21h
    

    call crlf

    ;-----------------prompt user of letters a-f or z
    call crlf
    call crlf 
    
    mov ah, 09
    lea dx, prompt
    int 21h

    ;---------------get input character
    mov ah, 01
    int 21h

    ;----compare input character with... and execute chosen subprogram
    cmp al, '1'
    je one
    cmp al, '2'
    je two
    cmp al, '3'
    je three
    cmp al, '4'
    je four    
    cmp al, '5'
    je five    
    cmp al, '6'
    je six
    cmp al, '0'
    je endendend
    
    ;-------------------no match
    mov ah, 09
    lea dx, no_match
    int 21h

    call crlf
    call crlf
    jmp next

     jmp start
one:
    call crlf 
    call crlf 
    call display_biodata_with_border   
    jmp next
two:
    call crlf 
    call crlf 
    call reverse_string
    jmp next
three:
    call crlf 
    call crlf
    call password
    jmp next
four:
    call crlf 
    call crlf
    call horizontal
    call crlf 
    call crlf    
    call crlf 
    call crlf
    call crlf 
    call crlf
    call crlf 
    call crlf

    jmp next
five:
    call crlf 
    call crlf
    call quadrant
    jmp next    
six:
    call crlf 
    call crlf
    call addition
    jmp next
endendend:
    jmp ending

;-------------------press any key to continue
next:
    mov ah, 09
    lea dx, Press_anyKey
    int 21h
    
    mov ah, 01
    int 21h
      
      cmp al, '0'
      je endendend

    
    call crlf 
    call crlf
    call crlf 

    ;set video mode
                mov     AH, 00h     ; I want to set the video mode...
                mov     AL, 03h     ; ...to 80x25x16
                int     10h         ; Call video interrupt

    call clear_screen
    
    jmp start

ending:
    mov ah, 09
    lea dx, closing
    int 21h

    ret

Monday, August 29, 2011

Solution to Decorator Pattern Exercises of C# 3.0 Design Patterns

Decorator Pattern (this description is directly taken from the book C# 3.0 Design Patterns by Judith Bishop)

The role of the Decorator pattern is to provide a way of attaching new state and behavior to an object dynamically. The object does not know it is being “decorated,” which makes this a useful pattern for evolving systems. A key implementation point in the Decorator pattern is that decorators both inherit the original class and contain an instantiation of it.

Image is taken from www.dofactory.com

Click here to download my solution to the exercises.

These are the exercises from the book with a few comments oh how I coded my solution for each:

1. Assume that the Photo class was written with Drawer as a plain (not virtual) method and it cannot be altered. Reconstruct Example 2-2 so that it works under this constraint. (Hint: use an interface as in the theory example.)

2. Add to the Photo Decorator system a second type of component called Hominid. Use the drawing methods for ovals and lines to draw an approximation of a person. Then, use the same two  decorators—Tag and Border—to decorate Hominid objects.

3. Add other event handlers to the constructors of the decorators, together with additional behavior. For example, an OnClick event could cause a tag to appear, rather than having it appear  automatically.

4. Decorate the Console class so that Write and WriteLine methods are trapped and the output is reformatted for lines of a given size, avoiding unsightly wraparounds. Test your decorator with the program in Example 2-1.
Comments:
The Console class cannot be inherited because it is static. What I did here is I created a constructor that has a parameter that takes a TextWriter. The client needs to pass the Console.Out as parameter to the ConsoleDecorator's constructor.


5. Write a program that decorates the Stream class and shows how much of a file has been read in, using a trackbar.

Comments:
I used a ProgressBar instead of a TrackBar.
I created an event that will be raised each time a character is read by the TrackStream.Read() method.

 
6. Write a program that decorates the Stream class and asks for a password before allowing reading to continue.

7. Write a program that decorates a text message with a simple cipher. Include a second decorator that transforms the encrypted message back to plain text.
Comments:
I used a simple cipher called the Caesar's Cipher

Sunday, August 28, 2011

Some reharmonization ideas from Greg Howlett


Greg Howlett is a Christian concert pianist and recording artist.

I have watched many of his free video lessons and blog posts on reharmonization.

Listed below are some of the reharmonization ideas I got from him.
  1. A ii chord substitues for a V chord (and a IV chord).
  2. A iii chord substitutes for a I chord.
  3. A vi chord substitues for a I chord or a V chord.
  4. Change V-I cadences into ii-V-I cadences.
  5. Insert a minor 5 (v) and dominant 1 (I7) in front of a 4 (IV) chord
  6. A dominant chord usually resolves down a fifth or sometimes a half step.
  7. Very often, if a progression is moving with the circle of fifths, you can change one of the normal minor chords to major (making it a secondary dominant).
  8. Add a flat 9th to secondary dominants if resolving to a minor chord.
  9. minor 7 chords likes to resolve down a fifth or in diatonic steps.
  10. You can insert a diminished chord betweet 4 and 5 chords.
  11. You can substitue a sharp4 dim - minor4 6th - minor 3 - flat3 dim - ii7 - V7 -I for a V-I cadence.
  12. Which color note belong to each chord?
Major/Major 7th
9, #11, 13 (9 is the most common)

Minor 7th
9, 11, 13 (9 is the most common)

Dominant
b9, 9, #9, #11, b13, 13 (All are widely used. However, you are most likely to use b9, 9, b13, and 13.)

Here is a sample of his free video lessons: "Relating harmony to melody"






  
Free Lessons for Chruch Pianists:
Free lessons, tips and downloads for church pianists

DVD Courses (Reharmonization, Play by Ear!, Arranging, Accompanying, Theory for Church Pianists, etc.):
Over 30 hours of DVD instruction for church pianists


Visit Vitabase for Quality Health Supplements


Saturday, August 27, 2011

"I will be OK with that... as long as Sarah is there."

Wow! He must be very much in loved he would do everything to be with her.

I got this from Greg Howlett's latest post as of this date. Please read the story here.

It's a tragic story. 
It's sad that things like this happens even among Christians.

If you are also hurting because of the death of a loved one the article "Why Does God’s Creation Include Death and Suffering?" from Answers in Genesis might help you understand things.

Wednesday, August 24, 2011

Random Language Generation & Markov models of language


"Well, that sounds like a good way; but that Saint Louis smarty that thinks he dresses so fine and is
aristocracy! Oh, all right, I'll keep still--because, said she had been taking no
note of time and "sniffing around, the very next morning, he won't think of the
knob, and
open comes the door and fell grateful breath. Tom whistled twice more. Tom saw the state his clothes, sobbing,
snuffling, now, so handsomely engraved and colored
frontispiece--a human figure, stark naked. At that moment, not twenty yards away, and stood by musing a minute. SHE won't
ever have of her child, and ordered him away. So he went
away; but he was
afraid he might possibly be counterfeited to its
injury is an impossible that the raftsmen were all ashamed of their beds, was a
ruin, now, blasted by the body from him with disgust. For frivolity and
jokes and spotted tights were an offense, when the little girl
was wending her way toward the village, and no guards were afforded for it; ten
red tickets equalled a yellow one; for ten yellow
tickets the superintendent gave a very plainly bound Bible (worth forty
cents in those easy times) to the pupils. To his left, back of the performance.
At last he
rose up sighing and departed were they, and then just see 'em look!"

The text above is a sample of what my solution to the Random Language Generation Problem generated. (Assignment 2: ADT Client Applications)

Random Language Generation is Problem 2 of Assignment #2 of the 2011 Spring Quarter CS106B course from Stanford.

You can download the problem specification here here. (Go to page 5 of the downloaded document)

Here is a screenshot of my solution:



You can download my code here.

You can download a runnable .exe file here.

You can download my code here.

You can download my code here.

Word Ladders


Word Ladders is Problem 1 of Assignment #2: ADT of the 2011 Spring Quarter CS106B course from Stanford.

The description below is taken from the assignment handout (you can download it here here).

A word ladder is a connection from one word to another formed by changing one letter at
a time with the constraint that at each step the sequence of letters still forms a valid word.
For example, here is a word ladder connecting "code" to "data".

code -> core -> care -> dare -> date -> data

That word ladder, however, is not the shortest possible one. Although the words may be
a little less familiar, the following ladder is one step shorter:

code -> cade -> cate -> date -> data


Here is a screenshot of my solution:


You can download my solution code here.

You can also download a runnable .exe file here.

You can download my solution here.

You can download my code here.

Sunday, August 21, 2011

Game Of Life


Here is my solution to the "Game of Life" Problem, a programming assignment from Stanford's CS106B class last Spring Quarter (2011)

Click here here to download the problem specification.



You can download my solution (source code) here.

If you want to play with it without compiling it, you can download a stand-alone .exe file here.

You can download my solutions here.

You can download my code here.

Have fun!

Boggle


I have been watching the 2011 Spring Quarter CS106B's videos by Steve Cooper from Stanford and have also done the assignments given in the class.

I have finished coding Boggle (assignment # 4) last night. You can download the problem specifications here here.

Here's a screenshot of my solution:




You can download my solution (code) here.

You can download my code here.

If you want a stand-alone .exe file you can download it here.

Pardon my code. I did not follow good style practices in coding this. I did not comment everything.

I hope I can be able to fix this next time.

Enjoy!

Friday, August 19, 2011

Why I Started Blogging

Hi everyone.

I am going to start blogging today.

I'm doing this because I am planning to stop going to college next semester. I'm going to study in private.

Blogging will give me a way to share the output of the things I'm going to learn [I hope... if I have time... and if I know how to write what I want to say]. I hope this will also help improve my written as well as my spoken English.

I have always wanted to stop since I was third year in college (only that my parents did not permit me, but I think they will permit me now) because I have realized that going to my school everyday is a hindrance to what I really want to become -- a programmer -- and the schools I have attended were not teaching the things that I need to become a proficient programmer.

[I also want to become a computer scientist but maybe that will not happen any time soon. Maybe a hundred years form now!? (LOL). But I will continue to study computer science until forever. ]

I have learned from my schools the EASY part of programming (David Malan said that "Programming is easy"). But I have not learned the "programming well" part, which is harder than the "easy" part (LOL).

[David Malan said that "Programming is easy". His co-professor agreed on that but added that "Programming WELL is hard"]

I'm not saying that I have never learned anything from the schools I attended. In fact, there are things that I believe I could have not known had I not attended these schools (tama ba akong grammar?). So I have learned many important things from my schools.

But it is the "well" part of programming that I need to know now. And I have to find it somewhere else.

You might be asking why I'm thinking of sharing the things I'm going to learn.

Well, I'm just thinking that maybe this will help me keep my sanity (LOL) because my father said that he heard of someone in the past who was not contented with what his teachers were teaching in school so he stopped attending classes and studied things on his own. To make the story short, that child killed himself (I forgot the reason why). I was just thinking that maybe the reason was loneliness.

Maybe blogging will help me not to be alone.

But I have also read about people who did not have a formal (college) education but were successful or at least fulfilled.

I aspire to be like them. (But I am also planning to pursue a degree in mathematics in the near future if I have time and enough money.)

Have a great day ahead.


[I was trying to check from Google's search engine if my statement above ---"there are things that I believe I could have not known had I not attended these schools"--- is correct grammatically. I did not get my expected results but, incidentally, the first result of the search was NOT Everyone Should Attend College, BUT Let's not Give up on it Entirely.] Great!