May 15

May 08

Mar 01

I whipped this up to remove all spans and/or divs in an HTML. Don’t ask why. Here’s the regex:

< ?(span|div)[a-zA-Z0-9'" =]+>

Did I mention I love regex?

Enjoy.

Tagged with:
Jan 29
  • Grab Package from EnterpriseDB.
  • Find exact version location in /Library/PostgreSQL/x.x/
  • Put above dir + bin in PATH
  • sudo gem install ruby-pg

Tagged with:
Jan 12

When needing to perform a String.replace() with some regex and globally replace text. You must remember to put the “g” argument like so:

var str = “‘http://www.com/123/123′”

str.replace(/’/g,”")

Spent a few minutes banging my head on this one.  So remember the “g”!

Tagged with:
Dec 19

I will not regurgitate what Charles’ website can already tell you. Charles is a great tool. Moreover, let me add some obvious points for people like myself:

  • It runs on OSX and quickly.
  • It is affordable (we are getting licenses here this week)
  • It has TONS of features (especially allowing filtering of anything in URL)
  • It auto-magically acts a HTTP Proxy after reboot when Charles is started on ALL HTTP based applications.

Why you may ask not use Firebug, it’s free!

If you are doing Javascript work and trying to naildown activity on the wire (outside of the browser), you have to rely on a proxy or sniffer, especially if you are testing many browsers at once. The heavyweight option is indeed to use Wireshark on OSX, like I initially did. But this can add complexity when you are under a deadline.

Also, Firebug has soooo many great features I need to use concurrently, having a good proxy monitor allows me to use Firebugs other incredible features in tandem.

Last week I had such deadlines at my paid gig rewriting a .NET 3.5 site into Rails 2.1.2 . I had to (in a hurry) integrate a slew of user/tracking Javascript events that fired off GET requests to an external site. The query string and/or request HAD to include the variables exactly to ensure our internal datawarehouses didn’t get borked. Secondly, integrating the tags had to NOT break existing AJAX functionality surrounding the same buttons and links.

Using Firebug to monitor the happiness of Javascript, investigate the DOM and use the console to query, took up most of the Firebug interface and time. Having Charles running in a separate monitor (with the required URLS filtered) made for much,much quicker development and debugging.

Take a look at this example call (notice the Filter line that has part of the host addres). This GET request was fired when a user click a button. Charles verified the request had all the key/value pairs expected:

Using Charles and Firebug together rounds out Frontend web development, in my case using Rails 2.1.2 and JQuery, and helps keep your velocity up.

Lastly, there are features I have not even explored with Charles. I applaud the guys from Charles for writing such a great tool that saved my week and sanity.

Tagged with:
Dec 11

Jquery makes a lot of things really easy. This one, not so much. Take this Select as an example:

SOURCE:

<select id="sort_by" name="sort_by"><option value="F%3Dlistingid%3A1%7Csmallphotos%3A1%7Clistingseopath%3A1%7Cpropertyname%3A1%7Cpropertycity%3A1%7Cpropertystate%3A1%7Clistingpricelow%3A1%7Clistingpricehigh%3A1%7Clistingbedlow%3A1%7Clistingbedhigh%3A1%7Cwebtollfree%3A1%7Clatitude%3A1%7Clongitude%3A1%7Cgeocode%3A1%7Ccityseopath%3A1%7Cfrontcover%3A1%7Cmsa_code%3A1%26N%3D5875%26Nao%3D0%26Nf%3Dgeocode%7CGCLT+48.803100%2C-102.245600+5%26Ns%3Dsortpropertyname%7C1%26Ntk%3Dshowapartment%26Ntt%3D1%26Nu%3Dlistingid%26Ns%3Dsortorder%7C0">Best Match</option>
<option value="F%3Dlistingid%3A1%7Csmallphotos%3A1%7Clistingseopath%3A1%7Cpropertyname%3A1%7Cpropertycity%3A1%7Cpropertystate%3A1%7Clistingpricelow%3A1%7Clistingpricehigh%3A1%7Clistingbedlow%3A1%7Clistingbedhigh%3A1%7Cwebtollfree%3A1%7Clatitude%3A1%7Clongitude%3A1%7Cgeocode%3A1%7Ccityseopath%3A1%7Cfrontcover%3A1%7Cmsa_code%3A1%26N%3D5875%26Nao%3D0%26Nf%3Dgeocode%7CGCLT+48.803100%2C-102.245600+5%26Ns%3Dsortpropertyname%7C1%26Ntk%3Dshowapartment%26Ntt%3D1%26Nu%3Dlistingid%26Ns%3Dsortpropertyname%7C0">Property Name A to Z</option>
</select>

When you perform a selection and want to do some onclick magic, how to get the current selected option text? Like this:

$('#sort_by')[0].options[$('#sort_by')[0].selectedIndex].text

Told it wasn’t pretty. Thanks Troy for helping.

Tagged with:
Dec 07

Ironically, the two most interesting items for me personally were not directory related to Merb at all. I was quite impressed with the CSS capabilities of SASS and CouchDB gave me hope that being stuck in the rigidity of columns in SQL is not always my path. Here’s my my Merbday summary,  iteration retrospective format:

STOP:

  • Assuming Merb is “fragmentation” (so said someone smarter than me ) of the Rails community and a real effort to improve on Ruby as the defacto web programming language.

START:

  • Using ruby-prof in Rails projects and Kcachegrind to profile apps. (thanks for Yehuda Katz at www.engineyard.com )
  • Playing with Merb on a real project and focus on understand slices and interaction with other slices.
  • Investigate writing an Admin or basic CMS slice with someone else.

CONTINUE:

  • Loving Rails and not abandon it as yet.

Tagged with:
Dec 06


MERB does not have development logging turned on by default something I like very much in Rails. To turn it on, uncomment this line:

c[:log_file]  = Merb.root / "log" / "development.log"

In the config/environments/development.rb file.

Tagged with:
Dec 04

Motivation:
As an avid Ruby/Rails programmer and longtime CMS coder and user the following is yet another effort to keep a list of current Ruby/Rails CMS’s. That is the goal of this post. I will use comments from others to update the list and hopefully keep and up-to-date list for all (including myself) to use. Heck, I would love to have others help review and keep list up to date.

External Resources:

http://www.widgetfinger.com/
http://www.ajaxlines.com/ajax/stuff/article/top_ruby_cms.php

http://webscripts.softpedia.com/downloadTag/ruby+cms

Tagged with: