Sunday, July 29, 2012

Win the lottery with Ruby

My Mom plays the local "Pick 5" game regularly. Whenever she has a few bucks to spare, she'll have me get her a few tickets, and I'll always do the 'quick pick' and let the computer generate the ticket for me. I never had a 'system' to pick numbers like some people do (special dates, numbers, etc.) so I figured that 'quick picks' were as good as anything.

I decided to get a little scientific with this stuff. I created a csv file with the results of the past 60 drawings, and formulated a little ruby script to tell me the occurrence of each number sorted by frequency.

I just bought her three tickets using my 'system': 1 ticket with the five numbers with the overall highest frequency. Looking at the frequency breakdown, there were more numbers that appeared 9 times than any other frequency, so I bought two more tickets, one using 5 of those numbers, and one using the other 4 that occurred 9 times, and one that occurred 8 times.

 The most she's ever 'won' before was $5, so we'll see if my system pays off any better for her :)

Here is the script if you are interested:


Saturday, July 28, 2012

KDE Unstable in Fedora

I've been trying out KDE-Unstable in Fedora 17. I'm very pleased. Rex does an awesome job with this. Some info on setting up can be found here if you are interested.

It's a great way to keep up with new versions of KDE.

Not really specific to the packages in KDE-Unstable, but my favorite feature since coming back to using KDE are activities - I just really started using them, but it's pretty awesome. I have ctrl+alt+(l,r,u,d arrow keys) to change workspaces and ctrl+alt+(l,r arrow keys) to change between the two activities I have set up. I've become really efficient with this setup.
Although I guess activities can be configured to be pretty different, I have my two set up pretty much the same, and I use them much in the same way as workspaces, but more separated. So, I have two activities with 4 workspaces each. It simply helps me keep my windows/apps/tasks more organized.
My only regret is waiting so long to give KDE a real chance again. I still have Xfce (using Kevin Fenzi's Xfce 4.10 repo) on two systems that but my main desktops will be KDE from now on.

Saturday, July 21, 2012

Using Fedora to teach Ruby on Rails

I've been tasked with giving a broad intro to Ruby on Rails talk to a group of co-workers in the coming weeks.

Although I could do this lecture style and have the class follow along as I work on a projector,  I thought it would be more fun and interactive for everyone to actually touch a Rails install. I started planning ahead tonight with a Fedora 17 VM running in VirtualBox, but will recreate this setup in a Xen VM at work for the class to use. We have a training lab with 12 PC's in it, and I will allow each person to SSH into a F17 box using unique user accounts.

I will basically be following Chapters 1 and 2 from Michael Hartl's awesome Ruby on Rails Tutorial. I won't need to cover a lot of what is in Chapter 1, and by the end of the talk, we will have Chapter 2 completed. My goals for the talk is to provide:


  • A basic understanding of what Rails is
  • A basic understanding of MVC
  • What a Gem is
  • What a Gemfile is
  • How to start the (development) server
  • How to create a data model
  • How to use scaffolding

This is all pretty basic, but this is an overview, not a full-fledged Rails class. Most of the attendees will be seasoned developers, many familiar with ASP.NET MVC, so they should catch on quickly.

Now, for the setup.
I've always used RVM to manage my Ruby installations, but I decided this would be a good opportunity to get acquainted with the Ruby packages shipped with Fedora, so here is my setup process.

I've started by adding the following packages to a "Minimal" F17 install:

yum install git-core curl make bzip2 gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel libxslt-devel sqlite sqlite-devel openssl openssl-devel

Next, I've installed the Ruby yum group:

yum groupinstall Ruby

Now, for each user we need to install rails:

gem install rails

I have also added execjs and therubyracer gems to my Gemfile since nodejs is not in F17 by default.

Everything went awesomely. The Fedora Ruby packages worked great.

I created a user for each seat: one, two, three, and so on. Now, each user can start the rails server as so: rails s -p 3001 with each user having a different port, corresponding to the user/terminal they are at: 3001 for terminal one, 3002 for terminal two, 3003 for terminal three, and so on. Hopefully it will go well, and the attendees will have fun while learning.

Cinnamon desktop in Fedora

I can't believe nobody has mentioned this on the Planet yet, but Cinnamon is now available in the official Fedora repositories. Here is the Bugzilla and here it is in the package db.

Although I wasn't involved in making this happen, I just *had* to share the news. I prefer KDE and Xfce myself, but Cinnamon seems to be a great desktop from what little experience I've had with it. Huge props to Leigh Scott and everyone else involved for all the hard work in making it happen.

I think it is awesome that Fedora provides the ultimate choice for users in what environments are available to choose from.

Sunday, July 15, 2012

Albatross and Bluebird Xfce themes in updates-testing


I have packaged the Albatross and Bluebird themes from The Shimmer Project for Fedora 16 and 17, and they are now in updates-testing. These are to complement Greybird also from The Shimmer Project which is already in our repositories.

Here are screenshots of each:

Albatross:


Bluebird:



Enjoy!

Friday, July 13, 2012

KDE in Slackware on VirtualBox

For no reason other than nostalgia, and wanting to see what's up with the distro these days, I tried installing Slackware in VirtualBox. I could start Xfce, and other WM's just fine, but KDE would crash.

I did a little digging and came across this.

Create a file called /etc/X11/xorg.conf.d/disable-composite.conf and in that file place the following:

You should now be able to startx and have a working Plasma desktop. Enjoy!

Sunday, July 8, 2012

The Lottery Question...

Often, you'll hear tossed around "What would you do if you won the Lottery" (this could apply to any large windfall of cash).

I have always said, I wouldn't change much - I'd keep working, invest, basically be smart.

That's the easy answer. That's what everyone *wants* to say. I gave it some real thought one day while on a run, and my thoughts popped into my head again tonight once again.

As much as I'd like to say I would keep working my current day-job, I probably wouldn't (sorry). I might would stay part-time, in some capacity, because I love the company I work for, what it stands for, and the people there.

With a little thought, this is what I came up with.

I would start a gym.
Okay, I admit, that sounds a little silly without any back-story, so let me elaborate a little. First this wouldn't be *any* old gym, and secondly, a gym changed my life.

So, what would this gym be if it wouldn't be ordinary?
First it would be a not-for-profit organization.
It would exist solely to help people. Here are my thoughts on my fictitious gym I will never have.


  • It would accept "regular" members...the types of people who would join ordinary gym's for a fee. Any fees paid would be on a sliding scale based on the ability to pay. Below a certain income bracket, no fee would be required.
  • If you have a serious health condition where exercise would save your life, there would be no fee.
  • If you are morbidly obese there would be no fee until you reached a healthy weight, and then the normal scale based fee would apply (if applicable). 
  • If for any reason you are in no-fee or reduced-fee status, you will have time obligations to meet. If you don't work-out your committed weekly hours, you lose no-fee status. There would be considerable leniency here, if there was a legitimate reason you could not meet your obligations.
  • Transportation to-and-from the gym would be provided for reduced-fee/no-fee members, if needed. 
  • Any volunteers of the gym would obviously have no fee.
  • Personal training would always be free regardless of your fee status. Everyone needs good form. 
  • Child care would be free for all members. Children would be in organized activities while you work out.
  • There would never be a fee for children under 18.
  • Children over age 13 who want to 'join' as no-fee members, would always have a trainer with them, and would have organized routines. (I see SO many teenagers 'flopping around' at my gym with no guidance). They would as no-fee members have similar time commitments to meet.  
Such things are nice to (semi) plan out, even if there is a 1 in 175,223,510 chance of it ever happening :-)