GMail: Howto skip attachment virus verification

March 12th, 2008 Dante Regis 1 comment

When I open old messages on gmail, I like to download attachmentes imediately. And by that I mean I can’t even wait 5 or 6 seconds while it’s being scanned for virus! What the hell! I sent the attachment myself, I know it has no virus! It’s now a malware or spyware, nothing! No antivirus will find anything there.

So, to skip antivirus verification on Gmail, like I do, just click FORWARD on the bottom of the message, right below the attachment list. The message to be forwarded will have links to download the attachments on the original message and, better, they don’t need to be scanned! :)

skip-antivirus.jpg

Categories: Uncategorized Tags:

Converting Rails Model attributes character encoding

February 13th, 2008 Dante Regis No comments

At work we have some legacy database on MySQL with ISO-8859-1 (latin1) encoding. I like to use UTF-8 on my apps, though, so I wanted to convert the data on the database to UTF8 before using on the app, and then back to ISO-8859-1 before saving on the database.

Fortunately, this nice guy, Tom Bak, on the ruby-forum, made a plugin to allow this type of conversion on the fly. It is not available for download here, since Wordpress.com blocks zip files, but stop by the forum and download it. While you are there, remember to say thanks to Tom Bak!

Thanks, Tom, great job!

Categories: Uncategorized Tags:

autotest keeps running continuosly even without changing any files?

December 21st, 2007 Dante Regis No comments

So, your autotest also keeps running over and over when your Rails code fails? Well, I had this issue here and found that the problem was that, when the tests were run, Ferret updated the index. So, autotest believed that files where changed when they weren’t. Googling a bit I found this code that you should put on your ~/.autotest :

Autotest.add_hook :run do |at|
  at.exceptions = /^(?:\.\/)?(?:db|index|doc|log|public|script|tmp|filestore|vendor\/rails)|\.svn|(?:.*_flymake\.rb$)/
end

If it does not work, try running autotest with “-v” option, to see which files have changed on autotest concern, and include the relevant directory on the list above.

Hope this helps you! :)

Categories: rails, ruby Tags:

Custom Humanize Column Names in Ruby on Rails

December 10th, 2007 Dante Regis 3 comments

Henrik, from The Pug Automatic, suggested a great way of having custom column names on the rails validation error messages, by rewriting the human_attribute_name of ActiveRecord. There’s an example on his blog (really worth a look and not only for this specific post) on how to do that. Beware that it uses a deprecated method of ActiveRecord, that may be removed in future versions of Rails (it is still there on Rails 2.0). The workaround is discussed there too on the comments: One could rewrite the humanize method of String – that would make changes global – or we can just ask politely for the core developers not to remove the method :) .

Here is an example of how to do that, I used it on an application of mine. On this case, the collumns on the database are in english, which I prefer working with when programming , but the users can barely read Portuguese, so I need to translate to them:

class Ticket < ActiveRecord::Base
  HUMANIZED_ATTRIBUTES = {
    :description => "Descrição",
    :category => "Categoria",
    :title => "Assunto"
  }

  def self.human_attribute_name(attr)
    HUMANIZED_ATTRIBUTES(attr.to_sym) || super
  end
end
Categories: Uncategorized Tags:

Console input on Ruby: Masking passwords on the command line

November 19th, 2007 Dante Regis 2 comments

I like plain old console applications. They are fast (to program, compile and use) and, of course, add a cool factor, like people saying they have absolutely no idea of what you are doing!

Ruby, of course, can do console apps, but it’s not trivial to read user input. And what if you want the user to type a password? You would like, of course, to show them asteriks ‘*’ or nothing at all instead of the plain text being typed.

Well, “highline” gem covers this and much more. What about writing:

ask("Enter your password:  " ) { |q| q.echo = "x" }

And that’s all! That’s quite cool, man. It can even check if the answer matches some regex, or split it by commas, or anything you want
Take a look at it: http://highline.rubyforge.org/

Categories: programming, ruby Tags:

Change Vim Swap (.swp) files default path

November 18th, 2007 Dante Regis 4 comments

I work with subversion as a version controller, and I’m a big fan of console. But it’s quite annoying to type a “svn status” and receive lots of question marks on something.swp or .sw0 . Other version control system probably suffer from this issue, unless they have recursive ignore (which, as far as I can tell, svn doesn’t)

Well, I just found Vim Tip #20, which teaches us how to change the folder path for swp files. This way, all swap files for Vim (and, of course, gVim) will be saved on the specified directory.

The comand is :

set directory=/path/to/dir,/path/to/another/dir

There is also “set backupdir=/path/to/dir” to move those something.rb~

Hope this helps you as much as it helped me!

Categories: howto Tags:

Writing code on wordpress.com

November 18th, 2007 Dante Regis No comments

We all know that you can install plugins on your own (hosted by you) wordpress.org blog. But on wordpress.com pasting code was always a lost battle. But you can now use the

[sourcecode language=`yyyy`] [/sourcecode]

tags on your blog. There’s a list of supported languages here: Wordpress.com FAQ .
Enjoy!

Categories: Uncategorized Tags:

VMWare, Linux and Wireless Networking

November 17th, 2007 Dante Regis No comments

We all know wireless network hardware builders don’t like Linux much. Or maybe it’s the other way around. Anyway, making it work is usually a hassle, and if you got here, probably VMWare network isn’t going any good for you.

The problem is that bridged networking on VMWare (the best one for home use) requires the host’s network card to enter promiscuous mode. It is not something most Linux drivers do. You have 2 options, then: find out a way to make your card promiscuous (dirty jokes goes here) OR you use NAT networking. Much less trouble, works fine for basic Internet, but maybe can’t be used in some situations.

If you are a normal user without special needs, just try NAT network for your VMWare when you are using wireless.

Categories: Uncategorized Tags:

Notebook HD problems with linux

November 17th, 2007 Dante Regis No comments

This post has alerted me of a big problem on laptop HDs that apparently happens to Linux users (according to other post from this same author, Vista has the same issue). It seems that the power-saving technologies keep telling the hard drive heads to sleep, while Linux keeps telling the drive to read or write something down. This wake-sleep-wake process consumes the life-time of the drivers to the point of failling hardware within an year.
The current workaround is to shutdown power management to hard disks with hdparm “hdparm -B 254 /dev/sda” (or /dev/hda, depending on your configuration).
More detailed info can be found on Ubuntu Bug at Launchpad.

Powered by ScribeFire.

Categories: linux Tags:

Custom Bitmap Background on OpenOffice Impress 2.x

September 28th, 2007 Dante Regis 17 comments

I was building my slides for a speak I’ll make on this Sunday when I came to such a disappointment with OpenOffice that I had to scream! And I was searching for the adequade place to do it when I remembered of my blog. So forgive me for any english mistakes, but this post is being written on the heat of emotion (anger, by the way).

Turns out that, if you want to define a custom background for your slide on OpenOffice Impress, you have to create a bitmap fill, then, go to the master slide, and then select the bitmap you created before, and then close the master slide. Can you imagine something less obvious to do? I mean, on PowerPoint, all you have to do is to right-click your slide and select “Change Background” or something like that. On the window that opens you choose for a bitmap, a gradient, a color whatever you want, and even choose if it will apply to all slides or not.

The model chosen by OpenOffice developers is absolutely pathetic. I’m sorry guys, you have made a GREAT software on the overrall, but this is exactly the kind of thing that blocks new users. How on earth would a normal user find out how to place a custom background? “Look on the help files” ? Two things: It’s not there, I looked. And if I, who work with computer and tech support for more than 10 years, looked and could not find, what would you say of the average end user (grand-ma)? Even if it is there, average end users DON’T look on the help files. They don’t know it exists. I’m serious. As I said, I work with tech support and you would be amazed the number of people to whom I’ve shown the help files and say “WOW! If I ever knew there was such a thing!”.

So, I’m not sorry for being angry, because it’s an absolutely ridiculous approach and I need to scream this aloud! MAKE IT SIMPLE FOR GOD’S SAKE! You’ll never beat MS Office working this way.

By the way, here is the procedure:

1) Go to Format / Area (Yes, believe me! We start going to “Format Area” )

2) Choose BITMAPS on the window and click the Import button

3) Name your imported bitmap

4) Go to View / Master / Slide Master (Shouldn’t it be Master Slide?)

5) Right click on a free area of the slide and go to Slide / Page Setup

6) On the background tab, choose bitmaps from the drop-down menu and select your previously created bitmap.

7) Find a way to tell OO developers that it is a terrible way to select a background.

Categories: Uncategorized Tags: