Saturday, December 10, 2011

Corporations

Where to start? There is so much I could say on the topic of corporations. People are always so scared of what the government does; believe it or not, the government is probably the least of your worries. The law tell you exactly what they are allowed to do, meanwhile corporations are a lot more free to do what they want. I could talk about class warfare and wealth disparity. That’s the popular thing to talk about, but I don’t feel the need to repeat what you’ve already read. I’m here to tell you things you might not have heard.
I would first like to start by talking about something that, on the surface, is wholly unrelated to corporations. Immigration reform in America. This is a hot button issue. Some people believe that support of stronger immigration reform is tantamount to racism. Not in my opinion. There are laws already in place making illegal immigration just that, illegal. Illegal immigration is disrespectful legal immigrants (they made the effort to immigrate legally), to the illegal immigrant (they are exploited for cheap labor) and America (lost tax revenue).
But why am I talking about it in this post? Arizona, known for it’s controversial immigration policy, was recently considering 5 bills to try to curb illegal immigration. But it did not pass. That’s not why it’s interesting though. It’s interesting because of the reason why it did not pass:60 businesses sign a letter asking them not to do so. Why would they refuse to tighter laws on immigration? Well they cite bad press for being Arizona located corporations, but how does that apply to Wells Fargo, Intel, or Cox Com.? The implication is that these corporations profit, directly or indirectly from illegal immigration, it wouldn’t be the first time a major corporation has been caught doing such.
But even more disturbing is that even though 6,500 citizens could not prevent the turning of the first reforms in the state, just 60 businesses could do so today. The reason for that is lobbying. Not many American know what it is. Basically, it’s legalized bribing. I know, I know, you were as swoon as I was when my grade school teacher recounted the tales of how the muckrakers exposed all of societies ills in the early 20th century and did away with corruption. But today bribing is as alive as ever was, there’s just a few technicalities now. In a 12 year period our public officials accepted $30,529,002,364 in bribes! And if bribes aren’t enough, they offer to hire them! All of this is exacerbated by career politicians, being a statesmen is now a job and not volunteer work. We’ve created a buffer between representatives and the people they represent. It’s not a bad idea, considering you don’t want every yokel in America to exert direct control over the entire nation, but politicians have forgotten who they're representing.
“Too big to fail” has become a buzz word these days to describe some financial corporations. But I think is an apt phase for some of other corporations: super large, super connected companies who pose a systemic risk. Comcast, AT&T, too a lesser extent Disney, and Sony. These corporations dominate a market to the extent that every action they take has an effect on the market. They are able to dictate market conditions beyond what would occur in a competitive environment. And when these corporations are in trouble, the effects are felt even outside their market. When corporations are able hold our economy hostage for a government bailout, it is no longer a question of free market capitalism and instead a question of national security.
CNBC sometimes runs biographies on companies. They’re not really journalistic, more of an hour long commercial for whatever company their doing. But for every one that I can remember seeing, there is always something awful that the company has done to get where they are. And they are not ashamed of it. One of the executives of Coke boasted how they made a killing in South Africa when other companies were boycotting the region at the behest of Archbishop Desmond Tutu because of apartheid.
What do you expect though? Corporations aren’t people, but we treat them as equals under the law. The case of corporate personhood is rather complex and hits on some constitutional issues. First, some background. There’s no definitive corporate law. That is to say, there’s no international law on how these multinational organizations are treated. Most contain some form of idea of Ownership and Separate Legal Personality from that owner. Worst still is the fact that this is one of the few areas where the 10th Amendment is at play and the federal government has left states to create their own laws governing corporations. So, you get odd cases of a Delaware company suing a New Jersey man in a California court. Add to this that federal law is being applied to these corporations and you end up with 50 different pegs being fitted to one hole.
Now, you also have to understand how different companies are structures. One of the core differences between an incorporated business and an unincorporated business is the concept of limited liability. Limited liability prevents owners of a company for being sued for the improprieties of their company.
Let’s take an example: Mom and Pop form a partnership (a form of company that does not provided limited liability), Mom and Pop Company, and start a shop. A customer walks in and slips and falls due to a slippery floor. This customer sues Mom and Pop Company and wins, but Mom and Pop Company has not had a good year, it doesn’t have enough assets to pay the customer. However, because it is a partnership and it’s owners don’t have limited liability Mom and Pop personal accounts must pay the remainder. Now, let’s run this scenario again and assume Mom and Pop incorporated their company to form Mom and Pop Corp.. This time our customer can only sue Mom and Pop Corp. and not Mom and Pop individually. Assuming Mom and Pop Corp. hasn’t done well this year and can’t pay the judgment, there’s nothing our customer can do. Now that’s an extreme simplification, but this is a very important concept, Mom and Pop Corp. is a different legal entity from Mom and Pop. It has its own responsibilities and rights under the law.
So, let’s put this all together. States create laws allowing the creation of corporations, distinct legal entities under that state’s laws. The federal government enacts national laws intended to protect a person’s legal rights. These federal laws are then applied to corporations because they are distinct legal entities. The end result is corporations with far more rights than anyone intended. I'm honestly surprised they haven't been given the right to vote.
But corporations aren’t like us. Corporations aren’t moral. They aren’t people. Regardless of the theory of stakeholder, corporations don’t have a vested interest in their community beyond profits. Look at the job situation. You’re a business and you’re in it to make a profit, so you want the best person for the job. So, you through up insane requirements like 2-3 years of experience for the exact same entry level job because you know it’s an employer’s market and a bunch of 401k’s just dried up so you can maybe get someone. And then you use come up with strange requirements like GPA, irrelevant courses, even SAT results because it might lead to better candidates. And because it’s an employer’s market you can ask for unreasonable things: unpaid training, substandard pay, and employer benefiting agreements. Or maybe you just have one of your employees do the job instead of hiring someone new, you save on hiring and training someone new in a tough economy. All the while you have a buildup of perfectly good, fresh graduates filling up unemployment.
Corporations poison our land, our air, our water, our food, our medications, our military when it makes them a dollar. They are the greed manifest: “every man for himself”. And we look the other way.
Because we get our high fructose corn syrup and our reality TV. We’re not poor, we get our stomachs filled and our promotions and we’re happy. That’s something that all those dictators in the Middle East forgot. So, you’re not likely to see a wholesale revolution or something like the end of Fight Club anytime soon. And I wouldn’t want to see one; life is pretty good compared to other times and places. So, what can we do?
In the past we had regulation. And not just regulation that intended to foster R&D but instead created loopholes. We had trust busting laws. We broke up Standard Oil once! But no more. Now we make sure Microsoft includes a ballot screen in Windows. Blame it on globalization, I blame it on corporations learning who to bribe.
Outsourcing is another devious thing corporations tend to do. Can’t get cheap labor to come to you, go to it. So counties that have laws that protect laborers lose jobs to countries that don’t. Right now, our tax code actually rewards corporations for doing so.  What about heavier import tax or, dare I say, embargos? It would certainly create a niche where that company used to be. Kind of artificial trust busting: when a corporation gets big enough, it outsources and can’t sell their goods in their original country anymore, opening up the market again.
And on the topic of taxes, a flat tax is not unobtainable. Some simple calculations will tell you that based on the total income taxes in 2008, $1,091,473,000,000, and the 2008 budget, 2,900,000,000,000, that a flat tax of %8.76568 would yeild the same amount of income tax and that a flat tax of %23.29017 would cover the entire budget. Especially when you factor in removing all the loopholes from the current tax code, a flat tax becomes less absurd. Capital gains are treated differently than earned income in our current tax code, millions of tax dollars slipping passed. If the adjusted flat tax puts too much burden on lower income brackets, increase the minimum to compensate. It’s been kept artificially low through our tax system, and that’s not what a tax system is for. The role of a tax system is not to supplement low income or reduce wealth disparity; its role is simply to generate income for the government to operate.




Back to the topic of corporations, perhaps the solution to corporate greed is simpler than regulation.
In the 1960s and 1970s a company called IBM had commanding control of the computer industry, which was at the time relegated to mainframes. There were other companies that manufactured mainframe, but IBM was so much larger than them that they were referred to as “Snow White” and the others as “the Seven Dwarves”. Everything was going swimmingly for IBM up until the 1980s. By this time IBM was bloated and slow, allowing technologies that they owned to be replaced by newer technologies and allowing their competitors to undercut their prices. When the PC revolution came, they lost their core business, mainframes. To this day, they have never regained the market control they once had.
So, perhaps there is a chance that, if left to their own devices, corporations that grow too big will be consumed in a similar way, without posing the systematic risk of “too big to fail” corporations.

Sunday, October 2, 2011

Minireviews 2: Electric Boogaloo

Wow, it’s been a while. I’ve been busy, trying to find a job and all that. Things are looking positive on that front and hopefully soon I can change that title on my twitter profile. But I haven’t forgotten about the blog. I actually have some posts ready to go, they just need some polish and I’ll be putting them up for you to enjoy. Anyway, enough with the meta, let’s get on to the meat of this post.

I enjoyed doing my last reviews of anime, so I thought I would do another. These won’t be as flattering as the last though.

Neon Genesis Evangelion


Status: Finished (Retellings being produced)

The Plot: “At the age of 14 Shinji Ikari is summoned by his father to the city of Neo Tokyo-3 after several years of separation. There he unwillingly accepts the task of becoming the pilot of a giant robot by the name EVA01 and protect the world from the enigmatic invaders known as "angels." Even though he repeatedly questions why he has accepted this mission from his estranged and cold father, his doing so helps him to gradually accept himself. However, why exactly are the angels attacking and what are his father’s true intentions are yet to be unraveled.”

Your initial impression of Evangelion may to classify it under “Action”. You wouldn’t be entirely wrong. It has it’s fair share of mechs fighting giant monsters. But, Evangelion is as much an anime about mechs as Moby-Dick is a book about a whale. It had mechs in it, but it is not a series about them. That becomes very clear by the end of the anime.

Just looking at it as a mech alone, it's not terribly good. 17 battles in the entire series, most without any real action. Most of the sci-fi mysteries and questions were left unanswered in favor of a finale that revolved exclusively around the psychological state of the main characters. As a result, the plot is left unfinished in regard to the sci-fi aspects of Evangelion. Most of these plot holes are filled in by supplemental material: video games, pack-ins with DVDs, ect.

That’s not to say that it’s a bad story (psych student’s probably go wild over it). Personally, it left a bad taste in my mouth.

Toaru Majutsu no Index



Status: Halted(waiting for more source material)

The Plot: “Toaru Majutsu no Index is set in Academy City, a technologically advanced Academic city located at western Tokyo which studies scientifically advanced superhuman students with powers, but is also set in a world where magic is also real. Tōma Kamijō is a student in Academy City whose right hand, the Imagine Breaker, has the ability to negate all magic and psychic powers, but also his own luck. One day he finds a young girl hanging on his balcony railing named Index. She is a nun from Necessarius, the secret magic branch of the Church of England, and her mind has been implanted with the Index Librorum Prohibitorum—103,000 forbidden magical books the Church has removed from circulation.”

The plot seems to jump around a lot. 2 or 3 episodes will concentrate on one thing, and then in the next episode, something completely different. Although some of the plots are really intriguing at times, it robs the series of a centralized plot that seemed to be building in the first few episodes. Also, some of the design in the series is rather unoriginal: spiky haired protagonist, magicians, school uniforms, ect. This may have been the suber’s fault, the anime’s fault, the source material’s fault, or my own fault for not holding a degree in physics, but at times the language was a bit cumbersome. It felt like some conversations were just going right over my head.

So, in the end, it’s a series with a lot of potential that could be really good if they just got a solid plot going. I’m interested enough to watch the second season when I get the time, but not enough to watch its spin-off Toaru Kagaku no Railgu.

Ergo Proxy



Status: Finished

The Plot: “In a future where the world has been ravaged by a nuclear apocalyse, there exists salvation in a domed city named Romdo, where humans and their android servants, the AutoReiv, live in. Under the implementation of complete management control, it is a paradise where feelings are literally discarded, and the governing council dictates the way of life the citizens should live. But this utopian landscape is soon broken by a series of mystifying murders.”

This one is a depressing anime. The setting and plot take a huge deviation from what the plot I posted says, but you’ll find that out if you watch it for a few episodes. The art is rather bland and “brown”, but that serves the mood of the series.

Unfortunately, none of the characters are particularly dynamic. They all seem to be on a rather heavy dose of Ritalin. And the plot is rather odd. It has a good plot at points, and the writers created an intriguing backstory, but it feels like the writers decided to bury it for some reason. The backstory gets “explain” in one very odd episode and then never really brought up again. The ending was also kind of strange and left me utterly confused.

In the end, it left me disappointed and wanting to know more.

Monday, May 30, 2011

My Favorite Programming Language

Having spent some time on technical message boards, I've seen this topic pop up a lot. “What programming language should I learn?” “What language is the best for beginners?” “What’s better C#, C++, or Java?”

When I was in high school, I was taught a stripped down version of C++ that avoided a lot of the Object Oriented concepts. When I went on to college, Java was emphasized in the intro courses and then C in high level courses. There were those courses that would force you to learn some eclectic language (x86 assembly, Scheme, Prolog). Outside of the mainstays, I’ve also run into C#, SQL, PHP, and HTML (which are not programming languages and, rather, scripting languages).
As far as what language you should learn first, in my opinion it really doesn't matter. As long as you go on and learn more about programming, your first language is going to affect you all that much. All programming languages have their pros and cons and one may solve a specific problem better than the other, but at the end of the day, it really won't matter which one you choose.
C is much simpler than a higher level language like Java or C#, however it can be less forgiving than them as well. Java gives you nicer errors whereas C relies on the programmer to catch a lot of those dumber mistakes like running over the bounds of an array. Some of that can be solved using the right IDE (Visual Studio is very good in my opinion).  C# and Java introduces Object Oriented concepts, which can be too complex for first time programmers and can add unnecessary bulk to smaller projects. I’ve also heard that Java’s garbage collection can be extremely cumbersome, as a CPU heavy task that pops up at random intervals.
Nothing beats being taught in a formal course, but here are some learning resources I would recommend:

The first is A Guide to Programming in C++. This is basically baby’s first programming book. It will hold your hand the entire way. We’ve all got to start somewhere and if you’ve never taken a formal class in programming this is the book I would recommend. The book is a little old, so, you’ll need to do a few tricks to get code to run on current versions of visual studio.

Java Concepts is a great Java introductory book. It will introduce you nicely to object oriented concepts. If you read some of the later chapters,  it will also touch on some of the higher level concepts in computer science.

Next is Computer Systems: A Programmer's Perspective. This is a very advanced book. I would almost say the material in “separates the boys from the men” in the programming world. After you’ve finished with intro books, consider picking this one up.

For C#, I recommend Learn Visual Studio’s Absolute Beginner's Series for Visual C# 2005 Express Edition. The entire series used to be available for free on MSDN, and you can still find some of it in existence on that site.

Tuesday, May 24, 2011

Photosynthesis and Cellular Respiration

I was going to make a detailed post on the formation of kidneys (mostly to make the joke “Zac Efron the Nephron”) but I found the subject to dry and uninteresting. However photosynthesis and cellular respiration is a much more interesting subject in my opinion. In a way it is the basis of all life.
Photosynthesis is the process by which plants (and certain other organisms) store solar energy in carbohydrate molecules: 6CO2 + 6H2O + photons => C6H12O6 + 6O2. This is how most new energy enters the food chain. This reaction takes place in the chloroplast. Photosynthesis is split into light dependent and light independent reactions.
That internal structure is called the thylakoid. The light dependent reaction takes place right at the membrane of the thylakoid. Basically, this reaction takes sunlight and uses it to attach a phosphate to ADP to create ATP (the energy “currancy” of the cell) and hydrogen to NADP+. The molecules hold the energy in these bonds. For a summary of the light dependent reaction, see below.
The light independent reaction (aka the Calvin Cycle) occurs outside the thylakoid in the lumen of the chloroplast. It basically uses the ATP and NADPH created in the light dependent reaction to take CO2 and create carbohydrates.
Cellular respiration is kind of the opposite of photosynthesis. Carbohydrates break down and release energy: C6H12O6 + 6O2 => 6CO2 + 6H2O + energy. The main method of cellular respiration is aerobic respiration. A lot of biological reactions operate as a cascade of small reactions, and aerobic respiration is just such a reaction. See below for a summary:
Glycolysis is a 2 phase reaction takes glucose and creates 2 pyruvates.
The pyruvates are then converted to Acetyl coenzyme A.
The citric acid cycle converts Acetyl coenzyme A to coenzyme A. This creates 2 ATP.
Electron transport generates a whopping 32 to 34 ATP!
Anaerobic respiration (fermentation) requires less oxygen, but releases less energy. Glycolysis runs and releases 2 ATP, but pyruvate is converted to lactic acid or alcohol depending on the organism instead of continuing on through respiration.
Now, you’re asking, what about all the other stuff we eat, how do we get energy from that. Well they enter at different parts of the pathway. See below.

Friday, May 13, 2011

Osama bin Laden: a Postmortem

I’ve stayed away from news posts, although I am still considering some news-round-up posts if I can find the time, and stuck mainly to content rich posts. This post will be no different, although the death of Osama bin Laden is news, there’s a lot going on in the Middle East, and I want to explore that.
I want to start out by saying I was not one of the ones out in the street cheering when Osama was killed. I just have something against celebrating the death of another person. I suppose it has to do with my belief that the world isn’t so black and white as to lump people into extremes. But, if you ask anyone who lost someone during the attacks or in the subsequent war that followed, they weren’t celebrating either. This was a time for reflection.
A lot of people like to cite the Muslim religion as the driving force behind Al Qaeda. That it was a clash of culture that led Osama on his path: “They hate us for our freedom”. While there was religious influence in the group, it was not the driving force. The Middle East is a region in which religion is all pervasive, with many operating theocrats. So, the real goal of Al Qaeda is political.
There is a huge disparity of wealth in many Arab countries; a small ruling elite controlling most of the wealth and resources, leaving the rest in poverty. It was easy for Al Qaeda to recruit terrorists when there were so many that are disenfranchised, poverty stricken. Many believed they had no future. It was easy for Al Qaeda to point their finger at ruling elite and the west, who had given their blessing to many of these rulers, and rally support against them.
But, Al Qaeda’s motives were never the problem, it was their modus operandi. Drawing support against a dictator is a noble pursuit, and many in the international community would support it. But when you attack civilian and peace time military, that is inexcusable and will label you as a murderer. And you will have to face the consequences, as Osama bin Laden did.
But, Osama bin Laden’s death was largely ceremonial. Al Qaeda’s support in the Middle East had waned. And it was not just the military operation in the Middle East that had minimized their influence.
In late 2010, a series of nonviolent protest swept across the Middle East. Known as Arab Spring, disenfranchised and impoverished citizens challenged the established dictators. In a few months, several countries had ousted their dictator and undergone revolution. People had found a way for change that didn’t require terrorism. Al Qaeda was left to watch as they became irrelevant.
Many claim that Osama bin Laden’s death was a turning point in the “War on Terror”, but that point came month ago when people chose peace over violence.

Saturday, May 7, 2011

Upgrades

There’s some big news in the death of Osama bin Laden. I want to make a post on it, and we’ll see if I get around to it. It will be up if/ when it’s finished.
It may surprise you, dear reader, that being as technologically savvy as I am, I am probably one of the last people to upgrade my electronics. However, that is not to say that I do not plan upgrades, just that financial circumstances (read: unemployment) prevent me from making the final purchase.
Let’s start with the big one: my PC. My current motherboard is this beast, which I have had for the last 5 years. I envisioned it as a kind of transition PC, but here it is 5 years later, still pulling it’s weight. I would like to upgrade it to an AM3+ or Intel LGA2011 board when they get released. Hopefully it has SATA 6Gbit, USB 3.0, PCIe 3.0, and DDR4 out of box, but that’s kind of unlikely. Lightpeak (Thunderbolt?) looks to proprietary for my tastes.

I recently received a Blu-Ray burner, but my monitor isn’t HDCP, so I can’t actually watch Blu-Rays on my PC. So, I’m looking to pick up this guy when the price drops to $280 or this guy if it goes on sale again . I could even modify it for 3D.
 My device on the go is the iPhone 3G which, as you may have heard, Apple decided to unceremoniously drop support for. But I’m still considering buying an iPhone 5 or whatever iPhone happens to feature LTE. What can I say, Apple makes a damn fine mobile OS, up until the point when they make the next model.
My laptop is similar to this bad boy. I’m honestly surprised it still runs. I made upgrades to the hard drive and ram. But I no longer have the need for a laptop, so I won’t be upgrading. But if I did I would want something with a touch screen and discrete graphics card. This is a little old or a nice ThinkPad.
Finally there’s my car. It’s almost 2 decades old. I’m not a car person. But as I previously posted, I’ve started watching Top Gear and I did a little research and would love to get the Chevy Volt when it’s price comes down.

Thursday, April 21, 2011

Creating a DLL in Visual Studio


This was another subject neglected in my formal schooling. I picked it up through trial and error, but you won’t have to as I’m about to run through an example for you.
In this example I’ll be using Visual Studio 2010 to create a dynamic link library out of a C file and use it in a managed C++ project.
For the C DLL:
Create a Win32 Project. Application type: DLL. Empty Project.
Create your C file. I called mine retnum.c.
The text of my retnum.c is very simple:
__declspec(dllexport) int retnum()
{
        return 5;
}
The __declspec(dllexport) lets the compiler know we want to use this function in a DLL.
For the C++ project.
Lets create a simple CLR Console Application project under the same solution as our C project.
Right click on your solution and go to properties, set startup project to be your C++ project. Also, go to project dependencies, on the “Project” dropdown menu select you C++ project and check off your C project.
Right click on your C++ project and go to properties. Go to Common Properties, Frameworks and References, click “add new reference”. Select your C project.
Create a header file under your C++ project. I called mine cdll.h.
The text of my cdll.h is:
extern "C"
{
   retnum();
}
The extern "C" lets our C++ program know we will be using C code.
The meat of my C++ project was in my app.cpp file. Condense as follows:
#include "stdafx.h"
#include <iostream>
#include "cdll.h"

using namespace System;
using namespace std;

int main(array<System::String ^> ^args)
{
    int i = retnum();
      Console::WriteLine(L"Your number is: "+i);
      cin.get();
    return 0;
}
So, that’s how you create a C DLL and use it in a C++ project in Visual Studio.

Project files now available on the download website.

Wednesday, April 6, 2011

Why US TV Sucks?

I’d like to start out this post with a little story. I used to watch CNN every morning to catch the news before heading off to the day’s business. One day I got up a little earlier than usual and caught the end CNN Worldwide broadcast rather than the usual CNN America broadcast. This day had been a particularly bad day in Iraq, a particularly important Golden Mosque had been bombed. CNN Worldwide was covering the attack, explaining the importance of the mosque and how the attacks would mean further setbacks to the piece process in the area.
Then the broadcast switched to CNN America. They were covering the death of Anna Nicole Smith. For the fifth day in a row. No mention of Iraq or the bombing at the mosque. That was the last time I watched CNN.
I understand why they do it. They need to be entertaining because, while informative is their job description, entertaining pays the bills. Entertainment brings in viewers, those viewers show up on ratings, advertisers use those ratings to justify the price of their advertisements. But, do you know how the ratings system works?
The principle rating system in the US is done by Nielsen Media Research. Many people assume that whenever you watch a program, Nielsen (if people actually know their name) or some other company records this information, aggregates it, and then reports this information to the advertisers. People may believe this because it seems obvious with the extensive use of digital satellite or cable boxes. But I’ve seen people who believed that ratings could be collected over analog as well.
However, this is not how Neilson collects their ratings.
Neilson will call up, at random, households and ask if they would be interested in participating in their ratings service. These families receive a box and the demographic information for each family member is added to the box. In total 25,000 families are used in the study. There are 114,500,000 households in the US with TVs. That means that 0.03%, the 0.03% that picked up that call and agreed to be tracked, of US household have direct control over what shows stay and go on US TV.
And boy does that 0.03% love their cheesy sitcoms, crime dramas, and reality shows. And their love for those perticuar shows are the reason you see wresting on SyFy or the Jersey Shore on MTV or one of the other hundreds of networks become just another Spike TV. It’s called network decay.
I should mention, that some good came out of my ban on CNN, I began getting my news from BBC America. And because of that, I discovered Top Gear. Even though I’m not that into car, I love Top Gear. In a way it’s similar to Giant Bomb. You watch it for the chemistry, to see 3 guys hang out just hang out. You would watch it even if the show was about kitchenware.
I guess it’s a bit unfair to say only US TV sucks. Perhaps, other countries have bad TV. Perhaps, all TV is bad.

Friday, April 1, 2011

Download Site Ready

Really short announcement. Been kind of busy this week, but I managed to get the download site up and running. Added the sample makefile I did a few days ago, haven’t tested it though. Will probably make the site a bit cleaner in the future.
Download site is located here.

Sunday, March 27, 2011

It’s Social Time

Announcement time!
Item 1: I’ve begun to “follow” some other blogs. I’ve used them (will use them) in future blog posts, so I’ve decided to give credit where credit’s due above and beyond just linking to them. If you have a blog on blogger and I use you in a post I will “follow” you.
Mind you, I don’t necessary agree with the other blogs on all of their content and I can’t be held accountable for what they post (I’m looking at you Linux Hater’s Blog), but there must be something of value that they posted for me to have “followed” them.
Item 2: I’m going to try to hunt down a free web host to host some source code for the programming tutorials I post.
Item 3: I’m considering doing some news round-ups in the future. Not just technology related news, but any article that I find interesting. I have to decide if I want to do.

Friday, March 25, 2011

Compiling on the Wii: a Lesson in Makefile

Makefiles are files used to make compiling easier on Unix like systems.
Now I know what you’re saying. You’re saying, “Centraldogma, what does the Wii have to do with Make files?”. Well, because I learned it through trying to make some Wii homebrews, so that’s how I’m teaching it. Sure I learned some basics in college, but not the level you’ll see in Open Source.
But, let’s start with the basics. Here is a basic makefile:
all: hello

hello: main.o factorial.o hello.o
        gcc main.o hello.o -o hello

main.o: main.c
        gcc -c main.c

hello.o: hello.c
        gcc -c hello.c

clean:
        rm -rf *o hello

Each has word with a colon after is a rule. all is a default rule, if you create a file called makefile and say “make” the all rule will be executed.
Immediately after the colon is the requirement for the rule to be used, if these are other rules, those other rules will be executed. In this case all requires hello. hello requires main.o and factorial.o. For main.o a file called main.c must exist in the current directory and must be compileable. The same for hello.o and hello.c.
So, all you have to do is have your main.c and hello.c with your make file and type “make” and you get the hello binary. If you want to just make an intermediary, say main.o, you would say “make main.o”.
But lets say your all done, but you want to tar everything up and send it to your friend/partnet/employer/anyone-who-will-look-at-your-code. You have all these nasty binaries and intermediaries all over your directory! Well, we have this other rule, clean, which removes any file that ends with .o and the hello binary. Just say “make clean” and it’s done.

Well, that’s the basics, on to the advanced stuff. That’s where the guys at CodeMii come in, I’ll let them explain it:
A makefile is usually found that the root directory of the source code you have. Take the gamecube template source code example (C:\devkitPro\examples\gamecube\template). In that directory you will see a file name “Makefile”. If you open it up with notepad, you’ll be able to see the different parts of a makefile.
The important parts of a makefile for this tutorial are the following lines:
1.include $(DEVKITPPC)/gamecube_rules
By specificing “gamecube_rules” we are telling our compiler that the source code we want to compile will be run on the gamecube. You would use “wii_rules” to compile for the Wii.
By changing between these two, you are changing which libraries will be used when compiling the source code. Libraries are a bunch of files which we use in our source code to interact with the gamecube or Wii system.
1.SOURCES        :=    source
2.DATA        :=    data
3.INCLUDES    :=
These lines tell the compiler which files should be compiled. Most of the time you can leave this alone as our source code will be in /source and our additional files like images, music, etc will be in /data.
1.LIBS    :=    -logc –lm
This is a very important line as it tells the compiler which additional libraries we wish to use. Say we want to play an mp3 and have the relevant code in our source to do so. If we were to compile our source with the above line, the compiler would complain and say that it can’t find the functions we are using to play an mp3 file. For playing mp3 files, you need to include the “lmad” library.
The LIBS line when we add the lmad library looks like:
1.LIBS    :=    -lmad -logc –lm
The order of how you include your libraries is also important as some libraries may reference other libraries and if you haven’t got them in the right order, the compiler will complain about it.

Tuesday, March 22, 2011

Where I get my Video Games News?

First and foremost, I get my video game news (and more widely, my tech news) from Neowin.net. They’re a small site compared to others, but their good at aggregating. Even if the miss something on the front page, someone in the forums will usually make a post about it.

Next is Neogaf, slightly more opinionated since it’s forum only, but you still can get some news from it.

I usually read Penny Arcade whenever a comic is released and will also read the accompanying blog post. Not a lot of people know about Penny Arcade’s forums, but it’s actually a really good forum for off topic discussions. Read some of their topics on politics and prepare to be blown away.

Then there’s 4chan’s /v/. What can you say? It’s not a particularly good place. It updates quickly, but that’s about 4chan’s only good quality.

Last, but certainly not least, there’s Giant Bomb. Endless entertainment. Their bombcast is good listening. Their Quicklooks, especially their Kinect Quicklooks, provided near daily entertainment. If you have a week or so to kill, watch their Endurance Run. The thing about Giant Bomb isn’t just that they talk about interesting things, it’s that their good at conversations. It’s 4 guys hanging out and talking about video games. Hell, they don’t even need to be talking about video games, they could be talking about dinnerware and it would be just as entertaining because of their chemistry.
Years ago I used to read Ctrl-Alt-Del. But overtime Buckley made less and less comics about actual video games and it became more and more a chore to read his comics. One day, after a particularly bad comic, I replaced the link to CAD in my favorites with a link to the CAD Mock Thread at Somethingawful (it was one of the first links that appears when you google “ctrl-alt-del sucks”). However, due to their extreme advertising (everything from intext ads to pop-ups to blinking banners to embedded ads with video to interstitial ads) that link has likewise become unused.

Friday, March 18, 2011

SSH and Linux


SSH and Linux

Meant to put this up yesterday, but better late than never.

I guess this is my first technical post about programming. Well, not really programming… whatever.

My first experience with Linux went something like this: install whatever the popular distro of the day was, get any additional hardware working right, play around with it for one or two day, then format and install Windows. Because OS that you use really isn’t all that important as long as your familiar with it.

When I went off to college, I got much more rigorous training in Linux (and all Unix based systems) trying to compile code on the lab machines through CLI.  Was like a whole different experience. And I am going to impart some of the wisdom I gained to you my loyal reader (lucky you!).

Something important about Linux: Everything in Linux is a file. Also, see the picture for the breakdown of the directories.
If the place you’re working at supports SSH, your weapons of choice will be PuTTY (for general CLI) and Webdrive (for SFTP file transfer). PuTTY is free but Webdrive will cost you money. There are free software that does Webdrive’s job, but in my opinion, not as well. PuTTY can also be used for tunneling, which can be useful in … circumstances.
ls = list files in a in a directory. Use “ls –a” for detailed info. In case you don’t know –a is an argument to the program ls, you can pass multiple augments to a program as such “ls –a –rf” ect.
pwd = gives your current directory
cd = change your current directory. “cd ..” will move you to your parent directory as “..” represents to the parent directory
. = at is a way to denote the current directory. Say you need your current directory to run your program “a.out”, you’re going to want to say “./a.out
mkdir = create a directory. To create a directory called foo say “mkdir foo”. You can also use –m to specify a mode.
rm = remove a file. You can’t use rm to remove a directory unless you use “rm -rf” to recursively go into each folder, remove it’s condense and remove the folder.
more = print out the contense of a file
emacs = emacs is a popular text editor. Hit Ctrl-X and Ctrl-C to close emacs.
top = displays all the processes running. Like a task manager but CLI.
gcc = C++ comiler. –o tell it what to name the compiled file. –Wall gives you more warnings, but those are just warnings, it won’t break your program. –pedantic –ansi holds the program to stricter standards. –g compiles for debugging with gdb (I never used gdb, though it has some interesting features, I stuck to printf’s and getf’s to debug when I couldn’t use a proper IDE).  So the whole thing would look like “gcc-o hello hello.c –Wall –pedantic –ansi –g
tar = –cvf creates the archive as such: “tar -cvf file.tar file1 file2 file3” tars file1, file2, and file3 into file.tar.  –xvf untars a tar file.
scp and sftp – in certain cases, you won’t be able to use Webdrive or your SFTP client of choice. Use scp to send files, sftp to get.

Monday, March 14, 2011

My Favorite Anime

I was going to post this a little later, but given current event this feels like the best time to post this. Here is a list of members of the Anime community that have checked in. Now, on to the post:
People have the incorrect assumption that anime is a genre. Even some people who consider themselves anime connoisseurs sometimes hold that anime is fundamentally better then other media. This is simply not true. Anime is a form of media, not genre.
I don’t like crime dramas, therefore I don’t watch the Ghost in the Shell series. Although I do like the movies.
Anyway, onto the minireviews.

One of my favorite pieces of media is FLCL. It is pretty mainstream and you will see pieces of it from time to time on Adult Swim. But, if you ever have time to sit down and marathon it all the way through, it is a totally different experience. One of the things that makes it so amazing is just how Gainax chose to animate the OVA. They chose to use FLCL as a kind of test bed for their animating techniques.

Studio Ghibli films are always amazing. I could list them all. The scenery is always amazing and the stories manage to hold their own. But my favorite would probably be Castle in the Sky. Nausicaa (made before the studio’s founding) is also great, and you can’t help seeing the similarity with Avatar after seeing it.

Next is Now and Then, Here and There. This one is extremely depressing anime. That’s not a bad thing; it tries to be depressing, and it succeeds at it. If you have any emotion in you, this will get to you. From what I recall, the art was very nice in this one. But I watched it years ago, so don’t take my word on that. This anime explores the horrors of war, it has some sci-fi aspects, but that’s not the focus of this anime.
If you are interested in anime I would suggest you check out Anime News Network’s anncast. Although they do have a habit of going off on long rants about piracy’s effect on Anime.
I could post some more reviews of anime, or any form of media, if you would like, just let me know.

Friday, March 11, 2011

Quick Announcement

Quick announcement and a bit of insight into my writing:
Ads should now be turned on. Like I said I’m unemployed, so every dollar matters.
As to my writing style, when I write formally, which I’ve been told I’m quite proficient at, I write in phases. Phase 1: Thesis sentence; Phase 2: Topic sentence for each paragraph; Phase 3: fill in the introductory paragraph, add thoughts or evidence to the topic paragraphs (one or 2 sentences per thought), add concluding paragraph; Phase 4: if I’m writing to fill a certain number of pages or make a certain number of words, I’ll go over the paper and add new thought based off of old and make sentences longer; Phase 5: proofread
But in this blog, I won’t be writing formally. I won’t have a thesis or topic sentences. And I certainly won’t be doing Phase 4, as I don’t want you all to fall asleep. But I do have some 1 or 2 word thoughts I jot down prior to writing out my posts.
Finally, here’s some future posts I plan to make:
SSH and Linux
Where I get my Video Games News
Compiling on the Wii: a Lesson in Makefiles
My Favorite Animes
Why US TV Sucks?
Creating a DLL