Perl weirdness 2010#001

Perl keeps impressing me (negatively) with weird stuff such as implicit context and so on....

but that one is really out of the ordinary...

prompt~/ perl 
print "-------\n\n";
my $x = 'hostname1.foo.net';
$x->{'datacenter'} ||= '__';
use Data::Dumper; 
print Dumper $x;
print "x".$x->{'datacenter'}."x\n";
my $y = 'hostname1.foo.neT';
print "y".$y->{'datacenter'}."y\n";
my $z = 'hostname1.foo.net';
print "z".$z->{'datacenter'}."z\n";
-------

$VAR1 = 'hostname1.foo.net';
x__x
yy
z__z
prompt~/ 

first, I thought calling ->{} on a scalar/string would crash. to my surprise, my program passed. so I wrote this test only to learning something even crazier about perl. couldn't this be a security issue?

Posted in , , , , | Posted on 30 Mar 2010 14:11by somekool | 2 comments

my Blog is back up !!!!

After several server "hick ups" my blog is now back online ! Well, it never got offline, but dreamhost is not so generous on RAM and my blog was asking for more and more, thus I had to move it. I still think dreamhost is a nice place for hosting your stuff but I am sure you know that, at some point, you might need something more dedicated to your business... So my blog is now running on my own server, I also upgraded it to the latest typo (from 4.0.3 to 5.4.1) and it feels good to be able to type here again without fearing crashes....

And just so reading this is not entirely a waste of time, here is for your viewing pleasure one of my favorite Internet classic video....  

 

 

Posted in , , , , , | Posted on 28 Mar 2010 21:41by somekool | 1 comment

my Blog is back up !!!!

After several server "hick ups" my blog is now back online ! Well, it never got offline, but dreamhost is not so generous on RAM and my blog was asking for more and more, thus I had to move it. I still think dreamhost is a nice place for hosting your stuff but I am sure you know that, at some point, you might need something more dedicated to your business... So my blog is now running on my own server, I also upgraded it to the latest typo (from 4.0.3 to 5.4.1) and it feels good to be able to type here again without fearing crashes....

And just so reading this is not entirely a waste of time, here is for your viewing pleasure one of my favorite Internet classic video....  

 

 

Posted in , , , , , | Posted on 28 Mar 2010 21:41by somekool | 1 comment

dont know what svn revision to restore?

I simply fell on that blog post and wanted to reply to the comment asking how to find out which version to copy....

but I could not reply... unfortunately so I am posting it here for my own selfish joy....

Q: Steve Wick said 24 days later:

How do you know what revision number to restore?

A: Mathieu Jobin

a sapient process is required to decide which version. a good guess is the one just before the delete. if the svn removal was committed on -r1235, then -r1234 is the one to restore. in some circumstance you might want an even earlier version. physics laws on file removal and temporal continuum states you might not be able to restore at a later revision due to nonexistence of matter.

kind regards,

Posted in | Posted on 10 Dec 2009 08:24by somekool | no comments

How to make Rails ActiveRecord::Migration default to MyISAM

Some people perfer InnoDB, other MyISAM. This post ain't about a MySQL-Engine flame war but about letting people choice.

Fact is, the excellent Migration system shipped with rubyonrails and ActiveRecord is defaulting to InnoDB. The doc shows how you can specify the engine on each create_table statement. but then your migration are mysql-only because these engine options will not be supported by sqlite or MSSQL. and I dont want to copy/paste these options to all of my create table. I want to change the default.

unfortunately Rails supply no options for it

fortunately Rails is built on Ruby.

so you can simply overwrite the proper method by adding it to your config/environment.rb

module ActiveRecord
        module ConnectionAdapters
                class MysqlAdapter < AbstractAdapter
                        def create_table(table_name, options = {}) #:nodoc:
                                super(table_name, options.reverse_merge(:options => "ENGINE=MyISAM"))
                        end
                end
        end
end

Tags , , , , , , , , ,

Posted in , , | Posted on 08 Apr 2009 13:56by somekool | no comments

it feels good to get rid of useless stuff

real good

[somekool@rockinTV ~]$ sudo pacman -R gail libgnomecanvas ruby-gnomecanvas \
                                     libbonobouiruby-gnome2 libgnomeui nautilus-cd-burner \
                                     gnome-python gnome-media rhythmbox
checking dependencies...
( 1/10) removing rhythmbox                          [########################################] 100%
( 2/10) removing gnome-media                        [########################################] 100%
( 3/10) removing gnome-python                       [########################################] 100%
( 4/10) removing nautilus-cd-burner                 [########################################] 100%
( 5/10) removing ruby-gnome2                        [########################################] 100%
( 6/10) removing libgnomeui                         [########################################] 100%
( 7/10) removing libbonoboui                        [########################################] 100%
( 8/10) removing ruby-gnomecanvas                   [########################################] 100%
( 9/10) removing libgnomecanvas                     [########################################] 100%
(10/10) removing gail                               [########################################] 100%
[somekool@rockinTV ~]$

Posted in , , , | Posted on 26 Oct 2008 08:13by somekool | no comments

Firefox taking 1 gigabyte of ram

well, I must admit, it rarely pass 150MB in normal circumstance... I just thought it would be fun to push it further up. I could have waited more but I was tired. As funny as it may sound, my 2GB ram WinXP system did not suffer too much from it. Eventually I should try to max up the ram entirely see what would happen.

firefox taking 1GB of ram

Posted in , , | Posted on 30 Jan 2008 07:43by somekool | 3 comments

Collections of great links from today.

and a copy paste from a Facebook update from the Green Party of Canada.

Breaking News: Greens are Canada's new third party! 2:58am Wednesday, Nov 14, 2007

Dear Friends,

Today is a historic first for the Green Party of Canada.

Today, for the first time in our 24-year history, we are polling as one of Canada's top three parties in a national survey of voter intentions.

The Green Party is nationally in third place. We can win seats. You can help us do it.

The latest Strategic Counsel survey for the Globe and Mail/CTV News shows that the Green Party with 13% has overtaken both the NDP (12%) and the Bloc Quebecois (11%) for the first time ever. Also, Green support in the west now stands at a strong 18%, ahead of the fourth-place NDP (16%).

We must ask for Canadians' help to ensure that Elizabeth May is in the nationally televised leaders' debates. If Elizabeth is in the debates, there is no doubt in my mind that we will elect Green MPs.

[The Green Party has never won any seats in Canada (federally or provincially), nor has the Green Party been included in any televised debates... yet]

Visit the group for more info. :)

Posted in , , , | Posted on 19 Jan 2008 09:07by somekool | no comments

Trouble shooting the internet : part #<no count available>

Hey everybody.

I was at my friends place tonight. and we had sort of a geek night. we both work in <insert computer related fields here> and ... well anyway... we've got some trouble making his inboard sata raid controller working and I ended up on that website relating to a similar problem.

"Via VT8237 Serial ATA BIOS Setting Utility V 2.10

Scan Devices Please Wait!
Press <Tab> key into user window!

(Tab doesn't work BTW)

Hardware Initiate Failed Please Check the Device!!!
The BIOS does not be installed. Press <g> to continue"

the original question of the thread was that pressing TAB when the raid controller was asking us to would simply do nothing. and tonight. my friend figured out that the bios simply had PS2 support disabled. Microsoft Windows (the OS I respect very much hahahaha) is later on adding his own PS2 support so the BIOS did not need to support the keyboard device ... Until you really need it. mouhahaha.

Tags , , , , , , , , , , , , ,

Posted in , | Posted on 19 Jan 2008 01:27by somekool | no comments

great facebook application

I just found a great application on facebook which display pretty much everything there is to show about my ipod usage.

last played, last added, most played, artists, songs, etc. everything.

unfortunately, because it is a great application and well done, it will hardly become popular. why? because it is so good. There is no ads and it does not let you spread it like a facebook virus.

and its the one application I wish would spread over facebook like a virus.

have a look

by the way,... We are humans not numbers but I am Mr. #622940633.

Tags ,

Posted in , | Posted on 24 Nov 2007 13:20by somekool | no comments

Personal Links

Categories

Archives

Tags

Subscribe

Important Links

Green Web Hosting! This site hosted by DreamHost.

Related advertising

Copyright © Mathieu Jobin's Life and Thoughts

Tech Blue designed by Hive Designs • Ported by Free WordPress Themes and Frédéric de Villamil Powered by Typo