Sunday, November 13, 2011

Change a textView field after creating an Activity

Problem:
I could not remember how to change the textView field after the start of the program. I got an error that was caused by the int to string conversion. I finally got my code to work and I decided to share it.
I added a button to make the application more interactive


Code:

public class Main extends Activity
{

Button add;
TextView tv;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
     
        add = (Button) findViewById(R.id.button1);
        tv = (TextView) this.findViewById(R.id.TextView01);
     
        tv.setText("0"); //the starting value
     
        add.setOnClickListener(new View.OnClickListener()
        {
        int counter = 0;
        String s = "";
       
@Override
public void onClick(View v)
{
counter++;
s =  Integer.toString(counter); //change to string
tv.setText(s); //the text will be changed here.
}
});
}
====

I am sure that I ran into a better method of adding text to the TextView. I just wanted to publish this here as it might help others getting something running. If you can see any areas where I can refine my code then please post it in the comments.
Monday, November 7, 2011

Interview Questions by Chris Foley - Starcraft 2

A teammate in my UNCC SC2 team (and a friend of mine) wanted some help with his paper. I liked the questions and I think that the answers would make a good blog post.

Starcraft Questions
What is Starcraft to you?
A game. A very good one.

What got you into Starcraft?
The pro scene. I always enjoyed video games but I had never looked at videogames as competitive until I found out youtube videos of tournaments played in Korea and WCG. I picked up the game afterward and the more I tried to improve myself (by looking strategies , practicing with mentors and applying stratagies I watched others do). The better I got in the game the more I  enjoyed it.

If you could have time to truly dedicate to Starcraft would you attempt and try to go pro with it?
Not really.. I have a huge respect for the proscene but I don't think that I would enjoy it much.

Do you see yourself playing starcraft for as long as possible?
Not starcraft, But I will surley continue playing videogames forever as long as I can find the games that would let me practice those skills

What is the most difficult part of starcraft for you?
Improve my analytic skills. I tend to get frustrated at games that I lose without knowing the reason why I lost or what should I have done better.

What motivates your to become better at starcraft?
I think a lot of the concepts that I learn from SC can be applied in real life. I see a lot of concept in my real life as game concepts. An example would be time management and how spending more effort on one part would have to be sacrificed on the other side.
Also I realized that I get the same feeling while playing as the one that I get when I am taking a test (a headache from the lack of oxygen and long period concetrating).
There is a lot of pressure when I play and I become extreimly tired. I had felt my heart beats many times and I could not sleep after games because of the adrilanin in my body. Knowing that I can become better at those situations by playing more "games" can only make me happier.


Social Questions
What is your reaction to people who call you a nerd?
I have always liked it and I embrace it more now. I know that it can be looked at negetivily, but I have always enjoyed who I am and I love it when I find other nerds to hang out with. I think that we should all be passionate about something and become nerds for what we love.


Do you have a girlfriend? If not is there any particular reason why not that you care to share?
lolno because of video games!. Ok not really but I know that is the answer that you wanted.

I am from a different culture (I moved to the US 7 years ago) and I don't have a lot in common with most of the people that I meet. It is hard enough for me to make friends due to my narrow interest (but I try!). I see relationships as a higher level of friendship so that narrow it even more. The pool is very small and to be honest, I enjoy the freedom now.

Can I just go and find a random girlfriend? of course, but I do not want to watch a crappy movie and eat dinner somewhere every weekend. I guess there are things I need to scarafice.

Do you consider yourself to have a social life outside of gaming and starcraft?
Yes. I go to clubs whenever they are having any Electronic DJs and tend to be the one bringing everyone together on the go outs.

Do you go or want to go to big gaming events like Blizzcon, MLG, Gamescon, E3, Dream Hack, etc?
YES! Money and time are my only limits. I finally made it to MLG last year even that my crappy car was broken. It was worth evey pennie.

Have you found starcraft or gaming in general to sometimes distract your from other commitments like work or school? If so how often does it happen?
I only play videogames because I don't want to do my work. If it wasn't gaming then I would find something else to proscastinate (like writing this paper)

Do you go to parties or social events outside of gaming like house parties, sports events, frat parties, clubs, etc.?
Yes. It mainly depends on if I enjoy the people going or not. If you know any house parties coming soon then let me know.

Information Questions
What is your current student status (freshmen, sophomore, etc.)?
Senior
Do you have a job?
Yes. I had 2 this semester but dropped one due to an awesome senior project that I want to put more time into it.
Are you a provider/supporter of a family (help pay bills, etc.)?
It is complicated. But yes I support myself and I didn't ask for money in over 5 years now. I am also expected to support my parents once I graduate school.
Thursday, November 3, 2011

An android App in one day (Under construction)

This blog will document my creation of an app in  2 days  one sitting. I will be using my notes on upcoming presentation that I will be giving in a UNCC student Club (C-Programming Union).

9:45 - I started a bit too late due to homework and lots of house shores. I need to work on my time planning better.

What you need:
Set up your enviorment:
I am cheating with this a bit since I have the IDE setup. But none of the steps are hard. Eclipse takes care of lots of the hard work. Use this link to have your up running and build on it.
http://developer.android.com/resources/tutorials/hello-world.html

I say follow the tutorial to get something running. My tutorial will follow the same steps but for another project as I think it would be a waste of time to write the tutorial again.

===
THE PROJECT!
For this project, I will do a greeting card app. The app will be the greeting card and I will just send it to my friend to tell him happy birthday. He is a nerd so he will understand.

Quick sketch of the final result!


LETS GET STARTED!
Create a new Android project following the steps on the hello world sitehttp://developer.android.com/resources/tutorials/hello-world.html#create
These are the Fields that I used ( withg comments //javastyle)

Project name: Greeting Cards //Name of the project
Target: Select a platform version that is equal to or lower than the target you chose for your AVD. (what version to work with. I just put 7 which is the same as 2.1. It doesn't matter much)
Application name:  Greeting Cards // The application name
name: com.cola.greetingcards // this is complicated. think of it as making your own package for use later. 
Create Activity: Main // your main class name


Once you fill up everything, Click on "Finished" and you will be directed to the main class.



package com.cola.GreetingCard;


import android.app.Activity;
import android.os.Bundle;


public class main extends Activity  //I made a mistake with the name of the class. Can you guess it?
{
    /** Called when the activity is first created. 
     * You will put in your code inside it. Think of it
     * As a constructor
     * */
@Override
    public void onCreate(Bundle savedInstanceState) 
    {
//inherit the onCreate from the on in the Activity class    
        super.onCreate(savedInstanceState);   
        //Show 
        setContentView(R.layout.main);
    }


}





Run your code and it would ask you where do you want to show the application. I use the emulator (if it is your first time, It would ask you to create an emulator environment. Just choose a 2.1 one or follow the instructions on the wiki website).

WORKING WITH XML!
Using XML can come pretty handy when creating the UI for android apps as it frees the programmer from the annoyance that comes with dealing with positioning. Separating the layout and display from the behind the scenes can save a lot of time. I hated having to deal with XML at the start but now I will never go back.


Jump to the main.xml file and change the values to make the app display what you want.


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Happy Birthday Enrique"
    />
</LinearLayout>


Now run your application and it will display the new changes.
YES!

Now Lets try adding more resources( like text and images) on the canvas

Adding an image:
We need to put the image in the project somehow. We need to put the image in the drawable folder (there are 3 of them, for HD, small display and very small display. Just paste the image in all).

I added an image named android to the HD folder. Then I changed the main.XML by adding this after the text view


<ImageView android:layout_width="wrap_content"
android:layout_height="600px" 
android:src="@drawable/android" 
/>




Run your program and you will see this magic
THIS IS SOME CUTE STUFF

Adding interactivity
I tried adding sound but it doesn't seem as straight forward as I hoped to put in a tutorial. Instead, I will add a button and a toast.
And just to get it out of the way. Toast is a notification that appears to let the user know something. It looks like this:








So to add a button, We should go to the XML and add this part of the code under the ImageView block

<Button 
     android:id="@+id/button" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text = "Random Fact"
/>


You can compile your code. The button will be added. I will go and add the Toast before I compile.


So back to the main.java (man it have been a while. We didn't do anything in java for a while).

Insert this code in the toCreate block (under the part where you load the R.layout.main)


        //Code to handle what happens when we click on the buttons
        Button randomFact = (Button) findViewById(R.id.button);  //Create the button class
        
        //Create a listener that would detect any clicks and preform action
        randomFact.setOnClickListener(new View.OnClickListener() 
        {
        public void onClick(View v)
        {
        //This 1 line will display the toast
        Toast.makeText(getBaseContext(), "Enrique rocks!", Toast.LENGTH_LONG).show();
        }
        });


AND DONE!

It took 4 hours. I ran into a bug that I didn't understand with the button that just worked magically as well as a half hour or so trying to look into adding audio by using the XML but decided to not bother adding it here. Documenting also took some time with all the screen shots getting organized. I need to come back and clean up this blog a bit more.
Edit: I am aware that the "random fact" button is not really random. I think anyone who knows how to code in java would be able to do it. Let me know in the comments if you want me to add that code.


The app is located here:
http://dl.dropbox.com/u/6446381/android/GreetingCard.apk
Tuesday, October 18, 2011

Android mobile app development overview

So I have been programming for the android for over a month now and I have to say .. it is a lot of fun. I just thought that I should brainstorm some quick points on my experience so far.

Like:
-Full use of the java library
-Easy to get started
-Lots of tutorials and a great documentation by google.

Dislike:
-Settings of the emulator (using the phone as an emulator is not an easy task with a lot of unsolved bugs)
-The R class (it is the resource class that keeps track of where everything is. It can give random errors if the file is not rebuilt)

Features that can confuse programmers
-The activity nature (all the events drawn are placed in a stack-like which can cause confusion)
-XML layout (while it is a great feature, It can also be a hinder to nest all the layouts)

I will be giving a lecture on android programming this semester so I am getting stressed on how to prepeare everything. I am sure that the class will be a lot of fun.
Sunday, September 25, 2011

Dinner at Cho-Won Garden with the Korean Students Association


Last Thursday I got invited by a newly friend of mine to have dinner at a Korean restaurant with the Korean Student Association (KSA). I worked on that day and I was tired so I was leaning toward not showing. I put the restaurant’s location on my GPS and I found out that it was five minuets away from my house. Shocking!, since I never seen the place before (it is located on Independence and Sardis area).

I arrived at the place and I found that everyone was waiting to be seated. The majority of the members were Asian but there were many who were interested in the culture. I knew beforehand that it will be awkward for me to meet the +20 people in the club but it was a part of the experience and I enjoy forcing myself into those situations.

We got seated on a long table that the club president has reserved. We took turns in introducing ourselves and 1 fact about yourself (I said my name and that I am happy to be there, cheesy) I got to talk to people around me and I asked for suggestions on what to order. Lots of the socializing was about school and Korean culture in general.

I ordered a beef BBQ (I don't remember the name) Bulbogi and I had to learn how to eat using chopsticks. The food was very good and filling. I had to force myself to finish it so that is always good. There were a lot of traditions that I followed and it really made me feel more sucked into the experience.

Overall, it was an enjoyable experience. I am glad I pushed myself out of the way to attend this dinner (and it helps that the restaurant is five minutes away from my house). I wish I looked more into the menu and tried something more native over being safe.

If you are going to try Korean food then I highly suggest going with a Korean person or someone who knows the culture.

This blog is now making me hungry again... I want more Korean food now.

Shadowing Job Interviews and Advising.

On Tuesday (9/20/2011) I had the opportunity to sit with Dr. Gross and shadow two interviews and an advising session. It was well worth my time as I was just sitting in the computer lab with nothing to do specially giving the fact that I had an upcoming interview with Cardinal Solutions on the same week.

The advising was for a student who joined the school and was interested in joining an internship program. She was not qualified as she did not have the credit for it. So instead Dr. Gross talked to her about the 2 year program since she was interested in grad school anyway. The main lesson to learn from this is to go out and ask. The worst that we can hear is a "No". In this case, It turned out for the best and the student got her course plan set up for what she is trying to major in (being prepared before a meeting is a huge plus and it looks respectful).

The two interviews following were interesting as I have never been in the seats of an interviewer before. I have always seen the behavior questions as useless as the questions they are asking can be really vague and it is hard to answer a questions without knowing what the questioning person is trying to get. After witnessing the interview, It seems as if they are more about how the person answers the question over what the "correct" answer should be.

The last interviewed student was a friend of mine and I personally think that he have done a great job in asking a post-interview questions and express a personal interest in the position. The points that he brought up (Tutor diversity and how it could help the students) which, while obvious, showed both experience and understanding of the work to be done.

Interviews are tricky as it depends on who is on the other side of the table. I was interviewed by Dr. Gross himself and I was shocked when he asked me the behavioral questions. I remember that I was stumped enough to the point where I actually asked him to skip a question (which I don't think is a great idea now since the answer is not what the interviewer is asking, but how you would behave when answering these questions.). I am expecting a lot of interviews in the future so the more experience the better.

Finally I would like to add that I was interviewed by Cardinal Solutions last Thursday. I had my ups and downs. I did a bad job preparing for the interview and I showed up late (I know .. I am still regretting it right now and will be ashamed of it for the rest of my life. We all make mistakes). What I did good was I learned a lot about the company and the interviewers before Thursday.

Overall, The interview went very well (except, you know, the part where I came in LATE!). I enjoyed meeting the people. I love the company already and I see it as a great fit for me in every way.

It seems like I have a lot of interviews to face. I will keep what I learned in mind when I go for my next interview.

Sunday, September 18, 2011

Career Expo (job fair) on September 16

I went to the career fair for the first time on Friday the 16th. There were a lot of companies and recruiters looking to hire students and new graduates.
What went well was the vibe and the organization of the event. It was a odd to see that the location was around a basketball court. I didn't have any issues finding the employers so everything turned out for the best (lots of breathing space)
What did not go well was the number of employers and openings for technical jobs. I did my research before going in and I knew that there were not a lot of companies that I can go to. I only had one company in mind (TIAA-CREF) and after I talked to them I was on my way out. I ran into a cool company called Cardinal Solutions that had fun recruiters and seem to have the culture that I am looking for.
Next time I think I will do my research better as I under estimated companies like Cardinal Solutions (Which I will apply for). Also I think a suit would have helped (I was wearing a polo so I was not bad).

ACM-W Board Game Social w/ Evie Speaking (9/16/2011)

The Event was a social event to both play board games and socialize. We had a guest speaker Evie who created the social game Snagem. I came in late so I was not able to hear the talk about the game and the research Evie done with the game.
What went well about the event was the fun that the people were having. Students broke into groups and played board games. I was able to catch up with 2 of my busy friends so I spent my time talking to them since I don't get a lot of opportunity to talk to them anymore (beside online by Facebook or IM). I still had time to playu apple to Apple
What did not go well was the committees meetings. I think that it is easier to have people dedicated to a role over a whole committing as no one would take responsibility.
What I would do next time is to try to find other interests to do beside games. I love board games but I rather talk to others about different topics. I know that other students want to socialize and discuss other career or academic goals so that would be more fun and productive.
Thursday, September 8, 2011

UNC-Charlotte Starcraft 2 Team

So after a week of talking to my other friends, we officially started a UNCC team to compete in the collegiate star league.

First, Some explanations
Starcraft 2 is a real time strategy video game where the player starts with a base and try to collect resources and build armies to defeat the opposition. The game gained a lot of popularity for it's balance and the level of strategy and skill needed to win. To me it is like a modern game of chess where players don't have to wait to take turns.
collegiate star league (CSL) is a fan run tournament that colleges around the nation (and Canada) participate to play against each other. This year, over 100 200 colleges have signed up.

Now back to the UNCC team
As far is how we met, I wanted to start a team last year but we didn't have enough people (only 1 person online wanted to play). I decided to check again this year and I found a couple of people have already signed up to the team (around 5). I contacted everyone and we decided to meet to know each other.

Last Monday (Labor day), over 11 people showed up and we had a hilarious conversation about what we want to do for the team. We decided that we should hurry and sign up for the CSL and work on other legislation (sign up as a club/sport and all the other paperwork) later.

Overall, this has been a very positive experience. I love meeting people with the same interest as me. I just hope that we were able to use the campus connection to play together in person as it is not helpful to just go on our ways and play from home.

The team will have a strong presence this year and will only grow in the upcoming years.

Saturday, September 3, 2011

Introduction to Artificial Intelligence - an online class experience

Can I get a college education without going to college?
Can I actually force myself to learn without the fear of failure?
Are online classes the future of education?
How can I manager my time between my special interests and life responsibilities?

I ask myself these questions now that I am officially enrolled in the free Stanford's Intro to Artificial Intelligence class. I saw that the class is free so it was an easy decision for me to sign up. It is an easy low-risk and high-reward investment (I think you get a free certificate at the end or some sort of acknowledgement of finishing the course).

I doubt if ill be able to pass the class (it's ok, keep reading). Here is why

1- Time Management
There is a huge chance of me failing due to the nature of my schedule:
I go to school for full time this semester (3 hours per class * 13 = 39) .
I am still working on my internship since last Summer (18 hr).
I work at school as a student lead (10 hr)
That totals out to 67 hours a week of responsibilities!

2- I am lazy
I want to write a huge paragaraph here but I think everyone knows what I am trying to say and I am sure that you are too lazy to read it (I am slick!)

3- Drama
One advantage of computers is that they don't "Have a bad day". I personally struggle putting away a life problem to focus on the task that I am doing.

So as you can see, my biggest difficult for the class is .. ME.

I think the best way for me to overcome those issues is to test myself out with new challenges. After all, we all need to learn how to fail before we succeed.



I failed my way to success.
-Thomas Edison



Failing is the new sexy!
-Me

Minigolf with friends

I decided to try playing minigolf with my friends and invite the students to try something new. I played minigolf twice in my life (once on my birthday) and the game is a great way to talk to others. I also thought that this would be a great way to find an activity to do on a Friday after work.
Sadly the event did not go well. I announced the event late and no one wanted to come. The wether did not help as we had a rainy day.

Next time (and there will be a next time) I would announce the event earlier and I will check the weather before planning an outside event.

ACM meeting - Don't call it a come back!

Last Wednesday was the first meeting for the ACM (Association of Computing Machinery) this semester. The meeting was to recruit new members to join the club and to tell them what we do in the club. We had a big showing of students and many of them came because they felt like they were in school for a long time but have not done anything beside the classes. I enjoyed meeting new students and talking to many outside of the class settings. What I did not enjoy (and I feel responsible for it) is the lack of directions. putting everyone in one area and asking them to "socialize" is a big mistake. I personally feel awkward in those situations and tend to walk away. Other than that, I think the meeting went well and I am looking forward to the future events.

Art Galary - Drawing with objects



I went to the Art Gallery at the union last Monday (August 29th) between my classes. The gallery had a theme of artwork created using many objects (trash, dead frog thing, bones, water cone cup ..etc).
I went with Ryan and I met Sai and Elaine. I personally did not enjoy the art pieces and I spent my time trying to understand the meaning (which I think is recycle or how everyday objects can look pretty). Next time I think I would go with someone with art appreciation so I can see the art pieces from another prospective.
Monday, August 29, 2011

MLG Raleigh 2011

So it happened... I finally went to the Major League Gaming for the weekend.



Three of my friends decided that they want to go to Raleigh for MLG this year. I have known them for over three years from an Internet Message board. This was the first time I have ever met them in person. I was unsure at first because of all the car problems that I have been having last week (Break failure that caused me to hit a wall) but they kindly offered to drive to Charlotte to pick me up. I did not have a lot of options since I was stuck in my brother's house waiting for my car to get fixed (and no, the car is not fixed yet).

My friends Drove from NYC to DC and finally picked me up on Friday. The weather was not bad and we were at Raleigh at 3:00pm. We ended up sharing a 2 bedroom and I slept on the ground (Hey! I wasn't paying for the room)


We headed to MLG on the next day and it was a blast. Beside of the 4 games that were played (Starcraft 2, cod, LoL and Halo), there were booths set up for the public. I got to try many unreleased games at the Sony booth. I had a blast watching live Starcraft 2 matches. I have watched the streams over the internet but the experience of being around a crowd cheering for the players and talking between the rounds gave me nerd-chills.





The best part of the trip was meeting my friends. We have never met before and it is unreal to finally meet them in person. We look down at online communities and label those who spend their time participating in online community as anti-social. I don't understand why we think that everyone behind a keyboard is a bad-serial-killer-creeper when we all spend hours online every day. I have friends all over the United States and Europe who enjoy the same activities that I do (mostly videogames) who I socialize with daily.


Hopefully, I would be able to organize my trip better. I met many from my city who were interested in going but we could not plan it right. It is not hard to set up the basics. Overall, I think that the fun that you would get from this trip (or any trip you have in mind) would overweight any issues you will face. This was one of the few times were I said "Let’s just do it" and it turned out to be one of the most fun weekends in my life.

Wednesday, August 24, 2011

Student Organization Showcase (8/24/11)

I was able to pass on lunch today and visit the showcase today.

It is self-explanatory what the showcase is. It helps both students find organization and vice versa.

Since I am a part of the ACM, I went looking for the table and I was able to stand by it for some time (under the sun).
I met 3 students from the class (Mamoke Ukulu, Christopher Snyder, Gabriel Shaw) who were interested in joining. It is always exciting to have new members!

Sadly, I had to leave for work. Sorry if you swinged by to find an empty table. I will make sure that the date of the first meeting will be posted somewhere

Team Leaders Meeting - First day

I know that it is somewhat late to talk about an activity that we did last weekend, But the last few days has been busy with me trying to find a professor to sponsor me for a senior project...Fun Stuff!

The Team Leaders meeting was to explain to us what is our role and what are we required to do. Everything discussed was very basic and straight forward. I have never been a position in school before so I was never in a meeting for an academic reason.

I enjoyed being a part of a team where my opinion matters. I think Dr. Gross is very good at directing meetings and our discussions were on point while being enjoyable.

Getting to know the other Team Leads was great. One of the perks of working on what we like is that we end up around people with similar interest. I think Dr. Gross was able to get a great team with a very diverse background. I highly advice getting to meet team leads from other sections. I know I will.

I am very jealous that I didn't get this class when I started at UNC-C. I had to force myself to get out of my comfort zone to start working on my personal development. I am looking forward to see how the class impact the students as weeks go by.
Monday, August 22, 2011

Back to 335

For those who don't know, Woodward 335 is the computer lab that is open for all the CCI students. It has a "free" printer so you would not have to worry about having money in your 49rs card account.

The place hold a spot in my heart because of all the friends/classmates I hanged out with. I consider it the social hub of Woodward and I head there between my classes to see my friends (or make new ones).

Edit: I was not sure on if this would count as an activity. I done it for my own personal fun so don't follow this example.
Sunday, August 21, 2011

Hello World!

I have always wanted to make a professional blog but I always end up losing focus on what I want it to be about.
This time, I will try to share the information with the focus of helping others. I will try to talk about how a truly feel and I hope others would express any opposite views they have.

Shall we start?