April 2nd, 2010

Posterous.com

I’ve been enjoying Posterous.com lately. Its definitely my cup of tea when it comes to content creation. I’m generally not a huge fan of CMS’s as they are quite clunky feeling when it comes to getting stuff online quickly. Everytime I want to share anything, it takes far too long. So, being able to easily email things I’m working on to an account, and bam! published is huge!

Anyways, checkout a few of my animations I’ve been creating over my vacation week.

jimfish.posterous.com

March 13th, 2009

Distinct Values

module ActiveRecord #mixin for active record
  module ModelHelper # module name
    def self.included(base) # include this into the base of the class instance
      base.class_eval do # evaluate the below
        (class << self;self;end).class_eval do
          def self.distinct_values(column)
            find(:all, :select => "DISTINCT #{column}").map{|x| x.send(column)} if column_names.include?(column)
          end
        end
      end
    end
  end
end

I like to setup a file in the /lib directory to hold model_helper.rb. I tend to put functions that I like to mix into all of my models into this file. This keeps things dry and it prevents me from running all over wondering where a certain active record model function is located.

def self.distinct_values(column)
  find(:all, :select => "DISTINCT #{column}").map{|x| x.send(column)} if column_names.include?(column)
end

After I mix this function in to all the active records objects I’m give the ability to call it like this:

distinct_items = Model.distinct_values("column_name")
#> ["value1","value2","value3"]

This will return distinct values of a model, instead of the objects themselves. I find this useful in projects where there is sometimes an intentional lack of normalization on a table.

table: posts
+-----+----------+
| id  | category |
+-----+----------+
|  5  | ruby     |
|  35 | ruby     |
|  52 | news     |
|  53 | news     |
|  63 | news     |

so now we can just call.

  Post.distinct_values("category")
  #-> ["ruby","news"]

This is useful for filling dropdown lists, select boxes, etc.

March 2nd, 2009

Reflection

module ActiveRecord
  module ModelHelper
    def self.included(base)
      base.class_eval do
        # This creates class methods that allow me to delve into my associations
        # I can call stuff like reflect_on_has_many and it will return Class names of my has_many associations
        # I can then use them to do whatever i like.
 
        (class << self;self;end).class_eval do
 
          [:has_and_belongs_to_many, :has_one, :has_many].each do |association_sym|
              define_method "reflect_on_#{association_sym.to_s}".to_sym do
                results = self.reflect_on_all_associations.collect do |association|
                  if association.macro == association_sym
                    Class.const_get(association.class_name)
                  end
                end
                return results.compact
              end
          end
        end
      end
    end
  end
end
March 1st, 2009

Starting Back.

Alright, like the several posts before this, I’m going to say that I will be starting back blogging. Why not, I’ve got a lot to share, but lack the overall skill to share it, or at least that’s my opinion.

I’ll starting work on a side project with a friend of mine travis robertson . I think its a great idea, but I’m going to keep from sharing to much detail until we have a alpha/beta release.

Obviously, I’ve been working full time on Ruby on Rails projects since 2006, and working with ruby since 2005. I’m going to be working on this project with the hope that I’ll create something that I would use myself, and I think other’s will use it as well.

Now as suggest by my good friend Charles here is some Simple Ruby Code:

I’m sure you know those really wordy for loops in C-based languages in this case javascript.

1
2
3
4
5
6
7
8
9
10
var i=0;
for (i=0;<=10;i++)
 
{
 
document.write("The number is " + i);
 
document.write("");
 
}

ruby has a simple alternative.

1
11.times { |i| p "The number is #{i}\n" }

No that’s obviously simple, but there can be some confusion about what count i starts on. In the case of the .times method its starts on 0. However, there are other loops that you can have more control.

In ruby there is a trick with using arrays for loops.

1
[0,1,2,3,4,5,6,7,8,9,10].each {|i| p "The number is #{1}\n" }

Now obviously that seems a little odd, but will get the same result.
But ruby like everything has a shortcut using Ranges.

1
(0..10).each {|i| p "The number is #{1}\n" }

The number of ..dots matter in the above code. Two dots include the 10 in the loop, while 3 dots.

1
(0...10)

will only print 0-9.

Until next time.

February 21st, 2008

Site Updated.

Moved to wordpress. Have been wanting to update the site for a while now.

October 26th, 2006

The Site is Alive!

Finally the site works again, and the symbolizer is available again. All it took was a host change – who would of thunk it.

Baby steps.

Hopefully, I’m going to be bringing some interesting things back to the web again.

Take it easy everyone.
Jim

July 12th, 2005

What I’ve been up too.

Hey guys,

Well, I’ve been busy. I’ve moved into my own place in Murfreesboro, TN. It’s pretty cool up here. I’ve got some great neighbors and I’m located within 5 feet of a pool. Overall, everything is going well.

As for working on my own stuff, I haven’t had much time. Actually, I’m still settling in to my new place, and driving back and forth to my old house every other weekend, so its taking some time to get used to stuff. I plan on working on some projects as soon as I feel comfortable.

At work I’ve been learning some pretty cool stuff. Recently, I’ve been working with VMWare which turns out to be pretty cool. You can run multiple OS’s on a single box, which I can see as being a major money-saver.

I’ve also been working with Oracle – Oracle is not fun. It is way too complicated for what I would consider an “enterprise level” database. My idea of “enterprise level” is easy to use, easy to maintain, and as flexible as possible. Two of those things are missing. Now, that’s my humble opinion, but if I was paying thousands of dollars, I would require those three things out of a database, especially since there are free databases out there that have 75% of the above three attributes.

I’ve seen those Oracle Guru’s out there with their huge ego’s learning complicated software for the sake of learning it. Why make it any easier and put those $100,000 a year oracle admins out of work? I always see this elitism on the forums when I’m looking through old posts of people asking for help. I guess I’m not a member of the in-crowd quite yet, and I’m not entirely sure I want to be.

Well I’m getting of this machine for awhile,

Take it easy everyone,
Jim Fisher

May 18th, 2005

RUBY - The True Language of Love

Hey guys,

Well I finally Graduated with Honors from the University of North Alabama. I’m glad to see it finally end, but also a little sad about saying good bye to some of the friends I made there this past year. I’ve suddenly been left with a lot of time on my hands, so I’ve been practicing RUBY.

RUBY is an awesome programming language that, in my opinion, is a real joy to use. I’ve been playing around with it for the past month or so. It took me all but a weekend to get the hang of the syntax, and now I’ve been learning to do more complex things with it. I like it better then even PYTHON, which was my previously held language champion. There is just something about RUBY that makes it fun to use.

Now that I’ve said that I love it, let me bring it back down to earth a bit about somethings I don’t much care for. For one thing, it’s not widely supported (yet). Secondly, there are still some bugs on the Windows-side of things. Finally, this one is somewhat related to the first, it’s hard to get it working on an APACHE webserver.

Once all these things are figured out – I think it will really take off. Obviously Windows is the most popular OS, so getting all the developer bugs out of it is a must. Apache is the most popular webserver, so the same goes for it.

Sometimes, I wish that a language like RUBY could be the good old compiled kind. So I’d never have to use C++ again, but alas – it is not. I’d also like to see a GUI toolkit that is simple to use or at least works just like the language that uses it. The closest thing I’ve seen is wxRUBY for RUBY, but I still don’t like somethings about it.

I’m quickly beginning to realize that it’s not the programming language that makes the language fun, its more the tools you use to develop with, that make it fun.

For example, I hate hand typing every little tag in an HTML page, so I use dreamweaver to speed up my workflow – sure you have to still know HTML to make corrections or minor modifications to generated code, but it still works really well.

The same hold true with Visual C++,C#,J#,BASIC, ETC. It just makes the language more useable instantly. Keeps me from having to type everything in.

So, now I await a Visual RUBY application. I might be smart enough to do it myself – one day. You never know.

You guys take it easy,

Jim

February 18th, 2005

Site Update Coming Soon

Hey guys,

Been a while, just want to let everyone know that I’ll be competely relaunching the site with a new design pretty soon. I’m going to try to use the same backend as I have been using-so as to avoid URL changes.

On another note, I’ve hit a little snag. My laptop, in which I do all of my work on, has broken. So, I’ll be completely without my machine for two weeks, which will definetly put a snag in my work. I’m hoping to raise enough money to get an Apple computer- cause I’m sick of the whole Wintel thing.

As for the future, I plan on writing some more flash extensions-during a slow build up to SYmBolizer 2.0. I’ve got some utilities that once written will help bring together several extensions into a workflow powerhouse. Unfortunately, I’ve been incredibaly busy these last few months- having to program/ design/ go to school /etc. So, the sooner I get to it the better.

Also check out mudbubble.com he’s got a new layout, with a flash layout coming soon.

October 19th, 2004

A Quick Thanks!

Hey guys,

I’ve been fortunate enough to have a few brave souls buy and review my symbolizer 1.0 and so far they’ve all been great.

check out the one over at flashfilmmaker.com

feel free to add your own reviews there if you have had the pleasant experience of purchasing a copy.

I would like to personally thank each and every one of you who have purchased a copy. I worked very hard on it, and it’s great to see that everyone is so happy with it. I know there is still much more to do, so if you have purchased a copy please feel free to email me with suggestions of what you would like to see in the next version, and I’ll put it on the list.

Also another big Thanks to Chris who supports my efforts by plugging the Symbolizer in his last Devnet Presentation . The things Chris does without asking anything in return amazes me. So, Thank you Chris!!!

To everyone, I appreciate the support.

Thanks,

Jim