Monday, February 14, 2011

Java- So evil, yet so sublime...?

So, I have a ton of homework to do, as usual. I am doing fine in writing and calculus, but am practically failing my Data Structures and Algorithms Java class and have like a 'C' in Discrete Math. Anyhow, instead of doing that homework, yet again as usual, I spent my time programming useless things for my own personal uses and reasons. My latest? A Java GUI that will close your music player for you after a specified amount of time (in minutes). I was just so proud of it that I thought I would post the source code (works with Rhythmbox in Ubuntu, but easily alterable to any OS):


package rhythmBox;

import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class closeRhythmBox extends JFrame implements ActionListener {

private static final long serialVersionUID = 1L;

private static final int WIDTH = 400;
private static final int HEIGHT = 300;

private JTextField minutesBox;

public static void main(String[] args) {
new closeRhythmBox().setVisible(true);
}

public static void execKill(long minutes) throws InterruptedException {
Thread.sleep(minutes*60*1000);
try{
Runtime.getRuntime().exec("pkill rhythmbox");
System.exit(0);
}
catch (IOException ioe) {
         ioe.printStackTrace();
       }
}
public closeRhythmBox(){
setTitle("Rythmbox Timer");
setSize(WIDTH, HEIGHT);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Container pane = getContentPane();
pane.setLayout(new FlowLayout());

JPanel box = new JPanel();
box.setLayout(new FlowLayout());
JButton startButton = new JButton("Start");
startButton.addActionListener(this);
box.add(startButton);
box.add(new JLabel("Minutes Until Close"));
box.add(minutesBox = new JTextField(20));

pane.add(box);
pack();

}

public void actionPerformed(ActionEvent e) {
String textNum = minutesBox.getText();
long minuteNum = Long.parseLong(textNum);
if (e.getActionCommand().equals("Start")){
try {
execKill(minuteNum);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}

Enhanced by Zemanta

Friday, February 11, 2011

PaRaDoX!? -When Reality Becomes Stranger Than Fiction

RadiolabImage via Wikipedia


Paradox can mean many things, such as in my discrete math class, where it defines a particular logical statement to be impossible. A paradox can also describe something that is counter-intuitive (you would think the opposite of the actuality). Today at work I listened to RadioLab (a cool NPR/WNYC podcast I recently found) titled "Numbers." While it wasn't quite as good as "Lost & Found", it is definitely up there...along with basically every other episode (http://www.radiolab.org/2009/nov/30/).
BenfordsLawThey were talking about something called Benford's law. Basically, if you find anything numerical, then the first number is most likely to be 1 (30% chance, aprox.- according to the chart above...calculated by averaging first digit from many sources). It was amazing to see how this serendipitous discovery led to so many applications, going as far as use as evidence in criminal court cases. Investigators can look at someone's bank account balance and if it doesn't follow Benford's law, then they may be committing fraud. It seems so, what's the word...oh, ya..."counter-intuitive"? Nevertheless, it seems to hold true (listen to podcast to learn more).



Monty Hall paradox illustrationImage via Wikipedia
This got me thinking about another paradox I ran into a while back called the Monty Hall Paradox. For just a second, imagine you are on a gameshow and the host shows you 3 different doors. Behind one door is a goat, another has a Porsche an the other contains nothing. The host then asks you to pick a door (in hopes of getting the Porsche, of course), so you randomly pick a door, say #3. The host then tells you that there definitely nothing behind #2 and proves it to you by opening it. Lastly, he asks you if you would like to switch or open the other door. Which should you do? Does it even make a difference? Answer...?

You should always switch because when you originally picked the 1st door you only had a 33% chance of picking the Porsche and now between the two doors that are left, there is a 50% chance. I found this interesting, but didn't quite understand (and you are probably still scratching your head too I suppose? ^_^). This is why I decided to put my Java programming skills to use to write a program to test this out. When writing I realized there were several possibilities (going under assumption that you always switch):
1) I originally picked the ONE door with the Porsche  and when I switch I will get crap.
2) I picked one of the other TWO booby prize doors and when I switch I will get the Porsche.
Ok, point proven...but if you are still unsatisfied you can try it yourself or run my java source code:


import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

/**
 *
 * @author JT Newsome
 * Demonstrates the Monty Hall Paradox and theory of probability.
 *
 */
public class MontyHallTester {
public static int forMonty = 0;
public static int againstMonty = 0;
public static int min = 0;
public static int max = 2;
public static int timesToLoop = 1000000;

public static void main(String[] args) {
for(int i = 0; i < timesToLoop; i++){
montyTest();
}
System.out.println("forMonty: "+forMonty);
System.out.println("againstMonty: "+againstMonty);
System.out.println("Ratio: "+ (forMonty/againstMonty));
}

public static void montyTest(){
ArrayList boxes = new ArrayList();
boxes.add(0);
boxes.add(1);
boxes.add(2);
Collections.shuffle(boxes);
Random rand = new Random();
int randomNum1 = rand.nextInt(max - min + 1) + min;
if (boxes.get(randomNum1) == 2){
againstMonty++;
}
else forMonty++;
}

}


Ok, well that was fun! Happy days until we meet again!
Enhanced by Zemanta

Monday, January 24, 2011

Added Last FM to blogger so you can stalk me even more!

Instead of doing my homework I have wasted my life away by trying to make it so my music player would sync with lastfm, which would then send the information to my blog. Now you can know when and what I listen to 24/7! I still haven't got it to work 100% however. There are a ton of songs that it does not recognize and therefore does not display what I have been listening to, which is a real shame because now you can't see all my obscure techno. Maybe I will try and fix that this weekend. For some reason I have had absolutely no motivation towards school. Hopefully I will find the inspiration soon. Well, I guess I have had a lot of fun doing my calculus and actually got ahead by several weeks, but everything else has just been dread and depressing. Anyhow, I had better go. Farewell (to the whole 2 people who look at this).

Oh, and thanks so much to this person: http://chapmanit.blogspot.com/2010/01/last-fm-widget-found.html.

Thursday, November 11, 2010

American Education Reform In The 21st Century: From Grassroots to the Lawnmower

I figure that I would eventually go on a rant about nationalizing education, so I thought I would funnel that frustration into writing a paper for poli-sci. My neurotic professor said that if our paper is good enough that he would publish it. I highly doubt anyones papers are good enough to be published, but that is just my opinion. I mean it took over 40hrs to write an EE that received a "C"...only highly researched papers that are well structured and prove a point have a chance at that. Of course, what do I know. Anyhow, life is about the same: sleep, eat, work, go to school and occasionally a game of chess or episode of Glee. Well, here is my paper, feel free to criticize it to the bone or flatter me with ridiculous comments.

Written by JT Newsome for POLS-1100- November 2010. For educational and entertainment value only.

If America's educational system was one big turf of grass, then each state would have its own section with unique methods by which to tend to it. These methods would be determined partially on both national and state education policy and, metaphorically, would include the need for watering, mowing and sunlight. Another factor would be the soil, which is dependent on how previous generations acted. Let's have a grass seed represent an individual student, their success measured by the growth of that seed and, lastly, their equality represented by the height of one blade of grass relative to all the other blades. This paper will first expound upon the past and present circumstances regarding the success and equality of this “grass”, then go onto discuss possible solutions to improving these circumstances.

Education has been extremely important in both the past and present. There will always be many countries competing against one another to gain a more voluminous sphere of influence and power. Education is a prime factor in determining the competitiveness of one country against another. It is what drives innovation, technology and growth in a nation. This is why it is exceedingly salient to think critically about the effectiveness of our educational system and continually strive for improvement. If we do not maintain our “grass”, then it will whither and become overrun by competitors. According to a Newsweek study, the United States does not even rank in the top 25, globally, in regards to education.1 This demonstrates the reality of the situation and direness of educational reform in America.

Objectively measuring the effectiveness of education is difficult, per se, especially under our current education system. There are many factors which are observed to indicate educational success, but graduation rates are probably the most prominent indicators. Over the past two decades the average graduation rate in America has fluctuated. According to NCHEMS, the graduation rates were: (in percents) 71.2, 67.1, and 68.6 in 1990, 2000 and 2006, respectively.2 We must be careful what conclusions we draw from this data. It may seem evident that education may may have slightly deteriorated between 1990 and 2000 and then had slightly rebounded in 2006, but we must carefully examine all conclusions drawn away from this data and their validity. For example, each state has its own individual laws in coordination with various federal laws and mandates. If graduation requirements in one state are more difficult in one, then the probability of failure would increase to some degree and thus decrease graduation rates. In 2006, Nevada had a graduation rate of 50.5% and New Jersey had one of 86.3%, for a difference of 35.8%. If a major cause of such low rates in Nevada is indeed because a rigorous curriculum and vice versa, then who did the better job: NJ or NV? Is producing 50 well qualified students or 90 semi-qualified students better? Furthermore, the variability of the data around the mean (68.6%) suggests inequality between states. How can we ensure equal opportunity among citizens when we cannot even obtain sufficient data for meaningful state-by-state comparison? Experimentation by each state is a great idea if it helps us deduce the best was to structure education, but how do you determine the best way from 50 completely different experiments?

One solution to this particular problem would be to nationalize education, at least to a certain degree. Education is primarily a state right, as stated in the Constitution, so it would probably have to be amended. Under the current sentiment of decreasing the scope of the national government and due to the difficult nature of amending the constitution, the probability of this ever becoming is reality is, at best, minimal. However, for the purpose of this paper we will go under the assumption that it is a viable possibility.

There are many different ways in which we could nationalize education. One would be to institute a national examination for each grade. Every state would have a delegate to go to a convention which would decide on what material would be on each exam (of course, not all the work would be able to be completed by the delegates alone and they would be able to select other persons to aid them in completing their tasks). The test would consist of 3 distinct parts: exam 1, exam 2 and additional projects. Exam 1 would be administered in Nov. and the 2nd in May, each coving half of the specified material. Additional projects may be required, such as writing an essay or doing a certain amount of hours in an activity (e.g. science laboratories, community service, or extracurricular activities). These extra projects will help by: a)providing equality for students who lack aptitude in standard tests b) increase civic responsibility by requiring students to give service to their country and c) allow students to try and apply academic concepts to a topic that interests them.

One problem that arises from this is feasibility. One possible remedy is to only administer one annual test to children in elementary, then starting in 6th or 7th grade we can begin to introduce other requirements to them so that they can get practice for when it begins to be officially recorded in high school. Enforcing a bi-annual exam may be overkill and could be likened to staring at the grass waiting for it to grow. However, in theory, it should help provide insight into their progress. Whether or not that is feasible should be decided after at least one cohort has successfully completed high school under this scheme.

Fairness and reciprocity in grading and assessment of proficiency in a certain area will also be difficult to formulate. One way is to have each exam be worth 40% and extra projects 20%, with slight variations between different subjects. Based on performance a curved grade between 1 and 10 would be awarded. Out of the core topics: social science, math, science, english, etc...two topics would be chosen to focus on and would last two years instead of one (exams would be annual for focus topics). In order to get a diploma, students would need to earn an average of 5 in all subjects and score higher than 3 in focus areas. This would allow for students to compensate for ineptitude in one area by aptitude in another.

As you may be able to see, I personally support the nationalization of our education system, but have attempted to discuss the subject critically and provide remedies for many issues that will emerge from nationalizing education. There's much evidentiary support that suggests that our current system does not ensure the equality that is such a tenet of American government nor does it provide the competitive edge we need to succeed in an increasingly international world. While nationalization is one of many solutions to this problem, I believe it would be the most simple and efficient one- Randi Weingarten, President of AFT, perfectly summarizes why: “Should fate, as determined by a student's Zip code, dictate how much algebra he or she is taught? Such a system isn't practical: Modern American society is highly mobile. And it's just not right -- every child attending U.S. public schools should be taught to high standards, regardless of where he or she lives...The time has come for a serious consideration of national academic standards.”3 There are going be numerous other problems that will stem from creating 'national academic standards', but if we just take them each one step at a time then we can at least know that we are going in the right direction.

Just as the community stimulates grassroots growth, the Federal government is needed to function as the lawnmower. We should not be frightened of the big bad lawnmower, we should embrace it. We need to put aside our deeply rooted ideologies and find a compromise that satisfies both of these seemingly contradicting things and do what is right for America and finally get some sort of educational reform passed!

1. Newsweek. "Interactive Infographic of the World's Best Countries - Newsweek."Newsweek - National News, World News, Business, Health, Technology, Entertainment, and more - Newsweek. N.p., n.d. Web. 6 Nov. 2010. .

2. The National Center for Higher Education Management Systems. "HigherEdInfo.org: Public High School Graduation Rates."Web. 6 Nov. 2010. .

3. Weingarten, Randi. "Randi Weingarten - The Case for National Education Standards - washingtonpost.com."Washington Post - Politics, National, World & D.C. Area News and Headlines - washingtonpost.com. N.p., n.d. Web. 6 Nov. 2010. .

Friday, November 5, 2010

Postprandial Precocious PeRColating Past-times

I officially deem today "P" day! I officially dedicate it to the large "P" section in my Webster's New 3rd World Unabridged dictionary. First off, I heard the coolest thing on NPR (SciFri!!!) today. They were discussing precotial species of birds, which are able to fly directly after hatching, which is pretty amazing. Humans are on the complete opposite of the spectrum, being uber-altricial. I mean, some of us are still with our parents when we are 30yrs old. Both strategies have their advantages and disadvantages, of course. Reflecting on my own life, I am probably a bipolar mix of both.

I partially attribute my precociality to the fact that my parents held me a year back and had me take pre-school 2yrs in a row. I was always a year ahead in experience from my peers, which probably gave me an edge academically but also set me apart. To this day I still don't like associating with kids my own age (don't know if this was the true cause for my antisocial nature, but it is a good suspect). I suppose I don't like talking to people who are dumber than I am because their stupidity annoys me to insanity, so I guess if I talk to you then that means you are probably more intelligent than me in 1 or more aspect and I believe that you can teach me something.

Speaking of stupid people, I got stuck next to this clueless blonde girl (sorry for blonde discrimination...). Maybe she isn't stupid, but definitely super-uber-double-altricial. She asked me if she should go and get the "D-scale" quiz we were taking in poli-sci, so I told her: "Yes...". i don't know why she had to ask me, I mean if that is what everyone else is doing, then you probably should not just sit there and stare while everyone else works. Then she asked me what "Don't Ask Don't Tell" is and what she should mark (1-7) if she "liked gay people." I tried not to laugh and told her what to do.

Onto more absurd scientific coincidences- "There are no coincidences, only the illusion of coincidences"- V. On my bio-test there were some questions about sliding muscle filament theory, which after I read it 12 times I finally understood it and actually thought it was kind of intriguing. Today the class before my compsci class had written a whole bunch about it, except the more complicated graduate level version, but I still knew the generalities of it. Then today I saw a small spider in the shower, one of the few that don't creep me out (the cute little fuzzy jumping ones). Suddenly I gained perspective on the scale of molecular biology. A similar process probably takes place for that tiny little spider to move- the same thing that makes my muscles. just an interesting insight of chemical universality. I suppose I will never be able to fully comprehend the minuteness of atoms.

Also, new this week I think I have decided to double major in applied mathematics. I figure, if I ever want to get into cryptography I am probably going to need a degree in math. I was kind of scared at first because of all the brainwashing I have undergone to fear math, despite my great resilience and advocation of mathematical advancement (Go Wolfram|Alpha!!! Just had to say that). I guess when I reflect on my math career, I have had a lot of bumps on the way and I know I will in the future, but that should not stop me from at least taking a whack at it. Maybe I am secretly a super math genius? :)

Well, I have to go write my polisci paper, at least part of it, before I go to work in about an hour. I think I am going to title it: "Educational Reform In The 21st Century: From Grassroots to the Lawnmower." Thought it was a clever metaphor that makes people go: "what?!" Anyone that has strong opinions on nationalizing education to make it more efficient, fair and globally competitive, then please do comment and I will consider your ideas for my paper. Fair well for today!

Friday, October 22, 2010

China, KFC and Sexy Dancers!

In my computer science class I always sit next to this Chinese foreign exchange student and sometimes he just says the most hilarious things. He can't speak English very well, so half the time I am just staring at him with a blank face. First we were talking about KFC and he was wondering if I had ever been to the very first KFC and if I liked the buffit (as he called- aka "buffet"). Then he asked me if I was going to Crimson Nights, but I told him I had more fun eating binge food and watching an episode from one of my favorite TV series (Sabrina the Teenage Witch, Malcolm, Anne of Green Gables, Alias, Battlestar Gallactica, Stargate, Glee, Chuck, to name a 'few.') Anyhow, I responded by asking if he went to the 1st one they had and he said he did but that it was "very American party with lots of sexy dancing." Apparently they like to do Karaoke in China for parties, or at least that's what I got from the rest of our conversation.

In other news, this week was just about as god-awful as the last. Lots of working until 11pm and waking up at 5:30am. In fact, I did that today, and haven't really done anything except school, homework, travel and work, but I am still going (for some inexplicable reason...I will probably just randomly pass out like a psychotic narcoleptic, but oh well)! I did get my first check today, which was more than I have probably ever had in my whole life at one time, but of course it will all be going to pay for my lovely college tuition. *_*

Another interesting thing that happened to me was while I was taking a survey for the U of U about orientation. It wanted to know my sexual orientation. I didn't know which was most appropriate: gay, bi, straight (but obviously not transgendered because that's too expensive). I was having another personal indecisive dilemma until I saw asexual...
if (philophobic && virginal && non-reproductive) {
return asexual}
It is the perfect option for people who believe that everyone should only have sperm and egss extracted, which are cryonized and then the person is sterilized. Or for people who are simply afraid of intimacy or just feel incredibly awkward when other people touch them. I would have to say that I am one of those crazy people with absurd paranoia disorders (my mom is super paranoid about what we are doing, so maybe it is genetic or simply a maternal trait?). For example, I am scared that someone will hear me peeing in the bathroom or that I am breathing too loudly when I run. Either I am seriously disturbed or insanely insecure? Well, that was sufficiently awkward, now you know some of my darkest secrets don't you feel so special (for the 2 people who even periodically read my rants)?! :)

Oh, one last deep dark secret...I love singing Madonna on my computer microphone! I got this program called FL Studio and it has tons of features like multiband equalizers, autotuning, reverberators and all kinds of other weird things. And also anything by Kristin Chenoweth (Glee, Wicked, Pushing Daisies- you name it!). Ok, I am now going to go to bed before I say anything that might jeopardize national security or something. ;) And also leave a memo to myself to never write in my blog when under serious sleep deprivation...au revoir!

WoD: Ornithorhynchus: The Platypus (Ornithorhynchus anatinus) is a semi-aquatic mammal endemic to eastern Australia, including Tasmania. Together with the four species of echidna, it is one of the five extant species of monotremes, the only mammals that lay eggs instead of giving birth to live young...courtesy of Wikipedia.

Wednesday, October 20, 2010

Dearth and Disconcertment

Let me begin my story about 6 months ago. It is summer and all I am doing is my daily chores and watching TV, at this particular time: Alias. This is where my chess addiction spawned from. Sydney's father challenges a random man that he can checkmate in 9 moves. I just had to wonder how anyone could do that? It just so happens that he is the CIA's foremost Game Theorist. The applications of game theory to both chess and reality were intriguing to me, so accidentally downloaded a bundle of books on the subject. It was not quite as exciting and blatantly applicable as I had probably anticipated, but I guess that is somewhat irrelevant for the moment. The prisoner's dilemma and the Nash Equilibrium (developed by the guy from A Beautiful Mind) were interesting, at least from what I actually understood. It was also just a lot of jargon on economic theories.

Anyhow, getting to the point...On Monday my political science professor took a vote from the class to change our first midterm's weight grade from 30% to 25%. I scored 95/100, so it is obvious that 30% would be better. Usually I am pretty passive and tolerant of people, but when you start messing with my grade things quickly change. I basically vowed never to let GPA get in my way and made it a goal to always and forever get a 4.0 because I had gotten screwed over so many times in highschool (not that my 3.89 HS GPA was bad, just not good enough to compete, apparently). So I raised my hand symbolizing my opposition in this. However, disconcertment quickly descended upon me as soon as I realized I was the only one raising my hand and everyone was staring at me.

Things became worse today after my professor asked me to stay and talk with him after class. Just for the record, the only people he has said this to is if he sees them texting and playing their computer all through class or because they failed their midterm. I was totally befuddled at his request, but did as he asked.

As I naively waited for him I peered aimlessly around the classroom. I was totally took by surprise when he began speaking. My voice instantly became frail, face red and eyes watery. (Please note that I have an irrational fear of authority figures and when they seem mad at me, then I can't help but freaking out. I am pretty stoic or mask feelings with sublimity.) Basically, he thought that I hated him or something. That I didn't agree with anything he said and totally resented his teaching methods. he even went to ask me if I was a "loner." Not sure where he got the idea and nerve to ask that, but ok. I have to wonder if this was all triggered somehow by me raising my hand about a stupid 5% grade weight change? I was not consciously acting any different than I had been previously. I admit I had found some of his teaching methods stupid, but I still went to class, the early morning reviews and did well on the midterm. I don't even care if the teacher is a total bitch, so long as I learn the material and I am given a fair chance to earn the grade I deserve.

I am honestly still a bit confused about the whole thing, it was all sort of overemotional and surreal. I don't know where this is going or where it might end, I guess only time will tell. Let's just hope more random semi-intimidating conversations are not on the agenda again because they are annoying and I have to write a 50,000 word rant about them! It also has left an uneasy feeling whenever I think about the class, which I don't like. It was a lot better before the midterm. He said he would give a book to the highest scorer in the class. I am highly motivated when it comes to academic competition enhanced by positive reinforcement. Now that feeling seems to have washed away. Anyhow, I need to get back to my homework before I go to work. Oh, I also have to pay tribute to Madonna for making the Power of Madonna Glee episode a reality because it was epic!

Words of the Month:
Disconcertment: anxious embarrassment.
Dearth: an acute insufficiency