Saturday, May 28, 2011

Inventory Management - Part Two

I've started fiddling around with an inventory management program. I considered trying to figure out how to work with SQLite, but I ended up deciding that it might not be worth it. I'm still iffy about whether or not the benefits are worth taking the time to learn how to do it.

I decided that I could probably just use a vector to store the width of each board in a bundle. I decided to just do a bit of testing by having a file with a bunch of "boards" in it. This file could be read into an array, and then each element of that array could be used. Right?

I just remembered how my vectors always screwed up. I don't remember how I fixed (or even if I fixed) this problem. I've highlighted a few things for you to look at.

Here's my malfunctioning code. Any suggestions? I'm going to look at it more later, but for now, I shall feast upon steaks.

#include <iostream>
#include <fstream>
#include <vector>
using namespace std;


vector <int> bundles(10);


void pieceCount();
float bdft(int, int);
float bdftM(int, int, float);
float bdftD(int, int, float);

int main()
{
    pieceCount();
    for (int i = 0; i < bundles.size(); i++) {
        cout << bundles[i] << "\n";
    }
   
    return 0;
}

// I believe that my problem is somewhere in here. As you can see, I've added a counter that should print
// out whenever it gets a new piece. It just keeps throwing a 1 out at me.
void pieceCount()
{
    ifstream infile ("bundles.rtf");
    if (infile.fail())
        cout << "The file opening is a failure.";
    while (!infile.eof()) {
        int counter = 0;
        int i = 0;
        int pulled;
        infile >> pulled;
        bundles[i] = pulled;
        i++;
        counter++;
        cout << counter;
    }
   
}


float bdft(int height, int length)
{
}

float bdftM(int pieces, int length, float height)
{
}

float bdftD(int pieces, int length, float height)
{
}

How I Write Code. And debugging. Sigh.

So, there are tons of things talking about all of the different kinds of code writers out there. I'm not sure what kind I am, but I'll take you on a brief overview of how I do stuff:

1) Identify the problem.
  • This one is a rather obvious step. If you don't know what the problem is, then you can't figure out how to fix it.
2) Write down what I think might fix the problem.
  • This can be as simple as a formula or as complex as...well....me writing a whole bunch of stuff. This step is important though, because it allows me to think through the problem. I usually don't identify everything that is going to be a problem during this step, but it helps avoid a bunch of simple stuff.
3) Rough draft of the program.
  • I just start writing. It's messy, ugly, and inefficient. But it lets me actually do some work on it. I can see what's going to work, what isn't, and what I need to rethink. 
4) Rethinking
  • Generally the longest step. This step includes going through my rough draft and figuring out how to fix problems, redesigning the program based off of my new ideas, and then trying to make it better.
  • This step is where the majority of the work should be put in, unless you're just good enough to not need the rough draft. If you're able to predict all of the problems and optimize your code without the rough draft step, then step two is where the majority of your work needs to go. If you're a mortal and need a rough draft though, you'll need to rethink. If you rethink it well enough, you shouldn't have a problem with making the program "pretty."
5) Pretty Code!
  • This is where you do the final draft of your program. This means that the code is as good as you can get it. Everything is neat, clean, and well put together.
6) Debugging
  • Even if you put a week's worth of thought into your program, if it's anything bigger than "Hello World" then you're probably going to have a couple of errors. They'll be fixed in this step.
  • Up in step four, I said "generally the longest step." The generally is there because debugging can take a LONG time. It doesn't always take a long time, and really well designed code doesn't take much at all, but it can take weeks. To fix one problem.
  • PRO TIP: Someone else who is competent with coding will catch the errors a whole lot better than you. Your eyes know what they're looking at and believe everything is right. A friend's eyes don't know why the heck you declared a function as void and are trying to return an integer.
That's just how I do it. It might not be the best way, but it generally works.

Tuesday, May 24, 2011

Inventory Management

I'm working at the sawmill this summer. Fun, right?

WARNING: This isn't all technical and stuff. It's an abstract of a program I'd love to make.

There is one very good thing about it though (besides being paid). I get to see industry at work. One thing I've noticed is how their inventory system works.
A rather brief overview is this: after the tree is sawed into logs and then into boards (and sometimes ran through a molder or some other sort of machine), it is stacked into a "bundle." This bundle can be anywhere from a couple of boards to a couple hundred boards. They can be three inches wide to like sixteen (some are even bigger). Currently, the length and width of every board is put into a machine. This machine then uses a formula to calculate the board feet and linear feet found in the bundle of lumber.

The little machine has tons of great options. You've really got to commend the amount of knowledge that these people (Forestry Systems, Inc.) had to put into their machine. My only complaint is this:  the sawmill does not seem to have any sort of system for using the data the machine gets.

The bundles are assembled into a load, as specified by the salesman. My dad figures out how to make the loads from available-or soon to be available-bundles of lumber. Once the load is tallied it is printed out and dad takes it down the the main office. The truck is loaded with the lumber and a invoice is generated based off of the printout of the lumber. This works, but I can definitely see room for improvement.

IMPROVEMENTS:
  • The system would work a WHOLE lot better if the office could see everything that has been tallied. 
    • There are lots of bundles of lumber that get tallied then not put onto a load. There are also tons of lumber that HASN'T been tallied that just sits around waiting to be tallied. If all of these could be tallied and put into a running inventory that the office (particularly the salesman) could see, then it seems that everything would run a bit smoother.
    • There would need to be some sort of way of keeping track of where the lumber was stored. This would be tricky because the lumber is moved a LOT. The lift drivers have to move some bundles to get to others. Keeping track of every little move would get really old really quick.
  • Having a few different "statuses" for the lumber. Let's say that a bundle is tallied. It's status could be "Ready to Ship." But then dad decides he needs it to get dressed. When the forklift driver gets it and brings it to the place that dresses (pretty much just smooths out) the lumber, the bundle number could be entered at that place. The status would then be changed to "Being Dressed." Once it was finished and back in stock, it would again be "Ready to Ship." The inventory would reflect that this bunk was now "Dressed" instead of "Rough."
    • Having this feature would eliminate the problem of dad having to run around all day trying to figure out where lumber was.
  • Other stuff. As you can see, this is a rather large category. I don't really know what all I want it to do exactly. I'll have to do more research. The main idea behind it all is that the lumber is tracked better and this tracking translates into people being able to see where the lumber is and what it's doing at all times. 
I'm going to start trying to watch and take notes on what a complete inventory system would do. There is obviously a ton of code that would need to be done for this. Not the mention the necessity of a GUI.

List of things I'd need to even start:
1) Knowledge of how to make a database. I'm thinking it wouldn't need to be bigger than 1000 entries for dad's sawmill, and it's the biggest in the Eastern US. I don't think anywhere would need more than that.
2) More information. I'll have to wait and see what they actually use and what they really don't.
3) Time. Duh.

Anyway, those are just my thoughts. If you've got any suggestions and such, please let me know!

Wednesday, May 18, 2011

I love the Food Channel.

I love the food channel.  That's probably because I love cooking. I mean....those two things go hand in hand, you know?

If you've ever watched the food channel much, you've seen the Barefoot Contessa. I hate her. She's just the worst person ever and I don't like her.

The end.

Saturday, May 14, 2011

My Updates are Cooler than Michaels.

My freshman year of college has ended.  Holy. Crap.

It somehow didn't manage to hit me until right now. I mean, I've got a few more years until graduation, but it's still a big step.  I just...it's weird.  In the best of ways.

So what did I learn in college?

Waaaaaaaaaaaaaaaaaaay too much for all the blog posts ever. But hey, I can relay a few tips to you.
  1. The first thing that people need to know about college is that it really isn't that different from high school.  Sure, there's more freedom and junk like that, but it's not different enough to change my opinion of school.  It may have been different for other people, but to me, nothing changed a TON.  It would seem to me that if you didn't like high school, you'll like college even less.  But hey, it might just be me.
  2. College is EXPENSIVE.  I'm sure you thoght you knew that, but you don't realize the full cost.  Yes, you'll spend $600 on books.  You'll blow lot's of thousands on school itself.  The cost that really sneaks up on you is the cost of living.  You'll want snacks for in your dorm.  You'll want to go out to eat and see movies with friends.  God forbid you want to go out on a date--assuming that you're a guy and will pay for everything.  Now, everyone doesn't spend a ton.  My roommate and I never bought snacks, but I did spend lots going out to eat and everything.  I probably spent $100 or so per week.  My roommate probably spent...$0-$25 per week.  It all depends on your personal spending habits.  I'm just saying: tuition isn't the only thing you'll be paying for.
  3. Did you know that studying works? It was a revelation to me for sure. In high school, I always just payed attention (kinda) in class.  Tests always had a nice 100 on the top of them.  College?  It's a whole lot harder.  You'll need to actually put effort into what you do.  Read the book, do the homework, study. You'll do a whole lot better for it.
  4. Buy an alarm clock and actually use it.  I know lots of people who overslept nearly every day. (Eyes on you Michael and Graham).
  5. Keep your packing light. Else, moving out will suck hard.
  6. Roll with it. You can't expect everything to go right all the time, and you're just going to have to learn to deal with it.
  7. Plan hard. Plan often. Plan well.  As numero six says, it won't always work. It doesn't hurt to try though. The more you plan, the more will go according to plan. It's just good for life.
  8. (And Jonna added this one while I wasn't looking) LUV YOOR GIRLFRAN WICH YOOR HOLE HART. SPEEND ALL YOOR MUNY ON HER.

Tuesday, May 10, 2011

Just an update...

Well, as you may have noticed, I do not post anywhere near was often as Linell. This is not because I do infinitely more interesting things with my time than he does (not saying that I don't *cough* *cough*), but more because I just don't often have a lot to say. More accurately, though, I completely forgot this existed over the past few days, and here's why:

1. Exams are a b****. I just thought everyone should know that. Now, I'm not saying that every college class is uber hard and you should be scared (for those of you yet to join the ranks of the tired, broke, and hungry), but at least one class a semester you get a teacher who makes you want to punch a Wookiee. For me, that has been history both semesters. Last night, as I was studying for this exam with my good friend Ryan, I realized that at least half the material listed on the study guide (yeah, we actually still get those sometimes. Like I said, college isn't EVIL) we hadn't actually covered, and the rest was mostly just mentioned in passing. So, after I'm done typing this up I'm going to study a little more for that.

2. League of Legends is the most evil creation known to man. Now, I confess to being a huge fan of World of Warcraft. I only have one level 85 and he's not even fully geared, but I enjoy the game greatly and play often, when I can afford the subscription. This being said, when I first tried League of Legends I hated it profusely. For those of you who don't know, League of Legends is a game based on a mod created for Warcraft III known as Defense of the Ancients, or DotA for short. Basically, it's a PvP game where each player controls a champion and fights alongside other champions, as well as minions, to try and destroy the opposing teams "Nexus." It has RTS style controls and each of the heroes has four abilities - three general abilities and one "ultimate" ability - that they can use in addition to attacking. Now, when I first played it, I understood it's merit: It had decent mechanics and the variety among champions and roles was pretty good, as well as having well done graphics, especially for a free to play game. However, the worst thing for me were the controls. I felt that if I was playing with point and click controls similar to an RTS, I should be playing an actual RTS - with full control of armies and buildings and the like. Hero combat, to me, should be carried out like World of Warcraft PvP. However, after playing a few rounds with a couple of friends who really play, I began to enjoy the game, which quickly turned into us playing it for 12 hours straight, two days in a row. I'm not proud of this, nor am I really ashamed of it, it just happened. This being said, that's 24 out of 48 hours that I didn't use for other, some might say more important, things.

3. Sleeping is fun, but apparently my body doesn't realize this.

4. Webcomics are the second most evil creation known to man. Specifically, the one that kept me from sleeping last night is the one I would like to mention. It's called The Fancy Adventures of Jack Cannon and it is by far one of the best webcomics I've ever read. The art is amazing, and the writing no less so. It can be found HERE. It's definitely now up there in my list of favorites, which include such other webcomics as xkcd, Cyanide & Happiness, and Manly Guys Doing Manly Things. If you have time (which you don't trust me). you should check it, and all the rest, out.

So, now I'm going to go study for a final for a teacher that makes me wants to kick dinosaurs in the testicles. Have fun, and I leave you with this:

Sunday, May 8, 2011

Off-Grid

Once per year or so, I just get an itching to go out in the woods and stay there.

I know I could do it.  I want to do it.  I just can't seem to find the time.  Since the summer between my junior and senior year of high school, I've either been at school or working.  These two things just don't lend themselves to a man living off-grid in the woods.  Plus, I just don't think Jonna would be okay with me if I lived in a hut without running water or electricity.  In fact, I rather doubt that she would visit.

But I really want to.  I've thought about it a lot.  Here's my plan:
I live in the middle of nowhere already.  Finding an abandoned spot to set up camp would not be a hard thing to do.  Finding one that would allow me to farm and have clean water would be harder, but I am confident that if I was given about a month to find a place, I could find a pretty nice one.  A week would probably be enough time even.
Secondly, I would need to bring a few tools.  I'm idealistic, not stupid.  I would want a few pots and pans, some utensils, an axe, a hammer and nails, a sleeping bag, and a bunch of other stuff I'm too excited to think about right now.  The list would be large, I admit, but I would be able to carry them in just a few trips.  I want to live off-grid, not like a caveman.
Thirdly, I would need plants.  Obviously, I would bring a good bit of food.  I would want to be able to be self-sufficient though, which would mean that I would need to bring stuff to grow.  Tomatoes, potatoes, beans, and corn.  I'm sure there are a few other things I would bring along once the time to go actually rolled around, but those are the ones that come to mind right now.  If I was going to be there long term, I would also want chickens and a greenhouse, maybe one like this.

How could I possible live with just a few tools, some food, and plants?  Simply.  My first order of business would be to set up a shelter.  A little hut wouldn't be hard to build, and I could live in a tent until it was finished.  I would need a method of collecting water (and probably a little stream and some filtration system).  And that's it.  Obviously stuff *will* go wrong, so I'll need a cell phone and/or radio too.  And a first aid kit wouldn't be a bad idea.  And a gun.  You can never go wrong with a gun.

But I really, really want to do this.  I'll probably never have the chance.  As far as I know, I'm planning on being a slave to consumerism for the rest of my life.  And that's fine.  It's just a wandering thought that I have always had, and probably always will.

*long, heartfelt, pitiful sigh*

Monday, May 2, 2011

A Note of Things to Come

So, yeah, it is my birthday. Woot. You know what I get? A paper on Ayn Rand, a Cal II test to study for, and a World Civ presentation to do. Great birthday, right?

Anyway, what all this means is that I won't be able to write the post I was planning to. However, later - meaning probably Thursday by the looks of things - I WILL get around to it. Basically, I'm going to summarize all the factors about Bin Laden's death that Conspiracy Theorists are going to make passionate love to. Should be fun.

Anyway, I leave you to go write papers and MAYBE get a short nap before class. Also, I will leave you with a video that always helps me when I'm stressed out; maybe you can use it too:

Osama Bin Laden Killed

"Today, our fellow citizens, our way of life, our very freedom came under attack in a series of deliberate and deadly terrorist acts," president George W. Bush said on September 11, 2001.  His speech continued to say that "thousands of lives were suddenly ended by evil, despicable acts of terror...The search is underway for those who are behind these evil acts. I've directed the full resources for our intelligence and law enforcement communities to find those responsible and bring them to justice. We will make no distinction between the terrorists who committed these acts and those who harbor them...None of us will ever forget this day, yet we go forward to defend freedom and all that is good and just in our world." (full speech)

Bush's goal has finally come to fruition.

If you don't want to watch the video, I'll summarize it for you.  Osama Bin Laden, the man who planned out and saw through the 9/11 attacks that killed 2,977 Americans, has been killed.

Bin Laden was found in a custom built compound about 31 miles north of Islamabad.  The compound had 18 foot tall walls topped with barbed wire, minimal outward facing windows, a series of walls on the inside to protect the occupants, and a seven foot tall privacy wall for the balcony.  Navy Seals hit the compound surgically.  In what I'm sure would make a good movie, four combatants inside of the building (including Bin Laden) were killed.  A woman being used as a human shield by one of the men was also killed.  Also contributing to the operations screen-adaptability, an American helicopter was destroyed due to mechanical failure.  There were no American causalities.

Using facial recognition software and DNA testing, the death of Bin Laden has been confirmed.  While it could probably be said that Osama Bin Laden is not as important now as he was in years prior, it cannot be said that his death is not a huge boost to American morale.  In a long and drawn out war, it is refreshing to see the man who started the ball rolling killed.

In conclusion, AMERICA.

Sunday, May 1, 2011

Guess What. I AM LINELL!

Guess what else.

Osama Bin Laden is dead.

Of course, these were some of the people we were up against:


(more news to come)(after I get back from celebrating via some very American food: Waffle House)

Guess What? I'm Not Linell!

Holy poop, this blog now has two authors. You know what that means? It means you get this cool interactive hamster, is what!


You can click on the screen to feed him, and you can make him get back on the wheel by clicking the center of it. I think I'm going to call him Baron von Hammstër. Make sure you take good care of him, otherwise he will do this:





Granted, that's a Guinea Pig, but the statement stands.

EDIT: Linell has just informed me that if you hold the food up so he cannot reach it, and move it back and forth a little, Baron von Hammstër will dance.