« January 2007 | Main | June 2007 »

May 2007 Archives

May 14, 2007

Good Startup Resources

Here is a list of some good start up resources that I have begun to check out on the web.

Paul Graham's essays

Clay Shirky's essays

OnStartups

Small Business Hub

Startup news

programming.reddit.com

Good start up books to read

Hopefully I will grow this list a bit more shortly, but for now that is some good information to get your started.

May 16, 2007

I am now at Pretheory

I know I don't actually post to this blog much at all, but I still occasionally add some stuff on it and I might slowly be bringing it back to life. So with that in mind I thought I should announce that I am now the co founder of a start up. Pretheory. If you want to keep up with the various projects we are working on the best place to check is over at the Pretheory blog.

Currently we are programming in Ruby on Rails, and we are hoping to have our first project launched by early August. So if you have been following this blog at all, keep and eye on Pretheory now as well.


pretheory_logo.jpg

May 17, 2007

Really good post on regular expresions

I found that this was a really good post on regular expressions. Just a good beginner walk through that will have you more comfortable looking at any regex you run into while debugging someone else's code, or if your trying to add your own regular expressions yourself.

Regular expression walk through

May 18, 2007

Rails casts

A great way to keep up with some rails tips and ideas. I have started watching rails casts when I am eating a snack, working out, or just have a few minutes. It is a great and simple way to keep rails ideas fresh in your head. Most of the tips are fairly basic for now, but I am hoping they start dipping into more complex rails solutions. Or how to break out of the framework when it makes sense.

Railscasts

May 20, 2007

Ruby Email Archiver

Checking and receiving email via ruby.

If you need to get emails and check emails via a ruby script this should get you started in the right direction. I needed to copy down about six thousand emails from my pop server, so I wrote up this little script. Ruby makes email simple, you just need to know where to look and unfortunately most searches result in finding a 3rd party library that costs a pretty penny for email actions in ruby. What you really need is the Net::POP3 or the Net::IMAP. After going through the quick documentation and seeing some of the available code examples, writing the code is straightforward. This is just a very simple example, with hardly any error checking.

Download the source to Ruby Email Archiver

require 'net/pop'

Net::POP3.start('pop.yourdomain.com', 110,
'userName', 'myPass') do |pop|
if pop.mails.empty?
puts 'No mail.'
else
i = 0
pop.each_mail do |m| # or "pop.mails.each ..."
subject = m.header.split("\r\n").grep(/^Subject: /)[0]
subject = subject.gsub("Subject: ","")
subject = subject.gsub(":","")
subject = subject[0,10] if(subject.length > 10)
File.open("/archive/#{i}-#{subject}.txt", 'w') do |f|
f.write m.pop
end
#if you want to delete msg after archive
#m.delete
i += 1
end
puts "#{pop.mails.size} mails popped."
end
end

Ruby email to rss

A simple ruby email2rss example

When I was searching for some basic ruby scripts to download pop email I came across the email 2 Rss project on Ruby forge. Since I noticed there was no code available for the project yet I figured I would make a quick version up and make the code available, so anyone else searching for similar examples would have a starting point.

This code is just a functional example, but doesn't have any real options or error checking so use at your own risk.

Download the source to Ruby Email to RSS Feed

require 'net/pop'
require 'rss/maker'

version = "2.0" # ["0.9", "1.0", "2.0"]
destination = "/archive/emailFeed.xml" # local file to write

#create a new email Feed
content = RSS::Maker.make(version) do |rss|
rss.channel.title = "Dan Email Feed"
rss.channel.link = "http://www.pretheory.com"
rss.channel.description = "My newest emails"
rss.items.do_sort = true # sort items by date

Net::POP3.start('pop.yourDomain.com', 110,
'userName', 'myPass') do |pop|
if pop.mails.empty?
puts 'No mail.'
else
i = 0
pop.each_mail do |m| # or "pop.mails.each ..."
subject = m.header.split("\r\n").grep(/^Subject: /)[0]
subject = subject.gsub("Subject: ","")
subject = subject.gsub(":","")
subject = subject[0,15] if(subject.length > 15)
link = 'http://www.gmail.com'
body = m.pop
body = body[0,25] if(body.length > 25)

#create feed item
item = rss.items.new_item
item.title = subject
item.link = link
item.date = Time.now
item.description = body

i += 1
end
puts "#{pop.mails.size} mails popped."
end
end
end

File.open(destination,"w") do |f|
f.write(content)
end

puts 'Done. Thanks.'

Web 2.0 craziness

View Dan Mayer's profile on LinkedIn


I Power Seekler
I Power Seekler

www.flickr.com
This is a Flickr badge showing public photos and videos from mayer_dan. Make your own badge here.

Creative Commons License
This weblog is licensed under a Creative Commons License.