Saturday, December 7, 2013

Redmine: Calendar object creation



 <% @year ||= Date.today.year %> 
     <% @month ||= Date.today.month %>
   
     
      
    <% end %>
   
   <%@calendarLocal = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :week) %>

  <%=render :partial => 'common/calendar', :locals => {:calendar => @calendarLocal} %>

Redmine: Redirecting a link to project's calendar page





<%=  link_to project.name,project_path(project) << "/issues/calendar" %> 

Sunday, April 22, 2012

Solution : gem install minitest /usr/lib/ruby/gems/1.9.1/gems/turn-0.9.4/lib/turn/minitest.rb:23:in `': MiniTest v1.6.0 is out of date. (RuntimeError) `gem install minitest` and add `gem 'minitest' to you test helper.

My system info was like:
OS: Ubuntu 11.10
Ruby: version 1.9.2p290
Rails: version 3.1.1
Minitest gem: 2.12.1
I've had the following error when I tried to run the test command for my rails application.

rake test
The error message was like this: (Click on the image to read the text)



change the gemfile of the project and add the following lines:


group :test do
  gem "minitest"
end

Had a quite good test experience. 
Happy coding.

Friday, July 15, 2011

Setting up sensors in linux

Just install lm-sensors with this command:

sudo apt-get install lm-sensors


after installation use this command to get the status of the cpu:

sensors

Friday, July 8, 2011

Changing brightness from ubuntu terminal

Try this command:

setpci -s 00:02.0 F4.B=10

value of F4.B can be changed (my limit is 99)

Thursday, June 30, 2011

Easiest way to determine "Follow Set"

Consider the following grammar:

E = TE'
E' = +TE' | e
T = FT'
T' = *FT' | e
F = (E) | id

Here,
First( E ) = { ( , id }
First( E' ) = { + , e }
First( T ) = { ( , id }
First( T' ) = { * , e }
First( F ) = { ( , id }

So, to get the value of Follow (E) we have to pick any one of Es from the right side of the equation. E is in the right side only here F = (E)|id , here right side of E is ')' which is a terminal. So Follow set of E would be ')'. And E is first one to get so $ sign would be in the follow set.
So Follow(E) = { ) , $ }

Now we have to get the value of Follow (E'). At first we have to take any one of the equations from the list where E' is in the right side. Lets take E = TE'
Here right side of E' is empty. So the Follow set of E' would be the Follow set of E (left side of the equation)
So, Follow(E') = { ), $ }

Now it's time to get the value of Follow(T). We can take E = TE', where T is in the right ride of the equation. Here the right consecutive value of T is E' which is a non terminal. So, we have to add it's first set's element to its follow set, adn if the first set has the value 'e' (empty set), follow set of the non terminal residing in the left side of the equation has to be added, Here the first set of E' is {+,e}, so the follow set of T would be {+, Follow set of E} that means {+,),$}

To get the Follow set of T' We can take the equation T=FT' and T' has not any right consecutive value, so the follow set of T' would be the follow set of the left sided non terminal T. That is {+,),$}

Follow set of F can be determined from the relation T = FT'
Here right consecutive value of F is T' which is a nonterminal. So the follow set would be {first set of T', if First(T') contains e add follow set of T}
Therefore, Follow(F) = {*,+,),$}

Friday, November 26, 2010

Ruby on Mint ;)

Ruby develoment:

To create new application , install ruby and gem and webrick from apt with this command

sudo gem install rails

install sqlite3 and its dev file from apt.

then create a sample application,

rails create blog

cd blog

rails server

Here rails generate controller home index

To edit configuration go to

app/views/home/index.html.erb

give this command:

rm public/index.html

Now, you have to tell Rails where your actual home page is located. Open the file config/routes.rb in your editor. This is your application’s routing file which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions. This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with :root to, uncomment it and change it like the following:

Blog::Application.routes.draw do #... # You can have the root of your site routed with "root" # just remember to delete public/index.html. root :to => "home#index"

The root :to => "home#index" tells Rails to map the root action to the home controller’s index action.

Now if you navigate to http://localhost:3000 in your browser, you’ll see Hello, Rails!.

For routing add get part

Blog::Application.routes.draw do

get "say/hello"

get "say/goodbye"

get "home/index" receive