School
I’ve earned my Android Badge :)
by Hanly on Nov.08, 2009, under Computer Science, Technology
After having been developing Android applications for 2 months I like to think that I have earned my Android badge. Last week at the SHPE conference I was given an android sticker at the Google booth, which now adorns my laptop.
Of course calling myself a developer makes me think of:
Talking Twitter
by Hanly on Oct.10, 2009, under Computer Engineering, Computer Science, Sample Work
A week ago, for my mobile device programming class, I had to add text-to-speech and speech-to-text capabilities to a freely available Android program called Twitta. The features I added were very crudely superimposed on the Twitta interface, therefore this edit is by no means polished or intended for production usage.
There are 3 button “S”, “X”, and “R”. “S” starts the playback of all of the tweets which are currently displayed on the screen. Once the user scrolls down and new tweets appear on the screen the button can be pressed again and only the new ones will be read. “X” stops the playback of the messages. “R” prompts the user to speak their tweet. The google speech to text engine converts it to text and is displayed on the edit bar. If the message was wrong, pressing “R” again clears it and prompts for new speech. The message can also be edited with the keyboard. Below is a video of the application in action:
Powers of base 2 between 2 values using array in MIPS
by Hanly on Mar.15, 2009, under Computer Science
Program requests and reads in exactly one character, which represents an exponent. If the value is acceptable, then the program reads in another value. The program calculates the base 2 power between the user input values, and then stores the calculated values in an array. It then prints the values in the array.
# Assignment 3: Powers of 2 Assembly utilizing Array # by Hanly De Los Santos # Copyright ©2009, Hanly De Los Santos. All Rights Reserved. # http://www.hdelossantos.com # # Program requests and reads in exactly one character, # which represents an exponent. If the value is acceptable, then the # program reads in another value. The program calculates # the base 2 power between the user input values, and then # stores the calculated values in an array. It then prints the # values in the array. # .text .globl __start # Load acceptable ascii decimal value for number ranges # since input is read in as a character. __start: li $8, 48 # This is the decimal equivalent of 0 li $9, 57 # This is the decimal equivalent of 9 # Prompt the user for input. la $11, prompt puts $11 # Grab user input and store value in register 10 getc $10 la $11, newline # Create new line lb $17, ($11) putc $17 add $15, $10, 0 # Make copy of contents of r10 in r15. sub $15, $15, 48 # Convert char from first input to int. # Test to determine whether or not the user input value is acceptable. # If user input is less than 48 and greater than 57, branches to # exit_donothing, where the user is told the input is wrong. bgt $10, $9, exit_donothing blt $10, $8, exit_donothing sub $10, $10, 48 # After check, convert char to int. # Prompt user for additional input la $11, prompt2 puts $11 # Grab user input and store in r12 getc $12 la $11, newline # Create new line lb $17, ($11) putc $17 add $18, $10, 0 # Make copy of contents of r12 in r18. sub $18, $18, 48 # Convert char to int. # Test to determine whether or not the user input value is acceptable. # If user input is less than 48 and greater than 57, branches to # exit_donothing, where the user is told the input is wrong. bgt $12, $9, exit_donothing blt $12, $8, exit_donothing sub $12, $12, 48 # After check, convert char to int. # Determine if the difference between the two user input values is 0 bnez $10, neqz beqz $12, special_zero # Determine difference between 2 values neqz: sub $21, $12, $10 #Store diff of the two values in r21 bltz $21, exit_printgtr add $21, $21, 1 # If the value was acceptable, proceed to calculate the power. li $11, 2 # Load multiplier value into $11. li $17, 2 # Initialize 17 to multiplier value # Check to see if the second usr input is > 1, if it is modify r10 so that # the calculations can be made properly. This sets r10 = 2. If the second # input is == 1, then print the results. Must also load 2 into 2nd array # location here in case the seond input is 1. la $16, powers li $22, 1 mult $11, $22 mflo $11 sw $11, 4($16) li $23, 1 beq $23, $12, print_result bgt $10, $23, cont_gtn li $10, 2 # Multiplication loop. While $10 != 0 keep multiplying $17 by 2, and # decrement $10 by 1 every time this is done. Once $10 == 0, store # the result. cont_gtn: sub $10, $10, 1 # Since 2^1 has been taken care of add $14, $10, 0 add $24, $10, 0 add $24, $24, 1 multiply_for: mult $17, $11 # Loop to determine the power val mflo $17 sub $10, $10, 1 bnez $10, multiply_for # The result is stored in the location of the user input * 4, which would # give the matching address location on the array. This loops to # multiply_for while the $10 is != $12. nextval: add $10, $14, 0 # Restores r10 from copy mul $14, $24, 4 # Calculation to determine the add $23, $16, $14 # location in which to place the sw $17, ($23) # resulting power in the array. add $10, $10, 1 # Increment the counters for next add $24, $24, 1 # iteration. add $14, $10, 0 li $17, 2 # restore the multiplier value blt $10, $12, multiply_for beq $10, $12, print_result # Display the value of the exponential function. This loops through the # values in the array starting at the first user input until the # difference between the first and last user input is 0. print_result: la $14, str3 puts $14 # Print out "2^" li $v0, 1 move $a0, $15 syscall # Print out value of user input. la $16, str4 puts $16 # Print out '=' li $v0, 1 la $20, powers # Calculation to determine the mul $19, $15, 4 # location of the power value. add $23, $20, $19 lw $17, ($23) move $a0, $17 syscall # Print out result. la $13, newline # Create new line lb $12, ($13) putc $12 sub $21, $21, 1 add $15, $15, 1 bnez $21, print_result b endofline # Print out the result for 2 to the power of 0 if teh two user # inputs are 0 (special case). special_zero: la $14, str3 puts $14 # Print out "2^" li $v0, 1 move $a0, $15 syscall # Print out value of user input. la $16, str4 puts $16 # Print out '=' li $v0, 1 la $20, powers lw $17, ($20) # Print first value of array. move $a0, $17 syscall la $13, newline # Create new line lb $12, ($13) putc $12 b endofline # If second input is less than or not equal to first input, print mbgtrthan. exit_printgtr: la $13, mbgtrthan puts $13 # If the input is not appropriate, print str2 and exit. exit_donothing: la $13, str2 puts $13 b endofline # This is the exit statement. endofline: done # END OF PROGRAM # Define strings which will be used throughout program .data prompt: .asciiz "Enter a digit '0'-'9': " prompt2: .asciiz "Enter another digit '0'-'9': " mbgtrthan: .asciiz "Second digit must be greater than or equal to the first digit.\n" str2: .asciiz "Bad user input. Quitting.\n" str3: .asciiz "2^" str4: .asciiz " = " newline: .byte '\n' .align 4 powers: .word 1:10 # Create a 10-element int array.
Powers of base 2 in MIPS
by Hanly on Mar.01, 2009, under Computer Science
Program requests and reads in exactly one character, which represents an exponent. The program calculates the base 2 power, and then prints the calculated value.
# Assignment 2: Powers of 2 Assembly # by Hanly De Los Santos # Copyright ©2009, Hanly De Los Santos. All Rights Reserved. # http://www.hdelossantos.com # # Program requests and reads in exactly one character, # which represents an exponent. The program calculates # the base 2 power, and then prints the calculated value. # .text .globl __start # Load acceptable ascii decimal value for number ranges # since input is read in as a character. __start: li $8, 48 # This is the decimal equivalent of 0 li $9, 57 # This is the decimal equivalent of 9 # Prompt the user for input. la $11, prompt puts $11 # Grab user input and store value in register 10 getc $10 la $11, newline # Create new line lb $17, ($11) putc $17 add $15, $10, 0 # Make copy of contents of r10 in r15. sub $15, $15, 48 # Convert char to int. # Test to determine whether or not the user input value is acceptable. # If user input is less than 48 and greater than 57, branches to # exit_donothing, where the user is told the input is wrong. bgt $10, $9, exit_donothing blt $10, $8, exit_donothing sub $10, $10, 48 # After check, convert char to int. # If the value was acceptable, proceed to calculate the power. # Checks to determine if $10 is 0 or 1 since they are special cases. # If value is 0 or 1, branches to their respective prints. li $11, 2 # Load multiplier value into $11. beqz $10, result_zero li $17, 1 beq $10, $17, result1 li $17, 2 # Initialize 17 to multiplier value sub $10, $10, 1 # Since 2^1 has been taken care of # Multiplication loop. While $10 != 0 keep multiplying $17 by 2, and # decrement $10 by 1 every time this is done. Once $10 == 0, print_result. multiply_for: mult $17, $11 mflo $17 sub $10, $10, 1 bnez $10, multiply_for beqz $10, print_result # Display the value of the exponential function. print_result: la $14, str3 puts $14 # Print out "2^" li $v0, 1 move $a0, $15 syscall # Print out value of user input. la $16, str4 puts $16 # Print out '=' li $v0, 1 move $a0, $17 syscall # Print out result. la $13, newline # Create new line lb $12, ($13) putc $12 b endofline # Print out the result for 2 to the power of 0 (special case). result_zero: la $14, str3 puts $14 # Print out "2^" li $v0, 1 move $a0, $15 syscall # Print out value of user input. la $16, str4 puts $16 # Print out '=' li $v0, 1 li $a0, 1 syscall la $13, newline # Create new line lb $12, ($13) putc $12 b endofline # Print the result for 2 to the power of 1 (special case). result1: la $14, str3 puts $14 # Print out "2^" li $v0, 1 move $a0, $15 syscall # Print out value of user input. la $16, str4 puts $16 # Print out '=' li $v0, 1 li $a0, 2 syscall la $13, newline # Create new line lb $12, ($13) putc $12 b endofline # If the input is not appropriate, print str2 and exit. exit_donothing: la $13, str2 puts $13 b endofline # This is the exit statement. endofline: done # END OF PROGRAM # Define strings which will be used throughout program .data prompt: .asciiz "Enter a digit '0'-'9': " str2: .asciiz "Bad user input. Quitting.\n" str3: .asciiz "2^" str4: .asciiz " = " newline: .byte '\n'
Programming in the Big Screen
by Hanly on Feb.22, 2009, under School, Technology
Last weekend I had a programming assignment due and David my roommate had checked out a projector to watch movies on. While everyone left for a party I stayed by myself programming…yes very geeky. Even geekier was what I decided to do. I hooked up the projector to my computer, projected it on the wall, and took my mouse and keyboard to the futon. I fired up eclipse and started to program. After a few hours of staring at the projection I went out into the hallway and everything looked so dim and yellow. In the end I finish my programming assignment and got an A on it.
Powers of base 2 in C
by Hanly on Feb.21, 2009, under Computer Science
This program takes a user input from 1 through 512 (inclusive), and calculates all powers of two that are less than or equal to the value. The program prints out all of these values.
NOTE: Due to my usage of the math library’s log function, it is necessary to compile using -lm under Unix systems for the linker to properly define the log function. Information referenced from: http://c-faq.com/fp/libm.html
/* Assignment1: Powers of 2
* by Hanly De Los Santos
* Copyright ©2009, Hanly De Los Santos. All Rights Reserved.
* http://www.hdelossantos.com
*
* This program takes a user input from 1
* through 512 (inclusive), and calculates all powers of
* two that are less than or equal to the value. The
* program prints out all of these values.
*
* NOTE: Due to my usage of the math library's log function,
* it is necessary to compile using -lm under Unix systems
* for the linker to properly define the log function.
* Information referenced from: http://c-faq.com/fp/libm.html
*/
/* Load standard I/O library */
#include <stdio.h>
#include <math.h>
/* Define macro */
#define ARRAYSIZE 10
/* Declare function prototypes to define the output of the
* following functions.
*/
void printPowers(int ar[], int firstindex, int lastindex);
void setPowers(int userinteger, int ar[], int lastindex);
main(int argc, char *argv[]){
int powers[ARRAYSIZE];
/* This determines whether there are 2 arguments in the command
* line input. If there are less than 2 arguments, then a message
* is printed prompting the user to enter a positive integer value.
*/
if( argc < 2)
printf("Invalid command line. Positive integer value required.\n");
/* If there are 2 variables, then the second variable is tested
* for the required integer values.
*/
else{
int usrval = atoi(argv[1]);
/* If the user input value is within the accepted range
* 1-512, then the operation is done with the user value.
*/
if( usrval >= 1 && usrval <= 512 ){
int maxexp = ((log(usrval))/log(2));
setPowers( usrval, powers, maxexp);
printf("Powers of 2 that are less than or equal to %d are:\n", usrval);
printPowers(powers, 0, maxexp);
}
/* If the value is greater than 512, the operation is done with the
* maximum value of 512
*/
else if ( usrval > 512 ){
printf("Powers of 2 that are less than or equal to 512 are:\n", usrval);
setPowers( 512, powers, 9);
printPowers(powers, 0, 9);
printf("argc is equal to: %d", argc);
}
/* If a character/negative number is entered instead of an integer, the user is
* prompted that a positive integer is required to complete the
* operation.
*/
else if ( !isdigit(usrval) || usrval <= 0 ){
printf("Invalid command line. Positive integer value required.\n");
printf("argc is equal to: %d", argc);
}
}
return 0;
}
/* This function sets the array's values; only the array elements
* whose values are less than or equal to the userinteger are set.
* It calls function power() for each value.
*/
void setPowers(int userinteger, int ar[], int lastindex){
int i;
for( i = 0; i <= lastindex; i++)
ar[i] = power( 2, i );
}
/*This function calculates and returns baseexponent utilizing the
* math library function 'pow'.
*/
int power(int base, int exponent){
int e;
e = pow(base, exponent);
return e;
}
/* This function prints the program's output. For each array
* element in the range of integers defined by firstindex and
* lastindex, the function prints one line of the output.
*/
void printPowers(int ar[], int firstindex, int lastindex){
int p;
for( p = 0; p <= lastindex; p++)
printf("2^%d = %d\n", p, ar[p] );
}
Matcha & a Book
by Hanly on Feb.01, 2009, under School, The Wisconsin Experience
Today I needed to buy a book (Blues People by Amiri Baraka) I have to read for my ethnic studies comparative literature class. I had waited so long to get the book, considering I need to have it read by Tuesday, that the only place I would be able to get it on time was Rainbow Bookstore. This was the bookstore the professor has ordered the book at. I took the 80 bus down to the Humanities building, then walked down State Street headed towards the capitol. Rainbow Books was near State and Gilman, which is about halfway between campus and the capital. Before I left I made a note to try to find Dobra Tea, a tea house in downtown Madison that sells matcha. Last semester I wanted to try out matcha and upon doing a search I found that Dobra was the closest place that sold it. I had walked down State many times trying to find it as I passed and funny enough it had been right under my nose. Anyways, after buying the book I decided to stop by to try matcha.
I went in and was given a small menu book which had a brief history of the tea house, with the preceding pages having the teas they offer separated by country of origin. With the book came a bell, which I was instructed to ring if I had any questions or when I was ready to order. I thumbed through the pages, already knowing what I wanted but deciding to make sure it was on the menu. I rang the bell, and ordered the Matcha Kyoto. I started reading the book as my order was prepared. I was expecting to just get the tea made like one usually gets at regular places. However, to my surprise Dobra takes their business seriously. The weighter (for lack of a better word) attending me sets up a stool opposite me and brings out a tray with a tea kettle, chasen, chawan, chakin, chaire, chashaku and three small leaf shaped cookies. He asked me if I had had matcha before, I replied that I hadn’t and he began to explain the tea ceremony procedure which traditionally goes with matcha in Japan. He explain that matcha is usually served at a Japanese tea ceremony which is usually an all day affair, but that at Dobra they had adapted it to give their customers the experience.
He began by cleaning the bow as it is traditionally done; by taking some of the hot watter from the kettle and slushing it around the chawan with the chasen. He then emptied it into a pot, and began cleaning the chawan with the chakin, after which he scooped up 2 scoop fulls of matcha with the chashaku and placed them in the chawan. He then took 2 ladle fulls of water from the kettle and dripped into the chawan. He then took the chasen and began whisking the matcha until it was frothy and green. Upon finishing he grasped the chawan gave it a turn, and handed it to me. I took a sip, and it was great. I really enjoyed the atmosphere, and attention Dobra gives their teas.
Sledding down Liz Hill.
by Hanly on Dec.09, 2008, under School, The Wisconsin Experience
Originally uploaded by lableupunn_tux
Last night my neighbors and I went sledding down the hill next to Elizabeth Waters Hall. The side on this picture isn’t that steep, but the one closer to the dorm is. Not only that, but it also has bumps along the way, which make it quite exciting, painful, and difficult to stay on your tray. To that add the few people carelessly walking down the same path we’re sledding over, and the fact that it is a paved path that has been cleaned and you essentially risk injury every time you go over it. Nevertheless, it is a very fun and worthwhile experience, even if you can’t feel your face, butt, or hands and you return home all wet and covered in snow.
Camp Randall Stadium
by Hanly on Nov.24, 2008, under School, The Wisconsin Experience
After the game this Saturday, which we won!!! Despite our chances looking somewhat bleak at the beginning. Maria, a friend of mines and I went to volunteer for Rethink Madison picking up recyclables left in the stands after the game. After we were finished and there was no-one at the stadium we decided to go to the field and take a few pictures, until someone in the cleaning crew yelled out to us to get off the field. Nevertheless we still had plenty of time to sing the national anthem, take pictures and a video acting like we were scoring a touchdown, and randomly walk around some.
Up from the stands the field looks so small, but once on it, you are the one feeling small as you look out into the stands. It must be an amazing feeling to stand on the field during game days, as a sea of red and white cheers on.



