I attended a 2 day course on RoR during the Good Friday weekend. It was a beginners course.
RoR has a lot of "magic" moments when you just click a few buttons and 'viola', it spews out a shiny new web application for you. Nothing hard core though as the "scaffolding" as it is called is only good for the very basic CRUD web apps.
On the other hand, I found very little information available on the net that could explain what was happening under the hoods. It is possible that I did not look in the right places, though.
I am now practicing the concepts by creating a simple effort tracking web application in my free time.
---
Friday, May 15, 2009
Wednesday, April 22, 2009
Beware of ls --color on Unix
I ran into a ver interesting problem today.
I was trying to redirect the output of the 'ls' command to a file.
$ ls
1.dat 2.dat 3.dat
$ ls > log
To my surprise the output file contained lots of 'special' characters'.
$ vi log
^[[00m^[[00m1.dat^[[00m^
[[00m2.dat^[[00m^
[[00m3.dat^[[00m^
[[00mlog^[[00m^[[m
This was giving several errors in some other process that was using this file.
After spending an hour on this problem, I figured out that the culprit was an 'alias' that had mapped 'ls' to 'ls --color'. This had caused the output to contain the escape sequences for colors.
The problem got resolved by unaliasing with 'unalias ls'.
I was trying to redirect the output of the 'ls' command to a file.
$ ls
1.dat 2.dat 3.dat
$ ls > log
To my surprise the output file contained lots of 'special' characters'.
$ vi log
^[[00m^[[00m1.dat^[[00m^
[[00m2.dat^[[00m^
[[00m3.dat^[[00m^
[[00mlog^[[00m^[[m
This was giving several errors in some other process that was using this file.
After spending an hour on this problem, I figured out that the culprit was an 'alias' that had mapped 'ls' to 'ls --color'. This had caused the output to contain the escape sequences for colors.
The problem got resolved by unaliasing with 'unalias ls'.
Friday, April 3, 2009
Java is verbose
While I had read and heard this several times, I never really understood till today what it meant when people said Java was verbose.
Today, for the first time, I accept the veracity of this sad fact. Java is indeed very verbose; specially when compared to new languages. Suddenly I can see how most of the code I write in java can be avoided.
Today, for the first time, I accept the veracity of this sad fact. Java is indeed very verbose; specially when compared to new languages. Suddenly I can see how most of the code I write in java can be avoided.
Job ad trap
Read this in a job ad recently.
You may occasionally need to be on calls....some weekend work on production releases may be required , but no actual shift work.
Take my advice. Don't fall into this trap. Not only will you work extra hours, you will not get compensated for it either. Negotiate for shift job.
Monday, March 16, 2009
Random thoughts
Epic Fail
Heard someone use the word 'Rightsizing' while referring to the lay offs. Yuck!!
Privacy
I wonder if it's possible to maintain privacy while trying to run a successful small web based business?
New language
I decided to learn Scala and JavaFx. Having struggled with learning a new programming language many times in the past, I realized that my problem is that for a second language, I need a top-down approach instead of the bottom-up approach most programming books offer. Before I learn the dirty details of the syntax, I must grasp the big picture. I want to know how a language compares to Java which is my primary programming language. It is important for me to understand how a new language "does things" before I start learning the syntax. So I have decided to skim through the Scala book first without writing even a single line of code. I'll then give the book another read, this time for the syntax and other granular details. I think it is a good way to learn a second/third language.
As for JavaFx, I am using the online course at www.javapassion.com.
Architects
The real reason why we need architects is that in many places (specially big organizations), programmers are not considered important or worthy enough to take any high level design decisions. Having an architect ensures that such decisions are at least coming from someone who has a technical background and experience required to make such decisions. Otherwise, such decisions are left in the hands of inept Project Managers. If there is an architect, project managers usually don’t poke their nose into technical discussions or decision making and leave it to the architect.
Heard someone use the word 'Rightsizing' while referring to the lay offs. Yuck!!
Privacy
I wonder if it's possible to maintain privacy while trying to run a successful small web based business?
New language
I decided to learn Scala and JavaFx. Having struggled with learning a new programming language many times in the past, I realized that my problem is that for a second language, I need a top-down approach instead of the bottom-up approach most programming books offer. Before I learn the dirty details of the syntax, I must grasp the big picture. I want to know how a language compares to Java which is my primary programming language. It is important for me to understand how a new language "does things" before I start learning the syntax. So I have decided to skim through the Scala book first without writing even a single line of code. I'll then give the book another read, this time for the syntax and other granular details. I think it is a good way to learn a second/third language.
As for JavaFx, I am using the online course at www.javapassion.com.
Architects
The real reason why we need architects is that in many places (specially big organizations), programmers are not considered important or worthy enough to take any high level design decisions. Having an architect ensures that such decisions are at least coming from someone who has a technical background and experience required to make such decisions. Otherwise, such decisions are left in the hands of inept Project Managers. If there is an architect, project managers usually don’t poke their nose into technical discussions or decision making and leave it to the architect.
Wednesday, November 12, 2008
Programming Problem 1 - Train Times
The Problem
City transportation planners are developing a light rail transit system to carry commuters between the suburbs and the downtown area. Part of their task includes scheduling trains on different routes between the outermost stations and the metro center hub.
Part of the planning process consists of a simple simulation of train travel. A simulation consists of a series of scenarios in which two trains, one starting at the metro center and one starting at the outermost station of the same route, travel toward each other along the route. The transportation planners want to find out where and when the two trains meet. You are to write a program to determine those results.
This model of train travel is necessarily simplified. All scenarios are based on the following assumptions:
- All trains spend a fixed amount of time at each station.
- All trains accelerate and decelerate at the same constant rate. All trains have the same maximum possible velocity.
- When a train leaves a station, it accelerates (at a constant rate) until it reaches its maximum velocity. It remains at that maximum velocity until it begins to decelerate (at the same constant rate) as it approaches the next station. Trains leave stations with an initial velocity of zero (0.0) and they arrive at stations with terminal velocity zero. Adjacent stations on each route are far enough apart to allow a train to accelerate to its maximum velocity before beginning to decelerate.
- Both trains in each scenario make their initial departure at the same time.
- There are at most 31 stations along any route.
- The meeting time of both trains will never be at the departure of one of the trains from a station.
Input
All input values are real numbers. Data for each scenario are in the following format:
d1 d2...dn 0.0
For a single route, the list of distances (in miles - there are 5,280 feet in a mile) from each station to the metro centre hub, separated by one or more spaces. Stations are listed in ascending order, starting with the station closest to the metro centre hub (station 1) and continuing to the outermost station. All distances are greater than zero. The list is terminated by the sentinel value 0.0.
v
The maximum train velocity, in feet/minute.
s
The constant train acceleration rate in feet/minute2.
m
The number of minutes a train stays in a station.
The series of runs is terminated by a data set which begins with the number -1.0.
Output
For each scenario, the program should determine the following:
- The number of the scenario (numbered consecutively, starting with Scenario #1).
- The time when the two trains meet in terms of minutes from starting time. All times must be displayed to one decimal place. Also, if the trains meet in a station, the station number where they meet.
- The distance in miles between the metro centre hub and the place where the two trains meet. Distances must be displayed to three decimal places.
Sample Input
15.0 0.0
5280.0
10560.0
5.0
3.5 7.0 0.0
5280.0
10560.0
2.0
3.4 7.0 0.0
5280.0
10560.0
2.0
-1.0
Sample output
Scenario #1:
Meeting time: 7.8 minutes
Meeting distance: 7.500 miles from metro centre hub
Scenario #2:
Meeting time: 4.0 minutes
Meeting distance: 3.500 miles from metro centre hub, in station 1
Scenario #3:
Meeting time: 4.1 minutes
Meeting distance: 3.400 miles from metro centre hub, in station 1
Tuesday, November 11, 2008
SpringSource acquires G2One
SpringSource acquires G2One - the company behind Groovy and Grails. I hope it augurs well for Groovy and helps in more shops adopting it for commercial development.
Subscribe to:
Posts (Atom)