Hi, this blog is no longer maintained, my new blog is here

Ruby On Rails and a Conning Israeli entrepreneur

|OFF| If languages were religions

Ruby would be Neo-Paganism - A mixture of different languages and ideas that was beaten together into something that might be identified as a language. Its adherents are growing fast, and although most people look at them suspiciously, they are mostly well-meaning people with no intention of harming anyone.

http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html

Finally on Mephisto

It wasn't easy, but i made it.
finally the move is complete and 'Elad on Rails' is running safe and sound on my local machine (domain move is expected soon, after Christmas maybe).
The move was not as simple as i expected, Blogger does not offer an out-of-the-box solution for exporting your blog posts/comments, but as i mentioned in the move planning post, i found a way to do that using the Blogger draft engine. This was a hugh disappointment, the xml that was produced by the export option was terrible and made me realize that there is no simple way to get out of blogger (and Mephisto didn't help as well, no BloggerConverter implemented...rrrr).
So, i decided to do the easiest and simplest thing as possible, installed a local version of WordPress, imported Blogger (yes, WordPress has a blogger import tool) and from WordPress to Mephisto it went like a breeze (Using the Mephito WordPressConverted).
They only thing that went wrong is that i had to lose the Hebrew tags from blogger, apperantly Mephisto doesn't like Hebrew.
That's it.

Moo.rd: lightweight Mootools extestion

Mootools is awesome, but it still lacks some of the features that JQuery has when dealing with effects and some other not-so-important stuff.
Moo.rd is an excellent extension which implements some more features back to mootools. features such as some extra effects (finally, a mootools shake effect!), windows, sliders and more.
recommended, get it here.

Javascript Frameworks: i am changing my mind

well, originally i chose JQuery, which seems too-awesome-to-ignore at the time, but a recent project made me decide to try Mootools once again, well, it's amazing.
MochaUI is an excellent UI library in Mootools, the simplicity is overwhelming and on top of it all the dynamic pseudo selectors as lately mentioned in David Walsh's blog... amazing.


/* grab "checked" elements */
Selectors.Pseudo.checked = function() {
return ('input' == this.get('tag') && ('radio' == this.get('type') || 'checkbox' == this.get('type')) && this.checked);
};

/* grab "selected" option elements */
Selectors.Pseudo.selected = function() {
return ('option' == this.get('tag') && this.selected);
};

/* grab random elements */
/* credit: http://blog.kassens.net/custom-pseudo-selectors */
Selectors.Pseudo.random = function(probability, local) {
return Math.random() < (probability || .5).toFloat();
};

/* grab elements with no value */
Selectors.Pseudo.noValue = function() {
return '' === this.value;
}

/* grab elements with a specific empty attribute */
Selectors.Pseudo.emptyAttribute = function(att) {
return this.get(att) == '';
}


i think i might have some second thoughts about JQuery..

Observers, Associations and Callbacks

In my latest project, i need to notify a user via email about a certain kind of instance being created, so far normal.
This instance is created with a several of associated instances, let's say i am creating an article instance with linked categories using the virtual attribute technique (RailsCasts #16).
I created an observer for the article class to send an email with the article and categories after a successful creation of an article instance, therefore i immediately assumed that the correct callback is after_create. well, it's not.

when i used after_create, the email arrived with an empty list of categories, almost like they weren't saved, but a short trip to the console showed that the categories were created and that they are associated to the article as i wanted.

The problem resides in the order rails does this nested object creation, first the initial object is being created (the artical) and only than the association are created (after i used #build, watch the screen cast!), which causes the email to be triggered one step earlier than i wanted.

after finding this article i changed the observer's callback to after_save which apperantly is being triggers after the associations are saved as well.

i spent a lot of time on it, hope this helps.

Ajaxian: YQL - converting the web to JSON with mock SQL

Yahoo! now enables us to query a web page just like we would in sql. give it a try at YQL - converting the web to JSON with mock SQL

Google's Native Client plugin

Google has released a new experimental browser plugin that allows web applications to securely run native code on the underlying platform. The plugin, which is called Native Client, is distributed under the open source BSD license and is designed to work with all major platforms and browsers.

Native Client provides a sandboxed web-embeddable runtime environment for portable x86 binaries. It also provides a bridge to facilitate communication between JavaScript and Native Client executables. This makes it possible for complex web applications to seamlessly leverage native code for processor-intensive computations.

i don't know about you all, but it scares me :)
Source

Using ruby on rails with Oracle Legacy.

Great slide on SlideShare.
introduces the ruby-plsql gem, which makes it easier to preform database functions and stored procedures from ruby/rails applications (and supports bind variables).
i personally wrote a module of my own to handle this need (which supports bind variables as well).
Check out the slide and pay attention to the oracle_enhanced_adapter now available.
The slide is over here at SlideShare.

Moving to Mephisto (hopefully)

i have had it with this blogger account, you can say a lot of good things about this blog platform, but it is still a shared blog platform and it's not very professional to store you crown jewel on a blog platform which is written in Python :).
So i decided, i am moving to Mephisto. Mephisto is a Ruby on Rails blog platform and a self proclaimed "Best blog platform ever". well, i don't really know if that is true or not, but after checking it out locally i decided to use Mephisto for my permanent new blog.
The only problem i have right now, is how to transfer my Blogger posts/comments into my brand new Mephisto database. Mephisto is equipped with a "converstion" tools from Wordpress and Movable-type and as far as i know, nothing for blogger.
the blogger draft service (experimental blogger interface) enables you to download your entire post and comment history as XML so i might try to simply parse it into the DB (Or write a Converter).
Anyway, i'll be kinda busy doing it in the near future, so probably no posts in the near future.

Free idea: pastie like installation instructions

Sometimes when I google for installation instructions (for a gem, plugin whatever) I come across with blog posts containing old and out of dated installation instructions (old versions for example).
Why not create a pastie like engine for people to create and search for the most updated instructions? This engine should be smart enough to get a URL/svn/git/FTP address and fetch the latest file for each entry.
Of douse, a widget for bloggers should be mandatory.
I don't have the time to do it alone, if anyone feels like picking up this glove with me, just tell me.

Periodical AJAX requests and Session Expiry

My current applicaiton requires a session expiry feature, so fat, pretty ordinary, i decided to use the limited sessions plugin, as i always do.
The problem came up when i found out, that sessions aren't being released after the desired time had passed.
What was the problem?

first we will need to understand how rails uses sessions, basically it's something like that

  • session is retrieved from whereever it is. (ActiveRecordStore,CookieStore...)
  • Controller#Action is being preformed
  • Session is saved
now, where is the problem? when using periodical ajax calls, the session is being updated as it is after every action, so the 'updated_at' field, (required by the plugin) is updated, what causes the expiry interval (assuming it's bigger than the periodical AJAX calls's interval) to never be met. so no session expiry.

Solution

In my application.rb, i have a before_filter which updated the session with user_id in order to relate the session to the user, i migrated another field into the session table so i can keep my own track over changes, named it 'last_updated' like that

class AddCustomUpdateDateToSessions < ActiveRecord::Migration
  def self.up
    add_column :sessions, :last_updated, :datetime
  end

  def self.down
    remove_column :sessions, :last_updated
  end
end
and changed the application.rb method to update the new field, instead of the 'updated_at' field, and prevented my AJAX requests to update to the session, no need.
before_filter :update_session
  def update_session
    unless request.xhr?
      if logged_in?
        if session.model.user_id.nil?
          session.model.update_attribute(:user_id, current_user.id)
        end
        session.model.update_attribute(:last_updated, DateTime.now)
      end
    end 
  end
(yeah, i know it can be done better.) i also needed to change all the 'updated_at' references to 'last_updated' field inside the plugin's limited_sessions.rb, in order to completely take control over the session update flag. now it's working and my ajax calls do not cause the expiry interval to expire.

attachment_fu and minimagick resize bug

In one of my latest projects i was using the attachement_fu plugin to handle image uploads.
The attachement_fu plugin enables the option to select an image processor engine between ImageScience, Rmagick add MiniMagick:

  1. Rmagick
    Kinda bulky, leaking but fully functional
  2. MiniMagick
    Simple version of Rmagick, simple and small.
  3. ImageSceince
    Small, nice, and quick.
i decided to use MiniMagick as my processor, i installed the gem:

sudo gem install mini_magick


and added a specific :processor option to my Logo model.

has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 2.megabytes,
:resize_to => 'x100',
:processor => :mini_magick


but when i was uploading an image, i was was expecting it to be resized based on the options i specified in the model. imagine how surprised i was when i found out that the image is not being resized.

checking the log found the following error:

Exception working with image: ImageMagick command (identify "/var/folders/Bv/Bvbna8-OH548ZWju8naF4U+++TI/-Tmp-/minimagick11451-0") failed: Error Given 32512


Googling it didn't help me much (except from finding other people with the same problem), so i decided to switch to ImageScience instead (RMagick is out of the question of course).

sudo gem install image_science


this will include all most all dependencies, the freeImage dependency is also needed.
us mac/darwin users can simply use port:

sudo port selfupdate
sudo port install freeimage


now change the processor in the model

has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 2.megabytes,
:resize_to => 'x100',
:processor => :image_science


and now it's working. yeah!.

Skype Weblinks - Call a skype user or send an IM message in a html page

When the user has installed Skype, one can open Skype directly from a webpage. The protocol is skype:skypename - and some other optional flags.

The example will use my skype username, but i am sure you will be able to get the hang of it.

Call a skype user
The optional flag is call - to force Skype to call somebody. It can also be left out - but if the user changed the default behavior to e.g. chat - Skype will open an IM session instead. So - go the save way and use the call - flag.

Example: call a Skype user


<a href="skype:eladmeidar?call">Call</a>


Send an Skype IM message to a Skype user

The optional flag is chat. See the example below to see the usage in a html page.
Example: send a chat message to a Skype user


<a href="skype:eladmeidar?chat">Chat</a>

Send a voicemail to a Skype user
The optional flag is voicemail - as you might have guessed.
Example: send a voicemail to Skype user


<a href="skype:eladmeidar?voicemail">Voice mail</a>


Create a Skype conference call with multiple users
This is as easy as the examples above - just more usernames before the "?" and call as flag.
Example: create a Skype conference call


<a href="skype:eladmeidar;otherfriend123?call">call 2 friends</a>


Create a conference chat with multiple users
Same as conference call - with chat as flag.
Example: open a conference chat with multiple users - in html


<a href="skype:eladmeidar;otherfriend123?chat">Chat with 2 friends </a>


i am now working on a rails plugin to implement this automated use for Rails applications

Rails 2.2: Getting Started link list

General Documentation and Guides

From railsinside.com

Rails 2.2 Release Notes - A very solid set of release notes for 2.2 with basic coverage of the new features (with short code examples and links) as well as a list of deprecated features. They were compiled by Ruby / Rails Inside's very own Mike Gunderloy!

Upgrading RubyGems to 1.3.x - Depending on your setup, Rails 2.2 may demand that you upgrade to RubyGems 1.3.x. This is not as easy as it might usually be, however. Mike Gunderloy gives some tips in case you get stuck.

Rails Security Guide - Steer clear of security issues in your Rails 2.2 applications by reading the Ruby on Rails Security Guide. Who said Rails has poor documentation? This is incredible!

Rails 2.2 Screencast - Gregg Pollack and Jason Seifer of Rails Envy put together a very solid Rails 2.2 screencast. It costs $9, but it covers a lot of ground over 44 minutes - learn about etags, connection pooling, new enumerable methods, new test helpers, and more.

Rails 2.2 - What's New - In association with EnvyCasts, Carlos Brando and Carl Youngblood present Rails 2.2 - What's New, a 118 page PDF covering all of the changes and additions to Rails 2.2. It's available in a package deal with the screencast (above) too.

InfoQ's Glance - InfoQ's Mirko Stocker takes a quick glance at some of Rails 2.2's new features.

New Features

Thread Safety - Rails 2.2 is now "thread safe." In October, Pratik Naik wrote a summary of why this is a big deal as well as some gotchas (basically, don't use class variables, use mutexes, etc.) Charles Nutter has also written What Thread-safe Rails Means which answers several pertinent questions.

Internationalization - The Rails Internationalization effort has its own homepage at http://rails-i18n.org/ which features lots of links to how-tos, tips, documentation, and demos. They also have a Google group / mailing list where you can get help, make suggestions, etc.

Basic Language Internationalization - It's a little old, but Simple Localization in Rails 2.2 gives a very quick, code-driven example of how basic internationalization works in Rails 2.2 (some of the set up is easier now, but it mostly applies).

Localization / Internationalization Demo App - Clemens Kofler has put together a demo app that shows off some of Rails 2.2's internationalization and localization features. If being knee deep in code is the best way for you to learn, jump in!

Layouts for ActionMailer - As of Rails 2.2, you can now use layouts in your ActionMailer views.

Connection Pooling - The connection pooling in Rails 2.2 allows Rails to distribute database requests across a pool of database connections. This can cause less lockups. In collaboration with a non-blocking MySQL driver, serious performance increases could result in certain situations.

Specify Join Table Conditions with Hashes - Do you need to run a find (or similar) query across a join? Now you can just specify the conditions for the joined tables in a hash, much like local tables conditions!

Limited Resource Routes - You can now limit map.resources to creating certain methods. For example, you might not want destroy or index methods - you can now specify these with :only and :except.

Memoization - Stop rolling your own memoization in Rails apps. Clemens Kofler demonstrates Rails 2.2's newly rolled-in memoization features. It's just a single method! If you have a view that calls on a calculated attribute often, this will give you some serious performance gains.

Custom Length Tokenizer for Validations - You can now specify a tokenizer of your own construction for validates_length_of validations.

Array#second through Array#tenth - If you're a bad programmer, you can now demonstrate it to the world by using the new Array#second, Array#third, Array#fourth, and so forth, methods. I've put it in my calendar to look for open source Rails apps using Array#seventh in six months time and to call them out on Rails Inside ;-)

Note: This list only takes into account some of the new features in Rails 2.2. There are a lot more! Read the release notes and the Rails 2.2 - What's New PDF to get the full picture.

Miscellaneous

restful-authentication-i18n - Want an authentication plugin for Rails 2.2 that supports internationalization? Take a look at result-authentication-i18n!

Barebones Apps - Check out Rails Inside's 7 Barebones Rails Apps to Kick Start Your Development Process.

Deploying on JBoss - You can now easily deploy a Rails app to a JBoss server. With Rails 2.2's significantly improved JRuby support, this makes rolling out Rails apps in the enterprise a breeze!

Installing Rails on Ubuntu Hardy Heron - Simon St Laurent has put together two Rails useful installation videos. One for servers, and one for the desktop.

REST for Rails 2 - Are you still in Rails 1.x land or not using REST at all? Would you like to? Geoffrey Grosenbach has put together a screencast showing you how it should be done.

A Better Rails Logo - The Rails Logo (as used at the head of this post) was created by Kevin Milden and is distrubuted under the BY-ND Creative Commons Licence. i personally like the older one.

Rails 2.2: Quick Feature list

Rails 2.2 was just released, and ryan strieks again with a great post.

let’s take a peek at some of the major new features (as determined by yours truly – feel free to pipe up with features that I’ve missed).

Rails 2.2.2 requires rubygems v 1.3.1, so before you upgrade make sure to do a sudo gem update --system.

Rails 2.2 Features

i am personnalt still on 2.1, and i don't think i will upgrade at this moment, but some features look very-needed in fact.

Printer Friendly Pages

CSS is a great new tool for web designers. Now it is more widely supported, and browser-makers are sticking to the
W3C standards, we can begin to explore the possibilities it has offered us since the 90s but that we could not make
use of.
CSS allows you to separate your design from your markup, making maintenance infinitely easier, and your site more
likely to work in different devices, both of which are definite pluses. It also, however, allows you to tell a page to
display a different way depending upon what device is being used to render it.
This is achieved using the "media" attribute of the "<link>" or "<style>" tags, like so:
There are several media types available to you - all, aural, braille, handheld, print, projection, screen, tty, tv - and a
list of available media types with more detail is available from W3C (where you can find out more about media
groups, as well).
With such a range of options, you can, if you like, create one HTML document that will display exactly as you like
depending entirely upon which device is being used to view it. You can hide large images from PDAs, you can specify
seperate font styling for overhead projectors - you can write your site so that it works well with the technology at the <link media="screen" href="style.css" type="text/css">
<style media="screen" type="text/css">
user's disposal. And one very useful side effect of this is that you can specify an entire print style without the need
for copies of every page of your content, like the following, that will use the "normal.css" style sheet for screens, and
the "printer.css" style sheet when printing.


<link media="screen" href="normal.css" type="text/css">
<link media="print" href="printer.css" type="text/css">


For print styling, there are a lot of factors to consider. Are many users going to want to print out your header? No.
But do you want your logo on the page? Yes. Is the navigation worth printing? No. Each item on a web page serves a
purpose, and on paper, that may not be worth much.
It is best, then, to start at the beginning. With an unstyled HTML document. Pick a page to start working on, and
remove all styles from it. With an unformatted page in front of you, it should be pretty easy to see what needs styling
and how, but don't rush in. There's a lot to think about.

FONTS
Fonts are very different on the web to print. Sans-serif fonts are, allegedly, the best to use on the web. Serif fonts
are, apparently, better on paper. So first things first, set your font to a serif font you like (personally, I like Georgia
for Windows). As with picking all fonts, make sure you provide alternatives for those without the first-choice font.
Font sizing is a bit different on paper too. It's usually best just to leave this to the default, but if you want to specify a
font, make sure you run plenty of tests to make sure it's easily legible.


* {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12pt;
}


LINKS
Links are not going to be a lot of use on paper, by their very nature. But that does not make them useless.

a {
color:#000000;
text-decoration: underline;
}

a:after {
content: " ( "attr(href)" )";
}

The above, if added to a printer style sheet, will make all links black and underlined, and add the address of the link
in brackets afterwards, meaning that if a user did want to visit any site linked to from that page at a later date, they
can.

SPACING
In print, margins and spacings are as important as with the web. There is no harm in adding in a little space
between words and lines, and a decent gap around the edges, if it will make a print-version easier to read.

HIDE USELESS STUFF
You can hide elements in this style sheet easily enough, using display none. This will save some space on the paper,
and reduce useless junk on the page, something the user will be very grateful for. Elements worth hiding are usually
form elements, some images, marquees, and flash content. If you are unsure, print the page and then work through
that page deciding what is useful and what is not.

body {
padding: 10%;
line-height: 1.2;
word-spacing: 1px;
}



COLORS
Print colors will show up very differently to screen colors, especially as a high proportion still have black and
white printers. Even those who don't will be grateful to you if you keep the proportion of color to a minimum,
simply because of the expense.
Highlight and emphasize things using italics, underlining, boldness and size in your print style sheet. Remove all references to colors where you can, save to set colors to black.

PAGE ADDRESS
You may want to add the address of the page itself to the page, and hide it, except when the page is printed, so that
the user can return to your page later if they wish.

TELL THE USER
A user may see a page without a "printer friendly" link and print anyway, but they may be put off. Try and add a note
to your page explaining that the page they are now viewing is printer friendly, and encouraging them to print it.

PING.fm

Just join ping.fm. it's not micro blogging, it's a fat man's blogging.

Rails date Range

Holy Shmoly! Sometimes Rails and ruby just blows me away,

Let’s assume you are trying to find a bunch of records between a time frame.


class Call < ActiveRecord::Base
named_scope :by_month, lambda { |d| { :conditions => { :date => d.beginning_of_month..d.end_of_month } } }
end


simply specify a range

and running (the named_scope )


this_months_calls = Call.by_month Date.today

And Rails will return all the calls that were recorded during the current month. Love it.

Git vs. Mercurial

Personally I'm more a fan of Git with the main reason being: Branching.

As far as I know Git still has problems handling Windows which is something Mercurial has never had to worry about. But since i am not a windows user (lover, or any other positive opinion holder), i don't really care.


Git

Pros
Lots of features
More hosting options.
Faster - slightly.
GitHub.
Solid local branch support.

Cons
Poor Windows support
Rubbish logo
Silly, long SHA1 hash of revisions.
You need to keep 'packing' the repo
History fiddling.


Mercurial

Pros
Portable
Its built with Python
Easily extensible using Python
Cool logo
Better documentation.
Local integer revision numbers on top of the SHA1
No need to keep packing/optimising.
Smaller repo footprint.
Better patch support (bundles and such)
Easy to learn.

Cons
Smaller feature set.
Few 3rd party hosting options.
Fewer 3rd party apps and plugins.
Smaller community.
Slower development.


Who Uses What

Mercurial
Mozilla
OpenSolaris
Aptitude
Netbeans
Dovecot

Git
Ruby on Rails Core
Linux Kernel
Google Android
Beryl
Fedora


Who Needs What
Mercurial is great for people who want to dive into distributed version control and get busy. Its clean, fast and easy to learn.

Git is for those who wish to fully exercise the benefits of source control and avoid the down's often happen when collaborating code.

goosh.org: a Google Command Line!

http://goosh.org/ is a command line interface for Google and some other related services such as wikipedia and YouTube.
Goosh (Google Shell) is a google-interface that behaves similar to a unix-shell.
You type commands and the results are shown on this page.
goosh was written by Stefan Grothkopp <grothkopp@gmail.com>
it is NOT an official google product!

Google Chat Video


Google is rolling out video and voice capabilities for the chat function that is embedded in the Gmail interface. It's a bare-bones voice and video-conferencing service, but it's simple to install and use and is a very good addition to Gmail.

It's no Skype, though. Gmail Video and Voice, as it's called, can't connect to the plain phone network, as Skype's paid service can. And there are plenty of other optional features missing, like a voice call recorder.

MochaUI: Javascript User interface library

MochaUI is a web applications user interface library built on the Mootools JavaScript framework.

Uses:

Web Applications
Web Desktops
Web Sites
Widgets
Standalone Windows and Modal Dialogs

Get it and watch demos here

CSS Graphs Helper for Ruby on Rails

source: http://nubyonrails.com/pages/css_graphs
A Ruby on Rails helper for making simple graphs. The graphs use only CSS/HTML (and an optional gradient image).
Vertical bar graphs, horizontal bar graphs, and complex bar graphs with an image marker.



Install:

./script/plugin install http://topfunky.net/svn/plugins/css_graphs

Generate:
# No arguments are needed
./script/generate css_graphs


Examples:



Find out more on the source @ Nuby on Rails

Common RJS mistake/error on Ruby on Rails

When you use some of your ajax helpers, such as link_to_remote, with the :update parameter in order to update a specific DOM element AND you specify page.replace_html or any other RJS syntax that handles other DOM ID, it will return the result expected, nothing will be updated on the :update pointer DOM ID.

Simply choose one, if you use :update, return an html or render a partial in your action instead of rendering RJS.
If you require multiple changes, use RJS and no :update parameter.

bye bye pdfetch.com

I decided to shutdown pdfetch.com, although it was a nice idea, i don't really have the time to take care of it.
thank you all the 300,000 users who downloaded a pdf from my site, if anyone wants the code, just as for it in the comments.

A little bit abot Git

Distributed Nature

Git was designed from the ground up as a distributed version control system.

In a distributed version control software like Git every user has a complete copy of the repository data stored locally (a.k.a a local working copy), thereby making access to file history extremely fast, as well as allowing full functionality and access when disconnected from the network. It also means every user has a complete backup of the repository. If any repository is lost due to system failure only the changes which were unique to that repository are lost. If users frequently push and fetch changes with each other this tends to be an incredibly small amount of loss, if any at all.

In a centralized VCS like Subversion only the central repository has the complete history. This means that users must communicate over the network with the central repository to obtain older versions for a file, Backups must be maintained independently and if the central repository is lost due to system failure it must be restored from backup and all changes since that last backup are likely to be lost. (Depending on the backup policies).

Access Control

Due to being distributed, you inherently do not have to give commit access to other people. Instead, you decide when to merge what from whom.

Branch Handling

Branches in Git are a core concept used everyday by every user. In Subversion they are almost an afterthought and tend to be avoided unless absolutely necessary.

The reason branches are so core in Git is every developer's working directory is itself a branch. Even if two developers are modifying two different unrelated files at the same time it's easy to view these two different working directories as different branches stemming from the same common base revision of the project.

So than Git:

  • Automatically tracks the project revision the branch started from.
    • Knowing the starting point of a branch is necessary in order to successfully merge the branch back to the main trunk that it came from.
  • Automatically records branch merge events.
    • Merge records always include the following details:
    • Who performed the merge.
    • What branch(es) and revision(s) were merged.
      • All changes made on the branch(es) remain attributed to the original authors and the original timestamps of those changes.
    • What additional changes were made to complete the merge successfully.
      • Any changes made during the merge that is beyond those made on the branch(es) being merged is attributed to the user performing the merge.
    • When the merge was done
    • Why the merge was done (optional; can be supplied by the user).

  • Automatically starts the next merge at the last merge.
    • Knowing what revision was last merged is necessary in order to successfully merge the same branches together again in the future.

Performance

Git is extremely fast. Since all operations (except for push and fetch) are local there is no network latency involved to:

  • Perform a diff.
  • View file history.
  • Commit changes.
  • Merge branches.
  • Obtain any other revision of a file (not just the prior committed revision).
  • Switch branches.

Space Requirements

Git's repository and working directory sizes are extremely small when compared to SVN.

Google Gmail search tokens

The amazingly simple search within Gmail (Google Apps) enables the option to specify a token in order to make your life a little easier.

Operator Definition Example(s)
from: Used to specify the sender Example - from:elad
Meaning - Messages from Amy
to: Used to specify a recipient Example - to:elad
Meaning - All messages that were sent to David (by you or someone else)
subject: Search for words in the subject line Example - subject:dinner
Meaning - Messages that have the word "dinner" in the subject
OR

Search for messages matching term A or term B*
*OR must be in all caps

Example - from:amy OR from:david
Meaning - Messages from Amy or from David
-
(hyphen)
Used to exclude messages from your search Example - dinner -movie
Meaning - Messages that contain the word "dinner" but do not contain the word "movie"
label: Search for messages by label*
*There isn't a search operator for unlabeled messages
Example - from:amy label:friends
Meaning - Messages from Amy that have the label "friends"

Example - from:david label:my-family
Meaning - Messages from David that have the label "My Family"

has:attachment
Search for messages with an attachment Example - from:david has:attachment
Meaning - Messages from David that have an attachment
list: Search for messages on mailing lists

Example - list:info@example.com
Meaning - Messages with the words info@example.com in the headers, sent to or from this list

filename: Search for an attachment by name or type

Example - filename:physicshomework.txt
Meaning - Messages with an attachment named "physicshomework.txt"

Example - label:work filename:pdf
Meaning - Messages labeled "work" that also have a PDF file as an attachment

" "
(quotes)

Used to search for an exact phrase*
*Capitalization isn't taken into consideration

Example - "i'm feeling lucky"
Meaning - Messages containing the phrase "i'm feeling lucky" or "I'm feeling lucky"

Example - subject:"dinner and a movie"
Meaning - Messages containing the phrase "dinner and a movie" in the subject

( )
Used to group words
Used to specify terms that shouldn't be excluded

Example - from:amy(dinner OR movie)
Meaning - Messages from Amy that contain either the word "dinner" or the word "movie"

Example - subject:(dinner movie)
Meaning - Messages in which the subject contains both the word "dinner" and the word "movie"

in:anywhere Search for messages anywhere in Gmail*
*Messages in Spam and Trash are excluded from searches by default
Example - in:anywhere movie
Meaning - Messages in All Mail, Spam, and Trash that contain the word "movie"
in:inbox
in:trash
in:spam
Search for messages in Inbox, Trash, or Spam Example - in:trash from:amy
Meaning - Messages from Amy that are in Trash
is:starred
is:unread
is:read
Search for messages that are starred, unread or read Example - is:read is:starred from:David
Meaning - Messages from David that have been read and are marked with a star
cc:
bcc:
Used to specify recipients in the cc: or bcc: fields*
*Search on bcc: cannot retrieve messages on which you were blind carbon copied
Example - cc:david
Meaning - Messages that were cc-ed to David
after:
before:
Search for messages sent during a certain period of time*
*Dates must be in yyyy/mm/dd format.
Example - after:2004/04/16 before:2004/04/18
Meaning - Messages sent between April 16, 2004 and April 18, 2004.*
*More precisely: Messages sent after 12:00 AM (or 00:00) April 16, 2004 and before April 18, 2004.
is:chat Search for chat messages Example - is:chat monkey
Meaning - Any chat message including the word "monkey".

Ruby on Rails and Oracle on Mac Os Leopard

Overview


The nightmare is over.
Just until the latest Oracle libraries update (finally released a X86 library pack for mac) it was nesecerry to use 2 versions of ruby, a universal and a ppc version. Sadly, when running PPC, the benchmarking were terrible and it had some very annoying freezes and other stuff that would simple make you want to jump off the roof.
BUT! (:) ) times had changed, Oracle (as mentioned) released an X86 Intel compatible library pack for MacOs users and therefore ended my misery,
Woohoo! That makes the entire process of connection Ruby on Rails and oracle on Leopard about as 100 times less complicated than before, so I’ve posted it here to let everyone enjoy.
I assumes that you’re using Rails 2.0 or greater (Why not really?).

IMPORTART!!!

If you already connected Oracle and Ruby on Rails using the old way, please preform the "Cleanup" step first.


Oracle Libraries


The new Intel Mac versions are available from the Oracle downloads site. Install them in /Library/Oracle/.
You can do side-by-side installations in folders with whatever names you want, since apps find them by using the $ORACLE_HOME environment variable (and it’s friends). I’ve got mine in /Library/Oracle/instantclient_10_2.
Also make sure that you’ve got the files required to run sqlplus and the sdk along with the basic. You can drop those in the same directory.

Symlink the libraries



In the directory where you’ve installed the instant client, run this:


ln -s libclntsh.dylib.10.1 libclntsh.dylib


Set the environment variables correctly

You’ll probably want to put these lines in your /etc/profile , but they also must be run from the command line to take effect (you can also "source /etc/profile"):


export ORACLE_HOME=/Library/Oracle/instantclient_10_2 <= Change to your library!
export TNS_ADMIN=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export PATH=$PATH:$ORACLE_HOME



Oracle! giddie up!



First you'll need to install the Active Record Oracle adapter,


sudo gem install activerecord-oracle-adapter --source http://gems.rubyonrails.org


which is how ActiveRecord deals with Oracle.
It doesn’t, however, install the Ruby oci8 driver, which is how Ruby talks to Oracle (yeah, annoying).

Important!!!

Have you installed the Oracle Instant Client SDK ?
good.


Get the lastest the oci8 library. Download it and unpack the file in the finder: it should unzip into ~/Downloads/ruby-oci8-x.x.x.

Now we can finish configuring the environment before we compile the library.


cd ~/Downloads/ruby-oci8-x.x.x
export SQLPATH=$ORACLE_HOME
export RC_ARCHS=i386
ruby setup.rb config
make
sudo make install


oh joy, scrolling lines of doom will pass in front of you and hopefully you'll see no errors and burst into tears.

Show me!



At this point, we’re almost done. Let's see it working.


irb
require 'oci8'
==> true

or

irb
require 'rubygems'
==> []
require 'oci8'
==> true



Configure your database.yml


In your database.yml, use the following to make it work:

development:
adapter: oracle
database: your_instance_name
username: your_user_name
password: your_password


The database name = > comes straight out of your tnsnames.ora file. You don’t need to specify any other connection information in database.yml, since the tnsnames.ora file has everything you need.

if you are using the oracle Express edition, it should look something like that.

development:
adapter: oci
host: //db_hostname:db_port/xe <== Oracle port is usually 1521
username: username
password: password
cursor_sharing: similar
prefetch_rows: 100


note: last 2 lines are some tweaking for a better Oracle performance.



Cleanup: Fix the ruby_fat and ruby_ppc setup



if you have installed Oracle libraries using the old way, you'll be happy to remove the mess it made out of your ruby installation and happily, it’s quite simple.
Just remove the ruby_ppc files, and the symlinks to them (called ruby, and rename ruby_fat as ruby:


cd /usr/bin <== or wherever you put them.
sudo rm ruby
sudo rm ruby_ppc
sudo mv ruby_fat ruby

and

cd /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
sudo rm ruby
sudo rm ruby_ppc
sudo mv ruby_fat ruby


Then, you should also remove the 2 management scripts:


sudo rm /usr/bin/ppc_ruby.sh
sudo rm /usr/bin/fat_ruby.sh


And that’s enough for the cleanup.

Rails Validations - Overview

i keep forgetting that, so i post it here for me and everyone else.

Here is the list of validations which you can perform on user input:


validates_presence_of:


Following check that last_name and first_name should be filled and should not be NOLL.


validates_presence_of :firstname, :lastname

validates_length_of:


Following example shows various validations on a single filed. These validations can be performed separately.


validates_length_of :password,
:minimum => 8 # more than 8 characters
:maximum => 16 # shorter than 16 characters
:in => 8..16 # between 8 and 16 characters
:too_short => 'way too short'
:too_long => 'way to long'


validates_acceptance_of:


Following will accept only 'Y' value for option field.


validates_acceptance_of :option            
:accept => 'Y'

validates_confirmation_of:


The fields password and password_confirmation must match and will be used as follows:


validates_confirmation_of :password

validates_uniqueness_of:



Following puts a condition for user_name to be unique.


validates_uniqueness_of :user_name

validates_format_of:


Following validates a that given email ID is in a valid format. This shows how you can use regualr expression to validatea filed.


validates_format_of :email
:with => /^(+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i

validates_numericality_of:


This validates that given field is numeric.


validates_numericality_of   :value                 
:only_integer => true
:allow_nil => true


validates_inclusion_of:


Following checks that passed value is an enumeration and falls in the given range.


validates_inclusion_of  :gender,   
:in => %w( m, f )

validates_exclusion_of:


Following checks that given values does not fall in the given range.


validates_exclusion_of  :age        
:in => 13..19


validates_inclusion_of:


Following checks that given values should fall in the given range. This is opposite to validates_exclusion_of.


validates_inclusion_of  :age
:in => 13..19

validates_associated:


This validates that the associated object is valid.


Options for all Validations:


You can use following options alongwith all the validations.




  • :message => 'my own errormessage' Use this to print a custom error message in case of validation fails.


  • :on => :create or :update This will be used in such cases where you want to perform validation only when record is being created or updated. So if you use :create then this validation work only when there is a create opration on database.



Check the following link for more detail on Validations.

TextMate Bundle of Bundles: getBundle

From Macroomates
There are 124 bundles for TextMate where only 36 are included by default. Until recently, the way to get more bundles has been to install subversion and then do a checkout of the bundles needed (from the shell.) or download a .tmbundle file.

Now there is a much easier way: the GetBundle bundle by Sebastian Gräßl. All you need to do is download and double click it to get an “Install Bundle” command which you can invoke from inside TextMate (hint: use ⌃⌘T and enter “install”.)

There is also an “Update all Bundles” command which you can use to update your custom installed bundles to the latest version. A future version of the bundle is likely to offer a launchd Daemon that you can install to have updating taken care of automatically.

All bundles installed via the GetBundle end up in ~/Library/Application Support/TextMate/Pristine Copy/Bundles.


Get it here, since the original repo isn't working.

Rails Plugin: Dynamic Session Expiry

With session_lifetime you can set after how much time of inactivity your session should expire, you can execute an action when the session expires, and you can set where to redirect_to after session expiry.
Example


class ApplicationController << ActionController::Base
expires_session :time => 2.hours, :redirect_to => '/login'

protected
def on_expiry
flash[:notice] = "Your session has been expired, and you have been logged out."
end
end


Get it from

git://github.com/DefV/session_lifetime.git

Rails Plugin: import_svn

This plugin imports a rails project into subversion (excluding tmp files, logs and more) and converts the current directory to a working copy of that project.

SvnImport goes a little bit further than just adding everything; it ignores resources such as logs, tmp files and database.yml and environment.rb.

For the database.yml and environment.rb files, SvnImport creates template files, and provides a task for copying them back after checkout. This allows each developer to have their own database settings and/or keep the password for the production database out of version control.

Installation




script/plugin install https://svn.cjohansen.no/rails/plugins/svn_import/trunk


Usage




rake svn:import


This task will only successfully run once - before the applicaton has been added to subversion. Once it's been added, the task will no longer do anything. When a new developer checks out the project, she can get the standard setup by doing:


rake svn:setup


Source

Precentage proxy for Ruby's Numeric class

Just a little something i did, cause it usually takes me about 15 minutes to calculate a percentage conversion.
is anyone else checking/calculating dates in irb/console?
"Elad, in 2 weeks you have a dentist appointment!"
"mmm.... "


script/runner 'puts 2.weeks.from_now'


hehe,
but the method today's post is about, is the percent_from i did, so here it is.


class Numeric
def precent_from(num = 100)
self.to_f * (num.to_f / 100.0)
end
end


which comes out as:


>> 40.precent_from(1000)
=> 400.0
>> 6.precent_from(1000)
=> 60.0

remote_form_for with no-ajax support


<% form_remote_tag :url => {:controller => \'/posts\', :action => \'view\'},
:html => {:action => {:controller => \'/posts\', :action => \'view\', :id => @id}} do %>
<%= submit_tag \'View\' -%>
<% end %>


<form action=\"/posts/view/1\" method=\"post\"
onsubmit=\"new Ajax.Request(\'/posts/view/1\',
{asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\">
<input type=\"submit\" value=\"View\" />
</form>

Tip: Finding all Unread messages in your gmail inbox

I have about 3000+ mail and i get something like 20-40 relevant messages a day, i usually very orgenized and i sort the incoming messages once an hour.
Now i had about unread messages that i missed in my inbox and wanted to find them, after a short quest i found this:

in the top search enter

label:unread in:inbox

and yaaa, all unread messages are found. you can drop the in:inbox and get your entire list of unread messages, including other labels.

String boolean: MethodMissing fun!

Check out this one, this is way i love rails.


elad = "smart"
elad.smart? # => true


using method_missing on the String object


def method_missing(method_name, *arguments)
if method_name.to_s.ends_with?("?")
self == method_name.to_s[0..-2]
else
super
end
end

Simple install Git on Leopard


mkdir -p ~/Downloads/src
cd ~/Downloads/src

# Set options since we don't have GNU gettext installed
export TCL_PATH=`which tclsh`
export NO_MSGFMT=1
export GIT_VERSION='1.6.0.2'

# Get and install git
curl -O "http://kernel.org/pub/software/scm/git/git-$GIT_VERSION.tar.bz2"
tar xjvf "git-$GIT_VERSION.tar.bz2"
cd "git-$GIT_VERSION/"

# When on Mac OS X
./configure
make
sudo make install

cd ..

# Install Man Pages
curl -O "http://kernel.org/pub/software/scm/git/git-manpages-$GIT_VERSION.tar.bz2"
sudo tar xjv -C /usr/local/share/man -f "git-manpages-$GIT_VERSION.tar.bz2"

Update: Rails 2.1 globalize plugin - Fix

I am using globalize since ever, I always prefered it over gettext or what ever taylor made i18n solution out there.
It seems to be that there is a problem with the action method of date_select, or if to be more specific, the month_select helper produces a "wrong number of arguments" exception... I droped the usage of the globalize plugin for meantime... But I am really looking forward for a real solution... Anyone?

Update
i found a post a about a Rails 2.1 compliant Globalize plugin release. it is currently working for me with no special problems.

Installation:


script/plugin install git://github.com/heythisisnate/globalize.git

updated: Brand new Rails security for 2.1

update: link target changed.

uhh, i know a guy that make a whole bunch of money just by pointing out security holes in web applications.
Most of the people don't even realize how much work is needed in order to even start to make your application in a minimal security level, there are so many ways in which evil hackers (or just playful kids) can disfigure your site, steal information or damage your site data integrity and eventually sending your application in a DOS oblivion.
Rails is not different, there are many traps to hop over, many standards and code implementation techniques to use.. lucky for us, our guys at the Rails HackFest are working hard on updating the rails documentation and menuals in order to make our life easier once more

I would generally recommend to read ALL what you can find in the Rails 2.1 Manuals page and put a great focus on the Rails Security Manual

What is with Mac users?

Great post, as a mac-men, I appreciate every word.

http://howgoodisthat.wordpress.com/2008/10/24/what-is-it-with-mac-users/

Ruby on Rails 2.2 Release Notes

Rails 2.2 delivers a number of new and improved features. This list
covers the major upgrades, but doesn't include every little bug fix
and change. If you want to see everything, check out the list of
commits in the main Rails repository on GitHub.

Along with Rails, 2.2 marks the launch of the Ruby on Rails Guides,
the first results of the ongoing Rails Guides hackfest. This site will
deliver high-quality documentation of the major features of Rails.

http://guides.rubyonrails.org/2_2_release_notes.html

Lighting Fast Ruby On Rails security checklist

Ruby on Rails Security checklist for models:

  1. Use attr_accessible (or attr_protected if you must) to explicitly identify attributes that are accessible by .create and .update_attributes. Just because you don't expose an attribute on an edit form doesn't mean that someone won't try to post a value to it. I prefer attr_accessible over attr_protected as it fails on the side of safety when new fields are added to a model - you have to explicitly expose new fields.
  2. Make sure queries are using the Rails bind variable facility for parameters, not string concatenation or the handy Ruby's #{...} syntax.
  3. Use validations to prevent bad input.
Ruby on Rails Security checklist for controllers:
  1. Make non-action controller methods private (if possible).
  2. If non-action controller methods must be public, identify them with hide_action to prevent unwanted execution.
  3. Make sure before_filters are in place if necessary for your authorization infrastructure.
  4. Move queries from your controller to your model, and see the model checklist above.
  5. Check for params[:id] usage - are you sure you can trust it? Check for proper ownership of the record.
  6. Check for usage of hidden fields - a user can send anything to you through them, so treat them with suspicious just as params[:id] should be suspect.
  7. Use filter_parameter_logging to prevent entry of sensitive unencrypted data (passwords, SSN's, credit card numbers, etc.) in your server logs.
  8. Forget about your view code for a minute, and think about how to protect your controller from posts a malicious user could make to any of your exposed methods. All parameters (whether or not exposed on a form, and whether or not invisible) are suspect to length overruns, bypassing of any browser based validation, attacks with malformed data, etc.
Ruby on Rails Security checklist for views:
  1. Make sure all data displayed is escaped with the helper method h(string).
  2. Eliminate comments in your views that you don't wish the entire world to see.

Google Analytics: Tracking AJAX and Flash

Google Analytics has a new feature that Ajax & Flash developers will find extremely useful . According to the new article, is now possible to track page views in Ajax & Flash applications. And, it is simple.


http_request.onreadystatechange = sendAlert;
http_request.open(’GET’, url, true);
http_request.send(null);
}

function sendAlert() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
alert(http_request.responseText);
pageTracker._trackPageview("/pagefilename1" ); }
else {
alert(’Error.’);
}
}
}

An important usage tip about this feature is that, Google Analytics codes are normally installed just before the /body tag. When calling _trackPageview function, you’ll need to use it after the Analytics codes are included. Which means installing the Analytics codes just after the tag is a guaranteed solution.

Tip: 21 Ruby tricks you must use

From RubyInside at 21 Ruby tricks you must know

ERROR: While executing gem … (ArgumentError)

After a recent upgrade to a newer rails version the gem package manager seems to be broken. Everytime you try to use gem install gem_name, you get the following error:

ERROR:  While executing gem ... (Gem::GemNotFoundException)

Deleting the cached files as suggested in other posts results in the error:

ERROR:  While executing gem ... (ArgumentError)

Solution
As suggested, you need to do:

gem install rubygems-update
update_rubygems

which should be updating the gem version to the latest one, ie 1.3.0

Stepping Up: Migrating from an SVN to a Git repository

pull the svn history into a new git repository:

* mkdir project_name.svn
* cd project_name.svn
* git svn init path/to/svn/repo —no-metadata
* echo “svn_username = Real Name ” > users.txt
* git config svn.authorsfile users.txt
* git svn fetch

make an svn-free git repository:

* mkdir project_name.git
* cd project_name.git
* git init
* git remote add origin path/to/git/repo
* git pull project_name.svn
* git push origin master

yippie!

Tip: Installing Mysql Gem on Leopard

First, i want to make it clear that i am totally for using Oracle Express Edition, and not in Mysql, although you may need a real DBA, it is something you will want anyway, even with Mysql for my opinion.

Working with the Ruby-Based Mysql libraries is not recommended, it freezes with no prior warning in the middle of a transaction and not very stable at all for my opinion (i will update important notes from the comments if you have any other enlightenment about it).

anyway, since Leopard is running on the Intel based Macs, you'll need to specify the ARCH flag in the gem install command.

first, make sure you installed Mysql from the official package at mysql.com

then,


sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config


Imporatant!!!! make sure you update your XCode libraries from the Leopard CDs.

Javascript logging, all hail to BlackBird

Everybody likes birds recently, Yahoo with their eagle, FireFly (it's not a bird, but close enough for me).
This particular bird offers a dead-simple way to log messages in
JavaScript and an attractive console to view and filter them. You
might never use alert() again as they declared.

BlackBird Home page is right here

Free SVN/Git Hosting Services

Anyone who is not using any source control of what so ever, please never come back to this blog.
Now, seriously... you have to protect your work and efforts from evil nature (yap, coffee on the MacBook) damaging your precious work.
The conventional way is to get a personal server somewhere and install the source control of your choice on it, and giddie up, but for those of use who are still poor entrepreneurs with no wish what so ever to buy a server somewhere, here are some few options to consider when choosing a source control platform for your application.

Unfuddle - Nice, remindes my of Zoho for some reason . Web 2.0 to the max and packed with project tracking and management such as issue tickets, source control, time tracking, milestones and etc. (but still not a replacement for BaseCamp, but that's for another post), Their free package comes with 250Mb, support for infinite repositories on both Git and Subversion.

Assembla - only a small part of a feature-packed project management service, a basic 200Mb of SVN hosting. the project hosting comes with wiki pages, blogs, etc. The free package has all of this so even if you don’t stump up the $49 p/m for the paid you’ll get one hell of a service.

OpenSVN - One of the first to release free SVN hosting of open source projects and starting to show its age with a very clunky interface and barebones features. free but a trouble maker, i got a lot of 404s and peer resets during commits.

Bounty Source
- Bounty Source offer your basic SVN along with a wiki and CMS for managing your projects online presence as well as a task tracker. Bounty Source have a unique feature though that enables a developer to be paid for the work they carry out on user feature requests.

SourceForge
- Ya baby, the real deal, an old and great dino indeed. They tried to shot it up with some Web2.0 gradients and curves, but it still looks like Geocities in 1998 :)

Google Project Hosting
- someone said gSourceForge? Google shamelessly (as for my opinion) simply took that old dino, and painted it blue :) . its features still lack and it is basically what i call an "executed to finish" job, like "yes, we at google now have a source tracker and such, but we didn't put to much work in it".


i personally moved from OpenSVN to unFuddle a few days ago, and i am very pleased at the moment.

IE Testing: Internet Explorer cannot open the Internet site. Operation aborted.


haaah... the joy of working with IE never ceases to amaze me. I was trying to test one of my pages on IE7 when this ruthless message arrived uninvited, needless to say that the immediate action that IE preforms is to redirect you to a 404 default page, discarding from you the option of viewing some Javascript errors and basically take care of the problem.

The Issue:
Internet Explorer 6 and 7 are getting really upset when you don't give them the chance to render the entire HTML, and preform a DOM related actions (appending/removing child elements for an instance).
This is mostly a response to a >script< tag containing a DOM changing javascript.

Solution:
If you are using JQuery like i am, use the document.ready function around your inline

78 Ways For Your Small Business to Save Money

A great article, i tried to raise this subject a few posts ago, but
this looks like a much better job.


Source: http://www.bspcn.com/2008/10/15/78-ways-for-your-small-business-to-save-money/

Written by insidecrm These easy tips will keep your finances secure
during the current downturn. With the economy struggling, every
business is trying to cut costs to make ends meet. Small businesses,
which have fewer resources, especially feel the burn. Not to fear.
We've come up with a mega-list of ways to trim the fat off your
enterprise so you don't become a casualty of the latest economic
downturn.

Dynamically adding a text field, with autocomplete

We all love auto complete. It makes our lives a little less complicated and classy. I decided to (as a complimantry to my new JS beloved framework) to use the JQuery autocomplete plugin, problems began when I needed to use dynamically added text fields with autocomplete. Since the plugin assumes that you use a single and unique DOM ID, was unable to setup the autocomplete feature to newly dynamic fields.
One solution was to add the fields by javascript and Dom manipulation, but I prefered to use a partial in order to keep the code simple and Rubish. The other solution was to add a javascript script tag in the end of the partial which traverses the DOM and adds a unique and random id, and of course setting the auto complete feature for each one of them.
Bottom line, it is working and even working well, but I would like to hear new ideas if anyone has.
Over and out.

My CrunchBase page

Elad Meidar on CrunchBase

Rails as a default language?

I got first acquainted to Ruby on Rails back just after I resigned from the Israel Army, I was writing fully functional web applications way before, and even managed to hold on to a startup project in Israel named ‘DealCenter.co.il’ which was later sold.
After working years with ASP, PHP and even simple HTML programming, coming across Ruby, and Rails specific changed the entire work habits and regulations that I had. ROR had pushed me forward into the great world of Web 2.0 Application, usability and the most important.... It’s fun to work with.
Some might say, that Java is better, that Rails is slower than most of it’s competitors and that it is very though to optimize, I find it rather not accurate after using Rails in 2 major projects that I am in right now and realizing, that there is no limit.
I have managed to find a solution to every problem that occurred my way in these projects, usually with 1-3 Google searches (thank you great community!!!) and in the millions of books and screen casts out there.

I think Rails might be the one I’ll keep. I suggest you guys too.

Elad Meidar, Marketing
elad@indomite.com
http://www.indomite.com/blog


USA - Debrief (indomite, Bojam and me)

It's been a very long time since I last posted anything, I had some rough times trying to adapt to living in the USA.
I have a lot of things to do here, since I am the newly announced marketing division point men for indomite.com (did you sign the beta notification already? Go now to our blog and do it.). Along side with Rotem Bar, i have a lot of meetings to do here and a lot of people to talk to.

We are currently meeting up with some people which are very interested in making a market move along side with indomite.com, anyone can see that the music industry is coming to life and there are some new companies emerging to this unknown market such as Bojam (which are very similar but yet behind us) and the newly annouced Myspace Music, so we are working fast and hard to make it a better application and service for musicians to play and share their music and creation with complete strangers.

Visit the indomite blog for more information about the next ground shaking online music collaboration application there is.

http://www.indomite.com/blog


We are working hard to make this world a better place for musicians all over the world, show us your support and sign up for a beta tryout.

 
--
Elad Meidar, Marketing




activity_streams Plugins for rails

http://agilewebdevelopment.com/plugins/activity_streams ActivityStreams is a Rails plug-in providing a customizable framework for cataloging and publishing user activity and social objects.

Half way to victory for FireFox

According to a statistics page at w3c firefox holds over 42% from the browser usage statistics. yaa!

Indomite.com Development Blog

As i previously mentioned, i am working on a start-up related to music.
Well, the time for a private beta has come and we collected a bunch of musicians that we know to start using the desktop application (and the web application as well of course).

Currently we do not accept any more new users, but if you are interested (further reading on the Indomite development blog) in getting a user to this amazing musician community, drop me a line in the comments.

Official Gmail Blog: We feel your pain, and we're sorry

Official Gmail Blog: We feel your pain, and we're sorry

Is Web2.0 ever going to arrive in Israel

Ok, so the title is a little bit harsh, there are some great sites being done here in Israel, but there are some things i just can't understand.

walla.co.il is one of the biggest sites in Israel, huge traffic and many many services to the regular israeli web-surfer. One of these services is Walla's webmail, which gives you a 5gb free mailbox.

but, and there is a huge but... take a look how my compose page looks like. nothing more to add.
although it's in hebrew, nobody including a native hebrew speaker can't understand what the h**l the layout is all about.


Buzz: rubyonrails.org vs. walla.co.il

Walla.co.il is one of the most visited web sites in Israel, it is some sort of an all-purpose-portal and holds the homepage spot for many people.
I wanted to check how many people are visiting in rubyonrails.org to walla.co.il at compete.com, this is what i got back.

Top 10 Design mistakes on the web

a great article about Do's and Don'ts on web design

How to save money in your startup company


  • Buy Macs, They are a little more expensive, but worth a hell lot of money in productivity terms

  • Buy a second monitor for every programmer, passing through windows (a.k.a: browser to Textmate and back) take a lot of time. worth the money.

  • Buy everyone food, all week long. when people go out to work it takes a lot of "extra" time, by buying them the food, you'll cut off about 20 min. per lunch break.

  • Expensive chairs, crappy desks. most of the programmers i know, appriciate their chair more than their table, their chairs are those big high-backed cousins, while the desk looks like a dump, besides everything you buy should be ergonomically designed

  • Programmers don't need phones, don't buy an expensive phone system, most of the programmers i know talk to each other across the room using Skype :), save the money for an executive phone system, if needed at all.

  • Rent to grow, don't rent offices with no space to grow (expected growth is something you need to calculate prior to renting an office). rent 100% more than what you need.

  • Outsource HR, YOU DON'T WANT THE HEADACHE, assign a professional employee to view the final candidates

  • You don't need an office, you need Google. Don't buy Microsoft office for everyone, buy for 4-5 stations and the rest can use Google Docs of one of those Java based editors (OpenOffice or Neo Office)

  • Use Google Apps, Emails, Documents, Wiki.. why hiring a system programmer for those? or even waste your employees time on building a wiki

  • Key programmers should get a laptop, do i need to expain?

  • Hire devoted programmers, these guys (when payed to the full) will work harder and faster than anyone else in the crazy startup life, compansation via paycheck will be required, but these are valuable employees.

  • Refrigerator, everyone knows that programmers drive on Coffee, Coke and Bamba (in Israel at least, in USA it's Cheetos or something:) ) so i suggest a Coffee machine and a snack drawer in the kitchen, a chocolate bar can do wonders to code.

  • Just finish, allow your employees to work in their own hours, (within reason and except the situation a bunch of programmers is needed to work together) when they are aware that they have a deadline, some people need to sleep until 10:00am, this does not mean they are not right for you

  • Cars, very important, an employee that needs to drive around buses for 2 hours in the morning traffic, is not a happy man

  • Clients don't speak to programmers, they don't speak the same language, use a dedicated person to bridge between the programmers and the clients, or if possible, hire a support personnel

  • Source Control, use Svn, Git or something, just do it...

  • Allow remote connectivity, you can hire people from abroad and still not to micromanage them, think about online collaboration too

  • Task management, use an online application, like basecamp or something, they keep your life easier and cost almost nothing.

  • Open Source, use open source software when possible.

  • (No) power to the people, empower a power saving policy in your startup, turn off screens and hibernate stations on the end of work for starters

  • Big Bad Bandwidth, there is nothing more annoying than slow connections so buy the biggest bandwidth possible, BUT, keep an open eye for Emule connections and such, you don't want it around.


  • that's it for now, thank to all of my programmer friends that helped me composed this one, i'll view the comments and update if necessary

Rails Tip: Annotate models

Ever happened to forget what columns does a Model has?
well, instead of Model.column_names, you can easily install the annotate_models plugin which adds the models schema info as a comment at the top of your model.rb file.

install from

script/plugin install http://repo.pragprog.com/svn/Public/plugins/annotate_models


and from the project root

rake annotate_models

Rails Tip: Render, Better, JS Later

There are certain standards we got used too when creating rails views and layouts, which may cause a problem or some set backs to our applications.
We are all used to coding the JS includes way up in our document, moving the JS to the bottom of the page will render your page a little bit faster, and this is why.

When a browser reads a page, it goes through from the top to the bottom, So when we put the JS include's up, the browser will attempt to download them and hold the dom parsing until it finishes.

Rails Tip: AR eager loading and :select

The AR::Base.find support the options of :include (for adding associations as JOINs in the select) and :select (which pinpoints the columns you wish to select.
For some reason, it is impossible to do them both toghther for example

Article.find(:all, :include => :author, :select => 'authors.name')

This line will raise an exception.
Luckily, there is the select_with_include gem which enables this feature!

first, install the gem

gem install select_with_include

next, require it in your environment configuration file (or in environment.rb)

require 'include_with_select'

Now, you can use the :select option, remembering to use the table name even if a column name is not unique.
There is a single fault back, in case you want to select all the table columns, you need to write them all, one by one. yeah, it sucks.


The Web Ask eizesus.com

Subscribe

    follow me on Twitter

    Twiters Around

    About Me

    My photo
    I am a web developer for more than 9 years, managed, cried, coded, designed and made money in this industry. now trying to do it again.

    Blog Archive

    Labels