Sunday, March 7, 2010

Google Appengine and their free quota posibilities

For some time i was curious what are real posibilities of Google's service called App Engine. Google claims that free version of App Engine can handle up to 5 million page views a month!

Thinking about that i prepared super simple application under my-ip-address.appspot.com that shows you current IP address (smart huh?).

I wanted this application to be super simple but in some way it should be helpfull for people so they could recommend it to friends. In fact this is an experiment that allows me to check if Google's App Engine can really handle up to 5 million page views a month. Application is a "one request" page without any images that are fetched directly from it.

Next step is to hit 5 million page views a month! For now i created a facebook fan page of my-ip-address so go there and become a fan!

Friday, March 5, 2010

PHP 5.3.2 released

PHP in 5.3 branch is speeding up with development. New version (5.3.2) today with few (really few) security FIXES, sone updates of bundled libs and "couple" of other changes and bugfixes. Full changelog is here and for downloads go to here.

It's good that 5.3 branch is under heavy development as it should be rock stable when Symfony2 will be released at the and of year.

Wednesday, March 3, 2010

How to validate if user is submiting valid IBAN

Did you ever needed to get bank account number from user via browser? If YES there is a next question - IBAN numbers are 26 digits length, did you think how often users can do mistakes typing such long number?

Well...I did.

So after thinking about it I coded simple IBAN validator that calculates control sum of user input IBAN number. You can grab it for free here and usage is simple as pie (see bellow) so you shouldn't have any problems implementing that.

Tuesday, March 2, 2010

Simple and easy UML diagrams in notime

Today I found accidentally yUML. What is yUML? yUML is a fantastic and very powerful tool for presenting ideas to the UML diagrams.

yUML enables us in a very intuitive and friendly way to prepare nice diagrams for presentation purposes, fast forward vision at a distance, or simply create a graphical version of the algorithm.

Generated diagram in a simple way we can put on your website in the description of the wiki, or simply send an email or IM. All the data needed to generate the diagram, we pass as parameters in the URL, which draws a diagram in the form of a finished picture.

Below are few samples to show how easy and fun is yUML

Links like this http://yuml.me/diagram/scruffy/class/[Customer]->[Billing Address] produces simple association



We can also use cardinality (http://yuml.me/diagram/scruffy/class/[Customer]1-0..*[Address])


Notes (http://yuml.me/diagram/scruffy/class/[Customer]<>1->*[Order], [Customer]-[note: Aggregate Root{bg:cornsilk}])


Inheritance, Interface Inheritance, Dependencies, Interface, Class with Details and also some really complex diagrams



Check yourself how easy it is to use yUML in everyday programming problems:)

Saturday, February 13, 2010

managing multiple ruby versions

Being a developer means that you must have tons of software installed on your computer. Going further it means that you need to install multiple versions of the same software to test your applications. Which sometimes can be painful.

Well if you are ruby developer you just can make your life a bit easier with Ruby Version Manager (RVM). RVM is awesome tool developed by some smart guy (Wayne E. Seguin) to help managing multiple ruby versions on your local box and even more.
RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.
Bellow you can see how easy is to maintain several ruby versions on your work machine without breaking any system configuration.

Step 1 - install RVM
ts@aries:~$ mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && git clone git://github.com/wayneeseguin/rvm.git && cd rvm && ./install
Initialized empty Git repository in /home/ts/.rvm/src/rvm/.git/
remote: Counting objects: 8748, done.
remote: Compressing objects: 100% (2286/2286), done.
remote: Total 8748 (delta 5557), reused 8329 (delta 5265)
Receiving objects: 100% (8748/8748), 1.28 MiB | 1700 KiB/s, done.
Resolving deltas: 100% (5557/5557), done.

Installing rvm to /home/ts/.rvm/ ...

...
...

You must now finish the install manually:

1) Place the folowing line at the end of your shell's loading files(.bashrc and then .bash_profile for bash and .zshrc for zsh), after all path/variable settings:

     if [[ -s /home/ts/.rvm/scripts/rvm ]] ; then source /home/ts/.rvm/scripts/rvm ; fi

2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).

3) CLOSE THIS SHELL and open a new one in order to use rvm.
Step 2 - check what you have already installed on system
ts@aries:~$ rvm list

   system [ i386 ]

ts@aries:~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
Step 3 - list all ruby versions that you can install with RVM
ts@aries:~$ rvm list --all

(ruby-)1.8.0-tv1_8_0
(ruby-)1.8.0-tv1_8_0_preview1
(ruby-)1.8.0-tv1_8_0_preview2
(ruby-)1.8.0-tv1_8_0_preview3
(ruby-)1.8.0-tv1_8_0_preview4
(ruby-)1.8.0-tv1_8_0_preview5
(ruby-)1.8.0-tv1_8_0_preview6
(ruby-)1.8.0-tv1_8_0_preview7
(ruby-)1.8.1-tv1_8_1
(ruby-)1.8.1-tv1_8_1_preview1
(ruby-)1.8.1-tv1_8_1_preview2
(ruby-)1.8.1-tv1_8_1_preview3
(ruby-)1.8.1-tv1_8_1_preview4
(ruby-)1.8.2-tv1_8_2
(ruby-)1.8.2-tv1_8_2_preview1
(ruby-)1.8.2-tv1_8_2_preview2
(ruby-)1.8.2-tv1_8_2_preview3
(ruby-)1.8.2-tv1_8_2_preview4
(ruby-)1.8.3-tv1_8_3
(ruby-)1.8.3-tv1_8_3_preview1
(ruby-)1.8.3-tv1_8_3_preview2
(ruby-)1.8.3-tv1_8_3_preview3
(ruby-)1.8.4-tv1_8_4
(ruby-)1.8.4-tv1_8_4_preview1
(ruby-)1.8.4-tv1_8_4_preview2
(ruby-)1.8.5-tv1_8_5
(ruby-)1.8.5-tv1_8_5_11
(ruby-)1.8.5-tv1_8_5_113
(ruby-)1.8.5-tv1_8_5_114
(ruby-)1.8.5-tv1_8_5_115
(ruby-)1.8.5-tv1_8_5_12
(ruby-)1.8.5-tv1_8_5_2
(ruby-)1.8.5-tv1_8_5_231
(ruby-)1.8.5-tv1_8_5_35
(ruby-)1.8.5-tv1_8_5_52
(ruby-)1.8.5-tv1_8_5_preview1
(ruby-)1.8.5-tv1_8_5_preview2
(ruby-)1.8.5-tv1_8_5_preview3
(ruby-)1.8.5-tv1_8_5_preview4
(ruby-)1.8.5-tv1_8_5_preview5
(ruby-)1.8.6-tv1_8_6
(ruby-)1.8.6-tv1_8_6_110
(ruby-)1.8.6-tv1_8_6_111
(ruby-)1.8.6-tv1_8_6_114
(ruby-)1.8.6-tv1_8_6_230
(ruby-)1.8.6-tv1_8_6_286
(ruby-)1.8.6-tv1_8_6_287
(ruby-)1.8.6-tv1_8_6_36
(ruby-)1.8.6-tv1_8_6_368
(ruby-)1.8.6-tv1_8_6_369
(ruby-)1.8.6-tv1_8_6_383
(ruby-)1.8.6-tv1_8_6_388
(ruby-)1.8.6-tv1_8_6_398
(ruby-)1.8.6-tv1_8_6_preview1
(ruby-)1.8.6-tv1_8_6_preview2
(ruby-)1.8.6-tv1_8_6_preview3
(ruby-)1.8.7-tv1_8_7
(ruby-)1.8.7-tv1_8_7_160
(ruby-)1.8.7-tv1_8_7_17
(ruby-)1.8.7-tv1_8_7_173
(ruby-)1.8.7-tv1_8_7_174
(ruby-)1.8.7-tv1_8_7_22
(ruby-)1.8.7-tv1_8_7_248
(ruby-)1.8.7-tv1_8_7_249
(ruby-)1.8.7-tv1_8_7_71
(ruby-)1.8.7-tv1_8_7_72
(ruby-)1.8.7-tv1_8_7_preview1
(ruby-)1.8.7-tv1_8_7_preview2
(ruby-)1.8.7-tv1_8_7_preview3
(ruby-)1.8.7-tv1_8_7_preview4
(ruby-)1.9.0-tv1_9_0_0
(ruby-)1.9.0-tv1_9_0_1
(ruby-)1.9.0-tv1_9_0_2
(ruby-)1.9.0-tv1_9_0_3
(ruby-)1.9.0-tv1_9_0_4
(ruby-)1.9.0-tv1_9_0_5
(ruby-)1.9.1-tv1_9_1_0
(ruby-)1.9.1-tv1_9_1_126
(ruby-)1.9.1-tv1_9_1_127
(ruby-)1.9.1-tv1_9_1_128
(ruby-)1.9.1-tv1_9_1_129
(ruby-)1.9.1-tv1_9_1_243
(ruby-)1.9.1-tv1_9_1_376
(ruby-)1.9.1-tv1_9_1_378
(ruby-)1.9.1-tv1_9_1_preview1
(ruby-)1.9.1-tv1_9_1_preview2
(ruby-)1.9.1-tv1_9_1_rc1
(ruby-)1.9.1-tv1_9_1_rc2
(ruby-)1.9.2-tv1_9_2_preview1
(ruby-)1.9.2-tv1_9_2_preview2
(ruby-)1.8.6(-p383)
(ruby-)1.8.6-head
(ruby-)1.8.7(-p248)
(ruby-)1.8.7-head
(ruby-)1.9.1(-p243)
(ruby-)1.9.1(-p376)
(ruby-)1.9.1-head
(ruby-)1.9.2-preview1
jruby-1.2.0
jruby-1.3.0
jruby-1.3.1
jruby(-1.4.0) # the default
jruby-head
rbx(-prc1) # default
rbx-head
ree-1.8.6
ree(-1.8.7) # the default
ree-1.8.6-head
ree-1.8.7-head
maglev(-22725)
mput(-head) # shyouhei head, the default mput
ironruby-0.9.3 # (1.0 RC1)
ironruby-head
quite nice :)

Step 4 - install some rubies!
ts@aries:~$ rvm install 1.8.7

Installing Ruby from source to: /home/ts/.rvm/rubies/ruby-1.8.7-p249
Downloading ruby-1.8.7-p249, this may take a while depending on your connection...
Extracting ruby-1.8.7-p249 ...
Configuring ruby-1.8.7-p249, this may take a while depending on your cpu(s)...
Compiling ruby-1.8.7-p249, this may take a while, depending on your cpu(s)...
Installing ruby-1.8.7-p249
Installation of ruby-1.8.7-p249 is complete.
Installing rubygems dedicated to ruby-1.8.7-p249...
Retrieving rubygems-1.3.5
Extracting rubygems-1.3.5 ...
Installing rubygems for /home/ts/.rvm/rubies/ruby-1.8.7-p249/bin/ruby
Installation of rubygems ruby-1.8.7-p249 completed successfully.
Installing gems for ruby-1.8.7-p249.
Installing rake
Installation of gems for ruby-1.8.7-p249 is complete.

ts@aries:~$ rvm install 1.9.1

Installing Ruby from source to: /home/ts/.rvm/rubies/ruby-1.9.1-p378
Downloading ruby-1.9.1-p378, this may take a while depending on your connection...
Extracting ruby-1.9.1-p378 ...
Configuring ruby-1.9.1-p378, this may take a while depending on your cpu(s)...
Compiling ruby-1.9.1-p378, this may take a while, depending on your cpu(s)...
Installing ruby-1.9.1-p378
Installation of ruby-1.9.1-p378 is complete.
Updating rubygems for ruby-1.9.1-p378
Installing gems for ruby-1.9.1-p378.
Installing rake
Installation of gems for ruby-1.9.1-p378 is complete.

ts@aries:~$ rvm install 1.8.6

Installing Ruby from source to: /home/ts/.rvm/rubies/ruby-1.8.6-p398
Downloading ruby-1.8.6-p398, this may take a while depending on your connection...
Extracting ruby-1.8.6-p398 ...
Configuring ruby-1.8.6-p398, this may take a while depending on your cpu(s)...
Compiling ruby-1.8.6-p398, this may take a while, depending on your cpu(s)...
Installing ruby-1.8.6-p398
Installation of ruby-1.8.6-p398 is complete.
Installing rubygems dedicated to ruby-1.8.6-p398...
Installing rubygems for /home/ts/.rvm/rubies/ruby-1.8.6-p398/bin/ruby
Installation of rubygems ruby-1.8.6-p398 completed successfully.
Installing gems for ruby-1.8.6-p398.
Installing rake
Installation of gems for ruby-1.8.6-p398 is complete.
Final step - go play with multiple ruby versions without any problems :)
ts@aries:~$ rvm list

   ruby-1.8.6-p398 [ i386 ]
   ruby-1.8.7-p249 [ i386 ]
   ruby-1.9.1-p378 [ i386 ]
   system [ i386 ]

ts@aries:~$ rvm 1.8.6
ts@aries:~$ ruby -v
ruby 1.8.6 (2010-02-04 patchlevel 398) [i686-linux]

ts@aries:~$ rvm system
ts@aries:~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]

ts@aries:~$ rvm 1.8.7
ts@aries:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]

ts@aries:~$ rvm 1.9.1
ts@aries:~$ ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
Easy? Right! Programming should be easy :)