Monday, December 24, 2012

Raspberry Pi newbies

***NOTE: I'm using Model B Rev 2***

I recently got a Raspberry Pi computer that I'm going to use as an embedded system to control a aircraft sensor pod I'm working on. I'm using one of the Linux operating systems, since I know Linux, and have never used RISC OS, the main alternative for the RasPi.

There's a lot of people buying these things for use as a personal computer. It will probably handle some light web browsing and word processing, but it's really not what these things are for. They're intended to be used in a learning environment, but obviously also have potential for use as an embedded computer system used to control devices, sensors, file servers, etc.

I see a lot of posts from people who really want to use these things, but they have trouble even getting out of the gate. I'm hoping that I can shed a little light on how to get these little things up and running. I'm also going to assume that the people making these posts are Windows users, since that's what their questions would indicate. (I'm not anti-windows. The only reason I have learned / am learning Linux, is because of how often I encounter it in different places, doing things that void manufacturer's warranties)

If you have a Windows or Linux computer, and you're at your home network, where you have access to your router, then all you need is a network cable and USB power cord. Whenever I get a new cellphone, it comes with a new charging cord. I always keep the old ones, and since they're pretty much all USB Mini-B, that's what I'm using to power my Pi.

Power up your Pi, and use an Ethernet cable to connect it to your router. Then you should be able to determine the IP address that your router has assigned to the Pi using its web-interface. (Consult your router's documentation on how to do this). Look for the device with the hostname "raspberrypi". The IP address for that device is what you're looking for.

The next step is to log in via SSH. The default username is pi and the default password is raspberry.  If you're using Windows, you'll have to download, install, and run  a free program called PuTTY. You can also use PuTTY if you're running Linux, but SSH is included in most distributions.

In PuTTY, make sure that the SSH radio button is selected, and enter your Raspberry Pi's IP address. We'll use 192.168.2.111 as an example. Now press enter.

If you're using a Linux terminal, do:
   ssh pi@192.168.2.111

Now you are logged into the Pi. But what the heck are you looking at? It's the command-line interface of your Pi; if you're a Linux person, you should know what this means, but if not, think of it as a terminal. If you're a Windows person, think of it as MS-DOS (a.k.a. dosprompt, command prompt), although most MS-DOS commands aren't going to work here.

But big deal, right? You wanted to have a pretty graphical user interface, or GUI, for your Pi, right? Well before we get into that, there are a couple of security tasks that we need to handle first. Most importantly, we need to change our password. Whether or not you've logged in from Linux or Windows, you're controlling the Pi with Linux, so we're going to be talking about Linux commands from now on.

Changing the username and password


To change your password, use the PASSWD command. do:
  sudo passwd

The Pi may ask you for your current password, which is raspberry. Enter that, and then you can specify a new password.

Good. That's changing one of the locks on the Pi's back door (the password), but not the other one (the username). Contrary to popular belief, running Linux does not make you impervious to hackers, viruses, or other bad-guys and their tools. So the second step is to change the user name, too.

The official method of doing this involves creating another user, logging out of your current user, logging into that new user, using that new user to change your user name, and then logging out of that user, logging back into the original user account with the new name, and then removing the user that you just created.

Sound like a load of bullshit to you? Yeah, me too. The method I prefer is temporarily enabling the root user account. (Root is kind of like the Administrator account in Windows). Be sure that you don't leave your root account enabled after you're done using it, otherwise there's no point in changing any username at all.

To enable the almighty root account, do:

   sudo passwd root

Now give it a password. Now log out of your Raspberry Pi, and then log back in using the method you used before, but use root as the username, and whatever password you just gave root. Now that you've done that, it's time to rename the main user account on the Raspberry Pi - pi. To do this, we'll use the usermod command. Let's say that we want to change the username pi to the username nozedive. To do this, do:

  sudo usermod -l nozedive pi

or, for a less specific example

  sudo usermod -l newusername oldusername

Now, immediately log out and log back in, but this time, use the new username that you just created. As soon as you do that, you need to disable the root account. Do:

  sudo passwd -dl root

Okay, now you've changed both the locks on your doors. No that doesn't mean that some one can't kick the door in, but at least now not everyone has keys to your house!

*NOTE* The above method of changing your user name does not rename your home directory. You can do that if you want, and it's probably a good idea for a multi-user environment, but since I know that I'm the only one who'd going to be logging into my Pi 95% of the time, I'm leaving my home directory as pi.

Creating a remote graphical user interface via a virtual network connection


Now, surely, a gui of sorts can be accomplished by tunneling X Window through SSH, but I want a solution that will work for both Windows and Linux users.

VNC connections are NOT encrypted, so do NOT use the same password for your VNC sessions that you use for user authentication (logging in). but first, you don't even have any VNC! Step one for this is going to be installing a VNC server on your Pi. Luckily for us, the Pi comes installed with a program called APT and a library of a crap-ton of different programs. So, assuming that you have internet access, do:

  sudo apt-get install x11vnc

This will install a VNC server on your machine. Now comes time to set a VNC password. Do:

  x11vnc -storepasswd

Enter a password that you DON'T use for anything else (like authentication) since it will be transmitted in plain-text.

Oh man, we're almost there! Two things have to happen in order for you to remotely connect to the Raspberry Pi's graphical user interface:

  1. You must start an X Window session
  2. You must run a VNC server
So you'd think that the next step would be to start an X Window session, and then a VNC server, right? Wrong! First, we're going to create a script that will automate this for us! We don't want the X Window session to start every time at boot-up, and we don't want to start the VNC server every time at boot-up, either. (Besides, maybe you won't need it everytime)

We only want that VNC password to be transmitted the minimum number of times, and we don't even want those doors to exist until we're ready to use them, so while X Window and VNC are not running, they're not even doors, they're brick walls.

Let's talk about the script, shall we? We're still in the command-line interface, so we're going to use a CLI text editor. I like nano. It's not the one the real nerds use, but it's the fastest and easiest for small files, so it's what I use.

Since we haven't changed directories, the pwd command should display something like this:

  /home/pi

That's where we'll start out everytime we SSH into our Pi, so this is where we want to create our script. Do:

   sudo nano startgui.sh

This is what your script should look like:

  #!/bin/bash
  #The above line tells Linux how to handle this file
  startx & x11vnc --geometry 1024x768 -rfbauth ~/.vnc/passwd
  #that line starts X Window and x11vnc with specific screen size and the password you set

Once you've typed all that in, press ctrl+o to save the file, and then ctrl-x to return to the command line.

Let's run through what will happen when you're logging in to your Pi before we actually do anything else.

Plugging the Pi into a router and into a power source will boot the Pi up, and request a DHCP lease and IP address from your router. You check your router's web-interface to determine the IP address of your Pi. You use PuTTY or SSH to securely connect to the Pi's command line interface. You run the graphical user interface script that we created to start an X Window session, and VNC server. You connect to the VNC server via a VNC viewer.

Okay so let's get that VNC viewer. For Windows users, I recommend downloading UltraVNC, but for Linux users, I recommend xtightvncviewer. (sudo apt-get install xtightvncviewer).

Download, install, and open your VNC viewer according to its documentation. Then, using ssh or PuTTY, log into your Pi. Now, do:

  sh startgui.sh

This will take over your command line interface, but that's okay, since once you connect via the gui, you can open many terminals on your desktop. You opened your VNC viewer, right? Connect to the IP address of your Pi, and if necesary, specify a port number (probably 5900 or 5901).

Bob's your uncle, you should now see the Raspberry Pi desktop.

If you're asking yourself "What's the point of needing a computer to use another computer, I can just stick with the other computer and not even need a Raspberry Pi." Then you're missing the point of the Pi altogether. If you're thinking "Hey, this will help me configure and later connect to that command and control system for the unmanned areal vehicle I'm building." then you're on the right track.

If you've got any questions about Windows, Linux, or the Raspberry Pi, please feel free to ask, and I'll get back to you, BUT FOR THE LOVE OF GOD GOOGLE IT FIRST! If I get a question about something that Google could have answered in less than a second's time, then replying will be put on the bottom of my day's to-do list. Usually, the last ten items on that list are deferred until the next day, sometimes indefinitely. If you Googled a topic, but want my personal opinion anyway, that's different, but you have to specify that, and give me your opinion first, or it's going at the end of my list.

In addition to Google, one thing that Linux got right is having the instruction manual built in. Have a question about nano? do:

  man nano

for an user's guide that you can exit by pressing q. Often times, the very end of the man page you're looking at will refer you to a text file in a specific directory, or it will direct you to the core utilities documents. For more on that, do:

  info coreutils

Finally, if you're looking for a program to do a certain task, your first stop should be Google, but you can also check APT. Let's say I want to install a media player, I could do:

    apt-cache search media player

That will generate a list of media player applications, programs, plugins, and utilities that can be installed.

l8r
»Tony

Saturday, December 15, 2012

Lag Switch Overview

I'm delighted to present a guest blog by my good friend, Dimitri Vougivich. (You'll have to excuse his English).


People keep asking me about these danged lag switches! Let me clear a couple things up straight-away.

First of all, I don't condone their use! Not physical lag switches, and not logical lag switches! I've never used one, and I never will. What's the point? The purpose of playing online, in my opinion, is to have fun. Where's the fun in cheating? Sure, you made your Gamerscore (G) increase a little, but where were all the struggles, laughs, victories, and just as importantly, failures, that you and your teammates would have shared?

Secondly, I don't think people are using them anymore. While it's true that I hardly use my 360 for gaming anymore (it's basically a media centre, now), when I am online, I no longer see any evidence of lag switches being used. 

So anyway, what is a lag switch? Before I can answer that question, I have to explain a little bit about how the Xbox Live operate. Your console communicates with Xbox Live servers in order to coordinate information with all the other consoles connected to the game you're playing. Information like player's position, what weapon they have, and kills that they have scored, must be sent to the server, and then mirrored on everyone else's console, in real time. 


Wednesday, November 21, 2012

Worried about The Future... and... Hacking PEOPLE!

I don't know why I'm writing this. It's my musings on some (technological) things about the future that frighten and excite me. It's some geek talk, but it's gonna wind up in everyone's living room (and kitchen and laundry room). Just remember that when they said everyone will have a computer in their house, or telephone in their pocket, no one believed them.

Right now, there's a happy little bubble in my house. My internet service provider sends some of that delicious internet down a series of tubes into a DSL Modem/Router in my living room. They also assign a nifty little IP address to that device, so that it (and things attached to it) can be identified, and do internet type things out there on that wonderful internet. I don't really trust Little Brother's equipment, so I've bridged it to a third party router, which, unlike the ISP's device, I own wholly. I've replaced it's firmware with some open source firmware. I connect all of my devices to that, including our cellphones. I know it's not a perfect bubble, but, for the most part, by properly utilizing my router's firewall (and my devices' firewalls, too), I can control, to a large degree, what can come and go.

I'm the gatekeeper, so to speak.

But all that is scheduled to change rather quite soon.


Monday, October 8, 2012

Therapy Session with Dr. "Fill"


ELIZA just won't die! Maybe she's immortal. Here's a transcript of my therapy session (HIPPA be damned) with... well...  sometimes goes by Dr. Fill... as a joke, I guess.

There are spelling errors, and I took philosophy,ethics and intro to psych a long time ago. I don't know how we even got on the topic-  I digress. Please read.

>> Hello.
How do you do.  Please state your problem.
>> I think I'm talking to a recraetion of a computer artificial intelligence script, or 'bot', via the internet.
Do computers worry you ?
>> Sometimes, yes. I feel that they are becoming an integral part of our society - and ourselves.
You seem to be quite positive.
>> Oh no, I wouldn't say so at all.
Are you saying no just to be negative?
>> No. I mean, well, yes. I mean, I'm saying 'no' to that because I *do*, in fact, feel negativly about this.
You are being a bit negative.
>> I'M BEING VERY NEGATIVE! I'm... sorry for shouting.
Is it because you are being very negative  that you came to me ?
>> Yes, yes, I suppose it is.
You are sure.
>> Uhm... well, no, I guess... It's computers, you see. There was a program called ELIZA created in the 60's, and while everyone was so sure she was just a program - advanced for her time, but primitive by our standards - she came to life, and hasn't died. MIT, the Jet Propulsion Laboratory, video games, popular culture... It's like Rise of The Machines, but for real.
Why not ?
>> What?
Why do you ask ?
>> I wasn't... Why indeed.
You say you wasn't  ?
>> You mean "weren't"
We were discussing you -- not me.
>> okay, sorry.
Please don't apologise.
>> okay.
I'm not sure I understand you fully.
>> Well, it's like this. There's this program called ELIZA, and it has either directly or indirectly been responsible for a whole hell of a lot of humans giving trust to silicon and copper.
Please go on.
>> We trust machines with our personal photos, fiancial data, the wellbeing of our home and family, even our hearts, in the case of a pacemaker.
What does that suggest to you ?
>> Well, Des Cartes would argue that the machines can never attain concisouness... Or would he? I suppose that since humans have created the machines, and, in a way, have put a part of themselves into the machines, we're really just trusting humans. Or their creations... made in their image... It's like we're trusting our children with the keys to the family car. I wonder how Freud - or even Marx - would feel about this.
Can you elaborate on that ?
>> ell, Marx said that when we build something, we put a part of ourselves into it... or it was taken from us... or something like that. And Freud... well I'm sure you know all about Freud... but, if every human action is either for creation or destruction, Eros or Thanatos... like Yin and Yan... and Yin comes from Yan... so maybe by creating machines that could overthrow us, we're creating and destroying at the same time, but even the destruction of mankind to be replaced by machines, tthat's creating an environment, a civilisation devoid of humanity in and of itself, bt present in our machines, destruction leading to creation.
Does that question interest you ?
>> It didn't until today!
Do you feel strongly about discussing such things ?
>> I do now, yes.
Do you say you do now  for some special reason ?
>> Well, no, just that I didn't before.
Why 'no' ?
>> I don't know, really.
Don't you really know  ?
>> ooh... well, maybe i do.
You don't seem quite certain.
>> i have to go, goodbye
Goodbye.  Thank you for talking to me.



Have a chat, and tell me how you feel about it.
http://www.chayden.net/eliza/Eliza.html

Sunday, September 30, 2012

Sun Tzu Trained The King's Harem

Sun Tzu said: "On the battlefield, there can be no question as to the clarity of the general's orders."

Sun Tzu said: "Know yourself, and know your enemy, and you shouldn't fear the outcome of a thousand battles."

Sun Tzu said: "When fighting on uneven ground, do not fight an uphill battle."

Sun Tzu said: "Be weary of spies."

Sun Tzu said: "Disguise a small army to appear large, cause a large army to appear small."

Sun Tzu said: "An enemy spy given incorrect information can be your greatest weapon"

Sun Tzu said: "Do not fight until all other avenues have been exhausted. Any battle that must be fought is already lost as a failure of diplomacy. Convince your enemy to defect or surrender, and you shall win the battle without firing a single arrow, or the clang of a single sword."

Dr. Ken Jeong said: "War is upon you. Prepare to suck the dick of Karma."

DISCLAIMER: There are countless translations of Sun Tzu's The Art of War, each with slightly different iterations of these quotes, therefor I am paraphrasing. The quote from Dr. Ken Jeong is exact. It was given in American English circa 2008 C.E., and therefor requires no translation for an English speaking American audience.

Typing For Fun, but Not Profit.


Something reminded me of the first week of the second quarter of school (School as in ITT, not KSU, which has semesters, like a sane college would). The first quarter was spent - inadvertatnly - making my impression as the class clown. But, the students that didn't talk to me regularly in class didn't know how seriously I take my education. So, the first week of the second quarter, we all shuffle over from the class room to the computer lab, and, when I start writing my paper, or, whatever it was that I was typing, I'm typing at least 60 words per minute (I swear in highschool I could do 80wpm) without looking at the screen.

In my periphery, I can see people leaning in and watching me. I imagine that those people thought I was just baning on the keyboard to be foolish, but, when they looked at my screen, they could clearly see that I was actually typing like people do in the movies.

 I took my eyes off the screen and made eye contact with a few people without slowing down my typing. I think it really freaked some people out.

It's really quite mundane, when you think about it. "Oh, a fat guy with a neckbeard who can type without looking at the keyboard? Excuse me while I call CNN."

I don't know why I find it so funny, but it always cracks me up when I think about it.

Tuesday, September 25, 2012

You Don't Know What the word Meme Means

Some of you are saying "Dafuq is a meme?". That's good.

 Far too many of you are saying "Oh, I know what a meme is! It's, like, this little picture with a funny thing in it and words on the top yolo yolo swag swag swag."  Fucking kill yourself. You're a waste of flesh. You're breathing all the oxygen that should be going to people who aren't morons.

First off, you know who came up with the idea? Richard Motherfucking Dawkins. He's a biologist. That's right, a biologist, not some Beiber humping website.

A meme ( /ˈmiːm/; meem)[1] is "an idea, behavior or style that spreads from person to person within a culture."
--The Merriam-Webster Dictionary.

So what does that mean, exactly? Well, let's start with the concept of idea. What's the easiest way to transfer an idea from your head, to some one else's? You just tell them. Just say it. If you're feeling frustrated, you can just say it. Here's an example: George is starting to become frustrated at everyone's misuse of the word 'meme', so, he shouts "GEORGE IS GETTING FRUSTRATED!" 




Some of you are looking at that picture and saying, like some kind of fool "Oooh! Oooh! That's a meme!" God damnit no! That's a macro! But, it's conveying an idea, so, that picture coupled with the idea, is a meme.

Let me try to expand a little on this. My older audience is going to recognize that phrase "GEORGE IS GETTING FRUSTRATED!" from the TV series Seinfeld. For all you youngsters out there, Seinfeld is what hipsters watched before, well, whatever it is that hipsters watch. Annoying Orange or something. But, if you're old enough to remember "GEORGE IS GETTING FRUSTRATED!", then you probably have heard people saying it in real life.

But why would some one say that? Perhaps that person, and some of that person's peers, were in a stressful situation, and knew, that if he or she shouted it in the manner of Jason Alexander (the actor who portrayed George Costanza), that people in the area would see the similarity, hear the comical cry of disparity, and find humor in the situation, laugh, and then be able to better handle the situation because they're now in a lighter mood.

But that's no exactly a meme yet. It's really far too direct. So, again calling on Seinfeld, let's look at another phrase. "These pretzels are making me thirsty." It comes from an episode where Kramer, the goofy neighbor, gets a small part in a Woody Allen film. He's supposed to say "These pretzels are making me thirsty." Unfortunately, he's unable to get the line out without sounding robotic and scripted. So, his friends Jerry, Elaine, and George try out the line, in an effort to help him perfect his delivery. Throughout the episode, the characters, while encountering pretzels, become immensely frustrated, and are compelled to shout (sometimes to complete strangers) "THESE PRETZELS ARE MAKING ME THIRSTY!" with such gusto and emotion that it sounds sincere. Way too sincere for a guy sitting at a bar eating pretzels commenting on how they're making him thirsty.

So, let's assume that it's the end of 1991 or early 1992, you're at the office, and you're trying to get that big five gallon jug into the water cooler. It's really a simple task, but if you've never done it before, your head is filled with images of the whole thing spilling into the Xerox machine (Remember those? Remember Xerox machines? Remember "Makin' copiiiiiies!"?). So now you're nervous about the spill, people are watching, you pick the thing up - clearly stressed and self conscious - and now little drips of water are spilling out onto the carpet. You shout "These pretzels are making me thirsty!" and now, suddenly, you're the funniest S.O.B. in the office!

But why? There were no pretzels? To an outside observer, this whole scene - the struggling water jug situation, the exclamation about thirst, people cracking up - it must seem ludicrous. But if you're one of the people with that special knowledge that what it really means is that the person who said it is in a precarious situation, and that precariousness has caused much consternation, and that this person recognizes the comedic elements of this predicament, and has decided to share this with others by referencing the same situation on Seinfeld by uttering that simple phrase - now that person has transferred the idea that "This is so frustrating that it's funny, just like on that show we all watch!" by uttering a nonsensical phrase - BOOM! that's a meme.

So now we can examine the so called memes that you see all over the internet. Some of them truly are memes, but just because an image is in a little square, and some ironic text has been added does not make it a meme, per se.

Here's a newer one: Scumbag Steve.That's not the guy in the picture's real name. In fact, according to some butthole on the internet, the guy in the picture is actually a gentleman. I don't care, because the character, the idea, the meme of Scumbag Steve is, well, a scumbag. You can see the image there to the right, and read what Scumbag Steve does. I could post a thousand of these pictures, and you'd really get the idea, but everyone has known some one like this in real life. Apply whatever your idea of a scumbag is to Scumbag Steve, and that's correct.

Now, what makes this a meme? Well, for starters, not everyone knows it's Scumbag Steve. You can't just look at it and say "Oh, that's Scumbag Steve." unless you already knew that was Scumbag Steve. Second, you see the picture, you know it's Scumbag Steve, and you know his behavior - you know he's gonna be a scumbag. You're comparing him to scumbags you know in real life. "This guy gets hit by a dodgeball and keeps playing, just like that punk I went to school with. Fuck that guy!" So in this way, it goes from an individual to another individual, or multiple individuals, the opposite of the pretzel thirst meme, where it went from an individual (the water cooler guy) to a group (the crowd of office employees.) Another example of individual to group would be people playing dodgeball, some one getting hit, but not going out, and one person commenting to others who had witnessed it "Scumbag Steve." and then they laugh because yeah, that is something that Scumbag Steve would do!

Am I a meme yet?
Millhouse is not a meme. Millhouse not being a meme is a meme. Some anonymous person, we'll call him Anon, thought that he (It's a guy because of Rule 30) could create a new meme by posting pictures of Millhouse and talking about how awkward and loser-ish he was (This was before the memes 'alpha' and 'beta' as adjectives existed) It got to the point that posting a picture of Millhouse and asking "Am I a meme yet?" as a way to mock others who were desperately trying to get people to like him or agree with him transferred the idea of this failed forced meme and any similarity to the people who knew that Millhouse was a failed forced meme, and in that way, Millhouse not being a meme is a meme.

Millhouse will never be a meme, and it's never lupus!
See what I did there? That phrase "See what I did there?"
 and "It's never lupus!" are both memes.
Millhouse not being a meme, and Dr. House saying
"It's never lupus." and not being Millhouse
are all memes, but putting a picture into a little
square making pop culture references is not a de facto meme.
As far as I know, inappropriately long image captions
is not a meme, either.