Wednesday, January 18, 2012

Create Simple PowerShell Objects

I used to make Powershell objects the long and messy way. I would create an object and then use Add-Member to tack on NoteProperties and ScriptMethods. Even though I kept it organized, it was a lot to look at and people who were not as familiar with PowerShell were completely confused.

After finding the following method, I have completely refactored my Powershell objects for the larger scripts. It was actually pretty quick to do this and made the scripts much easier to read and therefore maintain.

First, the object is created as a New-Module. Also, notice that the switch -AsCustomObject is used when creating the module. Next, just declare your variables and functions like you would normally do. That last piece is to use the Export-ModuleMember cmdlet at the bottom of the module. Just use a * to tell it to export every variable and function.

You practically have a template that an be easily used to begin creating any object from existing sets of functions and the variables they need.

$test = New-Module {
[string]$teststring = "test successful"
function show {$teststring | Out-Host}
Export-ModuleMember -Variable * -Function *
} -AsCustomObject

Now that you have created your object, you can get/set the properties and run the methods in it.

$test.teststring
$test.teststring = "This object has a settable property."
$test.show()

Using this method chopped the lines in the scripts to less than half of what they were.

Enjoy!

PowerShell References

Friday, December 9, 2011

Download Software, Like Games

You can now download all kinds of software from Amazon from office programs like TurboTax to a daily game deal.
Software

Stepping through the process, I found a game that was on sale for the day. (I love a good deal and personally never pay full price for games.) You can even get pre-orders, so you don't have to stand in line.

I found a daily deal for a game called 'Risen'. It had some good reviews, so I decided to download it. The process was pretty easy. After I bought it, I got a very small downloader that managed the 3.2 Gig setup file download. The whole process was very easy and polished.

I confess that it was the the first downloaded software I have gotten from Amazon. Generally, I look for a good deal on disc and get it shipped. This is cool because I don't have to get it shipped and I get it the same day.. free. This is the kind of deal that I like. I will be going this route in the future.



Software doesn't have to cost a lot. Watch for a good deal and you should see it.

Friday, December 2, 2011

Learning Spanish

Even if you just want to learn conversational Spanish, you would really benefit from have some good reference books to learn from and understand some of the things you are learning to say. One book that has been extremely values is The Big Red Book of Spanish Verbs.

Verbs can be the most intimidating topic when you are starting off. After awhile, that wears off and it is not so bad. The thing to remember is that you can break anything down and tackle one small piece at a time. The 'present tense' is the most important. Learn the endings for an 'ar' verb first. (The example that everyone generally uses is 'hablar'.)

Then, I would say to learn about verb 'ir' (which is pronounced 'ear' with a lighter r sound). It is a little crazy, but it gives you the ability to say someone is 'going to' something. So, you use the 'present tense' of 'ir' to talk about the future. 'Voy a' is 'I am going to'. 'Vas a' is 'you are going to'. Relatively speaking, it makes the future tense a little easier as you can use that verb instead of the future tense of the all the other verbs. Then, I would recommend learning the 2 past tenses... yep... that's right.

The 'imperfect' past tense means 'incomplete'. It refers to something that happened in the past, but is really ambiguous about if it has ended or not. The other past tense has a definite start and stop in the past. There are many other tenses, but many of them use the verb 'to have' along with the adjective form of the verb. (An example of a more advanced verb tense is 'I will have seen it'.) The 555 book is a great reference for all that stuff.

Google translate is very handy to use. But, it isn't perfect (yet) and I still find that it is best to flip through the pages of a Spanish Dictionary. When you can flip through and read several words, you can enjoy just taking the words in as you find them. Otherwise, you have to specifically end the words you want to translate. This is valuable when you want to know the translation for a specific sentence right then. But, the dictionary is better for browsing.

I also found some visual Spanish-English dictionaries. I think these are great for building up vocabulary. If you have some confidence with a little bit of vocab before you begin working on the conversational skills, you might make a little easier progress.


I think that a really good program to start off is actual the Learning Spanish Like Crazy. It starts off well and does a great job of explaining the basics in the beginning. I actually think that the first volume is better to start off than the Pimsleur.

The next program to listen to is the Pimsleur. I kept reading about how everyone thought it was so great. I finally started listening to it and found it to be a great program. I really like how the speakers are easy to listen to and understand. They do a great of job of starting off simple. Then, they build on what you learn and keep repeating concepts in different ways. If you want to build conversational skills, this is definitely a good way to go. I still think that the Learning Spanish Like Crazy 1 is really good to listen to before this one.

I also highly recommend going through the material from Michel Thomas. If you go through the basic and advanced set and still want more, I would do the vocabulary builder next. The advanced goes over what you covered in the basic, but goes over it in a little more depth. It is mostly a recap of everything you covered from the basic course.
On top of these, there are some free sites that are fun to use. The 'Mi Vida Loca' is a great interactive animation on the BBC website that you can practice some Spanish. That is my favorite site, but there are several others out there. About.com has a good guide on learning Spanish.
http://www.bbc.co.uk/languages/spanish/mividaloca/full_details.shtml
http://spanish.about.com/od/tipsforlearningspanish/u/start.htm

Ultimately, I like to use several different resources for different aspects of the language. That keeps things interesting. If you get frustrated you can change to something else and keep learning from a different source. The big thing is to just keep exposing yourself to the language. It will sink in and start making sense quicker than you might think.

Check out this collection of Spanish books and audio from Amazon.

I have written a more complete study-guide type of post here:
http://www.squidoo.com/workshop/how-to-learn-spanish-quickly3
 

Saturday, February 12, 2011

Life of the Lemming

Deep in the cold northern side of Canada lives a little furry creature known as the lemming. Hiding from the owl’s claws in the sky and the four legged beasts that sniff them out, they retreat to below the surface. Unlike the ostrich, they submerge themselves completely out of sight. They create their own world of tunnels. The elaborate homes they build protect and cage them.

If they hide and protect themselves well enough, their numbers grow. When it comes time to leave in search of precious food, many of them drown in the harsh cold waters. However, not all of them leap from the side of the cliff for which they are so famously known. There are some that manage to turn the right way and sprint to freedom and life.

Very rarely, if ever, does someone stop to see the great masterpiece that is life. The hardest questions are the most rewarding. Who and what are we? Can we emerge from our comfortable little burrows? Can we run with purpose, will and foresight to freedom and life? Or, will we cover our eyes and join the others in a leap of blind faith and join them at the inevitable cold water crashing upon the rocks below?

While there are those who run around on automatic, who will be among them?


Reference: http://www.saskschools.ca/~gregory/arctic/lemming.html

Wednesday, January 12, 2011

It Doesn't Make Me Sick

"It has to make you sick"

Well, no.. it actually didn't... Even though several people told me so.

Over the holidays, I had a young driver tap my back bumper and knock me into the hitch of the vehicle in front of me. So, my mustang has a little damage on it. Ok...

I believe that our life is an expression of who we are. Even though we are not able to completely control everything that happens in life, we need to take responsibility for our role. We have a significant role in the entire equation. We can make a bad situation better and a good situation great! Or, even the other direction.

So no, it doesn't 'have' to make me sick. I can choose to see the bigger picture. And, that is exactly what I did. I was perfectly fine during and after the entire thing. Now, I am not saying that I was never upset at all. That's just silly. My first was reaction was 'awe man, I just got hit. Oh crap, I'm going to hit the car in front of me... "

You cannot control every thought that happens in your mind. I'm not even going to pretend like you can. I will say that you can control what you dwell upon. You just have to know the trick.

Almost immediately, I changed my perspective. I thought the entire situation through till the end. I saw myself a year from then. The car was fixed and everyone was fine. I would barely even remember it happening. Also, I kept the bigger situation in mind. While almost everyone else was acting like they were in a bit of shock, I was able to help talk to everyone to regain a calm state.

What I felt the best about the whole thing was at the very end. Thinking clearly enough, I reminded the very young driver that "Experience is what life is all about." I meant it too. My hopes are that he takes this experience and learns from it. If he does, that could be the thing that saves him from getting into a very terrible accident. Maybe it saved a life or two. Who knows?

My point of the whole thing is that you can control your emotional state, think clearly and make the best possible choices in every situation.

Learn to see things from a different perspective and improve the quality of your life. No matter what other people say you are supposed to think and feel, you are in control of you. Its not about controlling every thought. Its about controlling what thoughts you dwell on.

Your life.... your mind.... your choices...

Saturday, November 27, 2010

Clean CSS Layout

When someone is finally ready to give up the tables and look at CSS for layout, it can be pretty confusing. It is a completely different mentality.

If you stick with it, you will get it. Floats are often proclaimed by fanatics as being the 'right' way to do your layout. Floats are meant to push something like an image off to one side or the other and have your text wrap around it. So, technically, floats are being abused to force page layouts. But, after looking at all the options, floating is the best one you have.

Some of the future CSS capability will finally have a way to replicate the control of a table. But, I honestly would not touch that until all the browsers (including the infamous IE) actually supports this feature correctly. You could also do a fixed size for your layouts, but really.... that is just settling. The fluid layout approach is going to be the best. The website needs to have some flexibility to it to account for the different monitor resolutions (and even screen readers).

Other people can make that argument much better than me. So, I'm just giving what know with my own bias mixed in. You do see a lot of fixed size layouts. Even some fluid ones make an assumption of 960 in size. But, believe it or not, there are people still out there using 800x600. I've seen it.

When reading around, you might very easily come to think that positioning is what you want to use to position things.... HA HA HA... (That was one of those bellowing laughs!)

Remember how I was saying that CSS positioning is a completely different mentality? That stuff is a little messy. Absolute positioning pushes something to the top, left, bottom or right of the next positioned container with an offset. The relative positions pushes the box from where it would normally be to the offset your give it. Static is the default. Fixed glues something to a spot in the window. (Also, if you don't specify something like a height, and think that content will give it height, it will overlap and things just won't work correctly.) You might want to avoid this stuff for awhile. This is not a thorough explanation, but it does show you that it is not quite the cleanest thing to use.

So, for now, floating is the way to go. It doesn't have to been too hard. Here is a great reference that shows how practical and simple using the floats can be. I recommend using this reference as it is the best I could find:
http://www.tjkdesign.com/articles/one_html_markup_many_css_layouts.asp

For more info:
http://websitetips.com/css/tutorials/layouts/

Friday, November 26, 2010

Tikka Masala

If you need some 'wake-up' on your taste buds, I have a recommendation for you!
http://en.wikipedia.org/wiki/Chicken_tikka_masala

Every now and then, you get a little tired of the same old mainstream stuff. Try a little something different! You don't have to spend that much to try it out, either. If you just want to see if you like it, you can find it in the frozen entree section. It might be just enough to know you don't want it again. Or, it could be just enough to get you craving a new taste!

Chicken Tikka Masala is a dish that has a lot of spicy flavor to it. It is not at all like the jalapeno kind of heat. It is more of a mild interpenetrating heat that packs so much flavor.