mms2r 1.1.3 Released

Posted about 7 years back at Mike Mondragon

mms2r version 1.1.3 has been released!

DESCRIPTION:

MMS2R is a library that decodes the parts of an MMS message to disk while stripping out advertising injected by the cellphone carriers. MMS messages are multipart email and the carriers often inject branding into these messages. Use MMS2R if you want to get at the real user generated content from a MMS without having to deal with the cruft from the carriers.

If MMS2R is not aware of a particular carrier no extra processing is done to the MMS other than decoding and consolidating its media.

Contact the author to add additional carriers to be processed by the library. Suggestions and patches appreciated and welcomed!

Corpus of carriers currently processed by MMS2R:

  • AT&T/Cingular => mmode.com
  • Cingular => mms.mycingular.com
  • Cingular => cingularme.com
  • Dobson/Cellular One => mms.dobson.net
  • Helio => mms.myhelio.com
  • Nextel => messaging.nextel.com
  • Sprint => pm.sprint.com
  • Sprint => messaging.sprintpcs.com
  • T-Mobile => tmomail.net
  • Verizon => vzwpix.com
  • Verizon => vtext.com

Changes:

  1. 1.1.3 / 2007-07-10 (Charles Foster Ofdensen)
  • Helio support by Will Jessup
  • get_subject returns nil on default carrier subjects

http://mms2r.rubyforge.org/

mms2r 1.1.3 Released

Posted about 7 years back at Mike Mondragon

mms2r version 1.1.3 has been released!

DESCRIPTION:

MMS2R is a library that decodes the parts of an MMS message to disk while
stripping out advertising injected by the cellphone carriers. MMS messages are
multipart email and the carriers often inject branding into these messages. Use
MMS2R if you want to get at the real user generated content from a MMS without
having to deal with the cruft from the carriers.

If MMS2R is not aware of a particular carrier no extra processing is done
to the MMS other than decoding and consolidating its media.

Contact the author to add additional carriers to be processed by the
library. Suggestions and patches appreciated and welcomed!

Corpus of carriers currently processed by MMS2R:

  • AT&T/Cingular => mmode.com
  • Cingular => mms.mycingular.com
  • Cingular => cingularme.com
  • Dobson/Cellular One => mms.dobson.net
  • Helio => mms.myhelio.com
  • Nextel => messaging.nextel.com
  • Sprint => pm.sprint.com
  • Sprint => messaging.sprintpcs.com
  • T-Mobile => tmomail.net
  • Verizon => vzwpix.com
  • Verizon => vtext.com

Changes:

  1. 1.1.3 / 2007-07-10 (Charles Foster Ofdensen)
  • Helio support by Will Jessup
  • get_subject returns nil on default carrier subjects

http://mms2r.rubyforge.org/

Getting started with Flex - what you should know.

Posted about 7 years back at work.rowanhick.com

Okay, so like me you've done a lot of web development with scripting languages ala Ruby, PHP, Perl etc and you've decided to try out Flex for a front end. What do you need to know ? This is just my own humble opinion - take it with a grain of salt, but for those looking to jump in you should find something valuable. This is all encompassed with the caveat that you are using the right tool for the right job, now what ? We know the advantages of using Flex - I'm not going to reiterate them. What I am going to tell you is the things to be aware of - not critiscims. Be prepared to invest time. Considering I had a working app with rails in one all night code marathon, I feel that I've only just waded in with Flex - granted this is apples to oranges comparison - however of everything I've jumped into, Flex is the one that takes the most time - mainly because it is developing interfaces, not yet another scripting language/framework stack. Beyond the basics you will spend a lot of time figuring out the nuances of what you need to do to get something working. You will have moments of happiness, and moments of wanting to heft your computer off a cliff.... Flex is not flash. Flex is a very real grown up interface language / architecture. Sure Flex is rendered via the Flash Player, and gets compiled down to a SWF but thats where the similarities start and end. [As a side note, I personally can't help but wonder if they just rebranded the flash player etc whether that would help Flex adoption...] Flex requires compilation of the runtime swfs. No biggie, but if you happen to be in Mac land on a Dual Core G5 (or worse) machine you might want to talk to your tech department about an upgrade. Compared to pure web scripting it can put a dent in your workflow, code-compile-refresh vs the time honoured code-refresh. If you're not going to break out the cash for Flex Builder lookup the Flex Compiler Shell (FCSH) on adobe labs. This dramatically cuts compilation time. Break out your OO skills. You're going to need them.. Actionscript 3 is strongly typed. If you've come from a dynamically typed background ala Ruby, this can hinder you - you have to consistently be aware of the types of objects your dealing with and what they can/can't do. Time and experience will render this issue obsolete. Event based programming - say hello to your new friend dispatchEvent. Everything is event based, and a solid part of learning flex, is realising when and where to send events and listen to events. You have to change your mindset to look at every possible combination of things the user can do in your app. Learn how to get events into your custom components and use them wisely. Learn how to use the Flex Builder Debugger. This is exceedingly powerful and useful for figuring out why your apps aren't doing what you expected them to do. Adobe can expect my money when they release Moxie for this feature alone. Code Completion. Again another life saving feature of Flex Builder is the code completion / inspector. An advantage of the strong typing this helps in your coding by seeing the correct properties/methods on objects - which in turn saves a lot of time referring back to the livedocs. More than one way to a skin a cat. For everything you try to achieve there normally multiple of ways of doing so. Keep persevering and find the one that works and is most suitable for the problem at hand.  You're not on your own - Adobe developer support is fantastic. Case in point the giant wall posters that I scored from Adobe for free - great for me but scary for the general populous walking into my office. You can see that Adobe want this to succeed and they're doing all they can to do so. A free SDK, good documentation, free PDF book downloads (for AIR), onAIR tour events, videos.onflex.org, open sourcing... you name it they're trying to do it - which gives me the warm fuzzies about investing my time in this technology. Above all, keep persisting it all pays off ! You can produce beautiful works of interface-art, that work as you expect them to, consistently and repeatedly. Pixel perfect and cross platform, beyond any interactivity possible with AJAX (unless you're a sadomasochist)

Episode 55: Cleaning Up the View

Posted about 7 years back at Railscasts

This episode starts off with a big, messy template. Watch as this code shrinks and becomes more readable while the interface stays the same.

The Hobo Migration Generator

Posted about 7 years back at The Hobo Blog

Right back at the start of the Hobo project we made writing migrations a little easier. We made it so you didn’t have to write the word “column” quite so many times.

create_table "users" do |t|
  t.column :name, :string
end

Became:

create_table "users" do |t|
  t.string :name
end

A pretty small contribution in the scheme of things, but kinda handy, and it made it into core Rails (by a circuitous route) which was nice.

Somehow though, it wasn’t good enough. It was quicker, but it wasn’t Hobo Quick. Don’t you always get the feeling that writing migrations is kinda mechanical? Especially those tedious down migrations. Don’t you wish you never had to write another migration again? I know I do. Or did, I should say.

Announcing the Hobo Migration Generator.

Creating your database tables in the next version of Hobo will go something like this:

Step 1. Code your models (being sure not to generate any migrations)

Step 2. ruby script/generate hobo_migration create_initial_tables

(Step 2.5. Observe db/migrate/001_create_initial_tables.rb)

Step 3. rake db:migrate

And you’re done.

Hang on one darn minute I hear you say! Where are the columns declared? One of the much loved features of Active Record is that you don’t have to enumerate the columns in your models - AR interrogates the database and finds them for you. If Hobo generated the migration, where were the columns declared?

In the model class.

class User < ActiveRecord::Base
  fields do
    name :string, :null => false
    email :string
    about :text, :default => "No description available"
  end
end

Sacrilege! Not at all - it’s actually much better this way. Work with me for a minute here.

What is it that you really love about not having to list the columns in your AR classes? It’s the fact that it’s DRY. You don’t have to list them once in the migration and then again in the class. Well that’s still true, all we’ve done is moved those declarations to where they should be - in the same place that defines all the rest of the behaviour of your model. Yes those column declarations will be in the migration too, but that is generated for you.

There’s no more trawling through old migrations or messing with MySQL in order to remind yourself what columns you have - it’s right there in your code.

The generator looks at the database, looks at your models, figures out the difference and creates a migration such that the database gets with the program.

It generates the down migration too of course.

Moving forward things get even more interesting. Say you wanted to get rid of one of those fields. Just delete it from the fields declaration. Run the migration generator again and you’ll get a remove_column migration. Change the type of a column or add a default? No problem, you’ll get a change_column.

What if you delete a model class outright? Well we’re guessing your production data is kind of important to you, so the generator is interactive. It will require you to physically type “drop users” (or whatever) before it will generate a drop_table migration. The same goes for removing columns in fact.

What about renaming a column or table? Those are kinda tricky. Say we rename the field name to username. All the generator sees is that an existing field name has gone away, and a new field username has appeared on the scene. The generator will alert you to the ambiguity and invite you to enter either “drop name” or the new name “username”.

That’s the long and short of it, but there’s a couple more niceties.

Inside the fields block you can say simply timestamps to get created_at and updated_at.

You can declare fields using Hobo’s rich types like :html and :markdown. These end up as :text columns unless you override that by giving the :sql_type option. Your DRYML tags will know what it really is and render appropriately.

As for foreign keys – don’t even bother. Just declare belongs_to as you normally would, and the migration generator will spot the need to add a foreign key. Either with the conventional name or a custom one if you gave the :foreign_key option. Delete the belongs_to later, and the migration generator will remove the foreign key.

If, like most Rails programmers, you’ve written a lot of migrations, I think you’ll find using this puppy to be a fairly pleasing experience :-) I know I do.

It’s working now in the tom_sandbox branch, and will be in the next release, which, if the coding gods be willing, will be out by the end of the month.

The Hobo Migration Generator

Posted about 7 years back at The Hobo Blog

Right back at the start of the Hobo project we made writing migrations a little easier. We made it so you didn’t have to write the word “column” quite so many times.

create_table "users" do |t|
  t.column :name, :string
end

Became:

create_table "users" do |t|
  t.string :name
end

A pretty small contribution in the scheme of things, but kinda handy, and it made it into core Rails (by a circuitous route) which was nice.

Somehow though, it wasn’t good enough. It was quicker, but it wasn’t Hobo Quick. Don’t you always get the feeling that writing migrations is kinda mechanical? Especially those tedious down migrations. Don’t you wish you never had to write another migration again? I know I do. Or did, I should say.

Announcing the Hobo Migration Generator.

Creating your database tables in the next version of Hobo will go something like this:

Step 1. Code your models (being sure not to generate any migrations)

Step 2. ruby script/generate hobo_migration create_initial_tables

(Step 2.5. Observe db/migrate/001_create_initial_tables.rb)

Step 3. rake db:migrate

And you’re done.

Hang on one darn minute I hear you say! Where are the columns declared? One of the much loved features of Active Record is that you don’t have to enumerate the columns in your models - AR interrogates the database and finds them for you. If Hobo generated the migration, where were the columns declared?

In the model class.

class User < ActiveRecord::Base
  fields do
    name :string, :null => false
    email :string
    about :text, :default => "No description available"
  end
end

Sacrilege! Not at all - it’s actually much better this way. Work with me for a minute here.

What is it that you really love about not having to list the columns in your AR classes? It’s the fact that it’s DRY. You don’t have to list them once in the migration and then again in the class. Well that’s still true, all we’ve done is moved those declarations to where they should be - in the same place that defines all the rest of the behaviour of your model. Yes those column declarations will be in the migration too, but that is generated for you.

There’s no more trawling through old migrations or messing with MySQL in order to remind yourself what columns you have - it’s right there in your code.

The generator looks at the database, looks at your models, figures out the difference and creates a migration such that the database gets with the program.

It generates the down migration too of course.

Moving forward things get even more interesting. Say you wanted to get rid of one of those fields. Just delete it from the fields declaration. Run the migration generator again and you’ll get a remove_column migration. Change the type of a column or add a default? No problem, you’ll get a change_column.

What if you delete a model class outright? Well we’re guessing your production data is kind of important to you, so the generator is interactive. It will require you to physically type “drop users” (or whatever) before it will generate a drop_table migration. The same goes for removing columns in fact.

What about renaming a column or table? Those are kinda tricky. Say we rename the field name to username. All the generator sees is that an existing field name has gone away, and a new field username has appeared on the scene. The generator will alert you to the ambiguity and invite you to enter either “drop name” or the new name “username”.

That’s the long and short of it, but there’s a couple more niceties.

Inside the fields block you can say simply timestamps to get created_at and updated_at.

You can declare fields using Hobo’s rich types like :html and :markdown. These end up as :text columns unless you override that by giving the :sql_type option. Your DRYML tags will know what it really is and render appropriately.

As for foreign keys – don’t even bother. Just declare belongs_to as you normally would, and the migration generator will spot the need to add a foreign key. Either with the conventional name or a custom one if you gave the :foreign_key option. Delete the belongs_to later, and the migration generator will remove the foreign key.

If, like most Rails programmers, you’ve written a lot of migrations, I think you’ll find using this puppy to be a fairly pleasing experience :-) I know I do.

It’s working now in the tom_sandbox branch, and will be in the next release, which, if the coding gods be willing, will be out by the end of the month.

Now Available In Tanzania

Posted about 7 years back at Sporkmonger

Maasailand

For those of you who are interested, I’ve been in Tanzania at the Cradle of Love baby home near Arusha for the past two weeks and change. It’s been interesting for sure, lots of holding and feeding babies, playing with toddlers, trying to get through the day with as little snot and spit on me as possible. There’s a few spitters who make this difficult, but they make up for it by being excessively adorable. I try not to play favorites, but Neema ends up riding my shoulders quite a bit. I haven’t taken a lot of pictures around the baby home itself, but on the various excursions we’ve taken outside, the camera has come out with a fair degree of regularity. There’s also some new kite aerial photography shots from the trip to the bush to visit the Maasai. If you have a Pro Flickr account, the high-resolution panorama shot from the kite is pretty neat. I suspect that through August at least, my Flickr photo stream will be much more interesting to subscribe to than my blog’s feed will be. Consider adjusting accordingly.

Episode 54: Debugging with ruby-debug

Posted about 7 years back at Railscasts

This episode will show you how to debug a rails app using ruby-debug: set a breakpoint, inspect variables, change the code and more.

Ruby en Rails Amsterdam - Ruby on Rails Podcast

Posted about 7 years back at Ruby on Rails Podcast

Interviews from Ruby en Rails, Amsterdam.

RV2 Camping on Gentoo

Posted about 7 years back at Mike Mondragon

Evan Weaver wrote a SysV init.d setup for daemonizing Camping apps on a *Nix system and documents it in rv, a tool for luxurious camping

I used that blog entry as a reference to build one called RV2 that is a little bit more Gentoo specific. Here are my scripts and directory layout

RV2 Camping on Gentoo

Posted about 7 years back at Mike Mondragon

Evan Weaver wrote a SysV init.d setup for daemonizing Camping apps on a *Nix system and documents it in rv, a tool for luxurious camping

I used that blog entry as a reference to build one called RV2 that is a little bit more Gentoo specific. Here are my scripts and directory layout

On a Gentoo system make a directory /etc/rv2 and any files in that directory will trigger the rv2 init.d script to attempt to start a corresponding camping app.

for hurl it the file is /etc/rv2/hurl_rv2.conf and it contains something like:

sample my-app-rv2.conf
CAMPING_ENV=production
RV2_APP_DIR=/path/to/app/hurl
PORT=1999
ADDRESS=127.0.0.1

The rv2 init.d script expects RV2_APP_DIR to specify the application directory, PORT to specify the port that the Mongrel harness will listen to, and ADDRESS the machine address that Mongrel will bind to. See the source code for the Hurl Campling app to see how Hurl makes use of a ENV variable CAMPING_ENV to help in configuration for testing and production.

I’m running Hurl as Mongrel behind an Apache Proxy, more details about that can by found in my Maintaining Your Own Typo 4.0.3 which is nice guide for rolling your own Rails stack.

Here is the rv2_harness.rb that resides in /path/to/app/hurl. Every Camping app that uses RV2 will need to have a harness named rv2_harness.rb in its application directory

sample rv2_harness.rb @ /path/to/app/hurl/rv2_harness.rb
# Example mongrel harness for camping apps with rv2
# based on Evan Weaver's original rv implementation:
# http://blog.evanweaver.com/articles/2006/12/19/rv-a-tool-for-luxurious-camping
#
# author: Mike Mondragon
# url: http://blog.mondragon.cc/
# license: AFL 3.0

# from the command line:
# ruby rv_harness2.rb PORT ADDRESS

require 'rubygems'
require 'mongrel'
require 'mongrel/camping'
$LOAD_PATH.unshift File.dirname(__FILE__)

ENV['CAMPING_ENV'] ||= 'production'

LOGFILE = "#{File.dirname(__FILE__)}/mongrel.log"
PIDFILE = "#{File.dirname(__FILE__)}/mongrel.pid"

# or whatever else you want passed in
PORT = ARGV[0].to_i
ADDR = ARGV[1]

# this is your camping app
require 'hurl'
app = Hurl

if ENV['CAMPING_ENV'].eql?('production')
  app::Models::Base.establish_connection :adapter => 'mysql',
    :database => 'hurl',
    :host => 'localhost',
    :username => 'root',
    :password => ''
else
  app::Models::Base.establish_connection :adapter => 'sqlite3',
   :database => 'db/hurl.db'
end

app::Models::Base.logger = Logger.new(LOGFILE) # comment me out if you don't want to log
app::Models::Base.threaded_connections=false
app.create

config = Mongrel::Configurator.new :host => ADDR, :pid_file => PIDFILE do
  listener :port => PORT do
    uri '/', :handler => Mongrel::Camping::CampingHandler.new(app)
    # use the mongrel static server in production instead of the camping controller
    uri '/static/', :handler => Mongrel::DirHandler.new("static/")
    uri '/favicon.ico', :handler => Mongrel::Error404Handler.new('')
    setup_signals
    run
    write_pid_file
    log "#{app} available at #{ADDR}:#{PORT}"
    join
  end
end
Below is the /etc/init.d/rv2 script. After you install it be sure to enable it for system startup and shut down:
rc-update add rv2 default
Also since the script is running the Mongrel as the “apache” user and group be sure to chown your applications directory with those credentials since Mongrel will bite if it doesn’t have permissions to write its pid file
chown -R apache.apache /path/to/your/camping/app
/etc/init.d/rv2
#!/sbin/runscript
depend() {
        need net
        use mysql apache2
        after apache2
}

USER=apache
GROUP=apache
RV2_HARNESS=rv2_harness.rb
RV2_CONF_DIR=/etc/rv2

start() {
        ebegin "Starting Camping Apps in RV2" 
        for apps in `ls -1 ${RV2_CONF_DIR}`
        do
                # the config needs to have CAMPING_ENV,
                # RV2_APP_DIR, PORT, and ADDRESS specified
                . ${RV2_CONF_DIR}/$apps

                start-stop-daemon --start --quiet --background \
                        --chuid ${USER:-apache}:${GROUP:-apache} \
                        --exec /usr/bin/env ruby \
                        -- $RV2_APP_DIR/${RV2_HARNESS} $PORT $ADDRESS 1>&2

                res=$?
                # if one is broken do not continue
                if [ $res -ne 0 ]; then break; fi
        done
        eend ${res}
}

stop() {
        ebegin "Stopping Camping Apps in RV2" 
        for apps in `ls -1 ${RV2_CONF_DIR}`
        do
                . ${RV2_CONF_DIR}/$apps
                start-stop-daemon --stop --pidfile $RV2_APP_DIR/mongrel.pid
                ret=$?
                rm -f $RV2_APP_DIR/mongrel.pid
                # force unloading of all apps
        done
        eend ${ret}
}

restart() {
        svc_stop
        svc_start
}

Enjoy!

small urls with Camping

Posted about 7 years back at Mike Mondragon

I am happy to announce yet another very small URL generator called

hurl it => http://hurl.it/

In fact its first entry is this very blog post.

There are obvious predecessors and the recent (and very cool) Rails based urlTea which itself I think is inspired by rubyurl

But hurl it is not those things, hurl it is a Camping application. Camping is a Microframework written by why the lucky stiff, a MVC based framework that is a total size of 4K and written in Ruby. Camping applications are small, light weight, and are intended to do one thing really well. hurl it does one thing very well – RESTfully create and serve very small URLs.

hurl it has these attributes

  • is a Camping application
  • RESTful (index, show, and create verbs) and responds to application/xml
  • tunes its use of ActiveRecord for use with the performanced minded MyISAM engine
  • developed with Agile practices including full unit and functional tests using Mosquito
  • is open source under the MIT License
  • has a neat-o base 62 number algorithm using the alphabet of 0-9,A-Z,a-z that would be good to know on an interview

hurl it is meant to be the honey layer in your peanut butter sandwich on wheat bread. hurl it is not the sandwich nor tries to be anything more than really super awesome at representing long URLs as really short URLs.

Things I’ve found helpful during hurl it development

I wrote a SysV init.d setup for Gentoo based on Evan’s work call RV2

Source

svn checkout http://svn.mondragon.cc/svn/hurl hurl

or

svn checkout http://svn.mondragon.cc/svn/hurl/tags/hurl-1.0/ hurl

small urls with Camping

Posted about 7 years back at Mike Mondragon

I am happy to announce yet another very small URL generator called

hurl it => http://hurl.it/

In fact its first entry is this very blog post.

There are obvious predecessors and the recent (and very cool) Rails based urlTea which itself I think is inspired by rubyurl

But hurl it is not those things, hurl it is a Camping application. Camping is a Microframework written by why the lucky stiff, a MVC based framework that is a total size of 4K and written in Ruby. Camping applications are small, light weight, and are intended to do one thing really well. hurl it does one thing very well – RESTfully create and serve very small URLs.

hurl it has these attributes

  • is a Camping application
  • RESTful (index, show, and create verbs) and responds to application/xml
  • tunes its use of ActiveRecord for use with the performanced minded MyISAM engine
  • developed with Agile practices including full unit and functional tests using Mosquito
  • is open source under the MIT License
  • has a neat-o base 62 number algorithm using the alphabet of 0-9,A-Z,a-z that would be good to know on an interview

hurl it is meant to be the honey layer in your peanut butter sandwich on wheat bread. hurl it is not the sandwich nor tries to be anything more than really super awesome at representing long URLs as really short URLs.

Things I’ve found helpful during hurl it development

I wrote a SysV init.d setup for Gentoo based on Evan’s work call RV2

Source

http://github.com/monde/hurl hurl hurl

Episode 53: Handling Exceptions

Posted about 7 years back at Railscasts

When an exception is raised in development you get the full error along with the stack trace. In production, only a simple message is displayed. Learn why this is and how to customize the handling of exceptions.

Episode 52: Update through Checkboxes

Posted about 7 years back at Railscasts

See how to select multiple items using checkboxes and perform an action on the selected items in this episode.