- download rakudo perl6 src from git
- perl Configure.pl –prefix=<DIR> –gen-nqp –gen-parrot
<DIR> directory where you want to push the binaries of perl6
It will avoid clash with existing Perl version running in system
After command executed successfully check prefix dir, it should show following dir’s
drwxr-xr-x 3 root staff 102 Apr 29 23:06 share
drwxr-xr-x 3 root staff 102 Apr 29 23:06 include
drwxr-xr-x 6 root staff 204 Apr 29 23:06 lib
drwxr-xr-x 3 root staff 102 Apr 29 23:06 src
drwxr-xr-x 14 root staff 476 Apr 29 23:08 bin
- make rakudo-testAll tests successful.
Files=23, Tests=227, 15 wallclock secs ( 0.09 usr 0.06 sys + 11.54 cusr 2.86 csys = 14.55 CPU)
- make rakudo-spectest
- make install
Today I am going to share my very first experience with RubyOnRails, and to describe my feelings its fabulous.
What you need to know already?
- You should be familiar with any MVC pattern
- Should have knowledge of Ruby
- Should know DB & Web server fundamentals
I guess thats more then enough to begin rails journey.
To start with you need following software installed on your box, 🙂 I ma LILO fan so all below configuration and are Linux based. But based on this understanding one can quickly start writing on any other OS too.
- ruby 1.8.4
- rails 1.2.3
Once installation and configuration done
add your db credential
script/generate migration add_formelements
> create db/migrate
> create db/migrate/001_add_formelements.rb
class AddUsers < ActiveRecord::Migration
create_table “formelements” do |t|
t.column “user”, :string
t.column “email”, :string
t.column “password”, :string
t.column “passordreminder”, :text
== AddUsers: migrating ========================================================
== AddUsers: migrated (0.0236s) ===============================================
script/generate scaffold Formelement
That’s all enjoy!
Hope you have grate time doing above exercise.
Check this out http://tryruby.hobix.com/
JAVA Design Pattern
The design patten is a vast subject, I will be giving you an head start here
Gang of Four – widely used design patterns
- Behavioral patterns
- Chain of responsibility
- Template method
- Creational patterns
- Abstract factory
- Factory method
- Structural patterns
Definition:- Common Problem and Common Solution for them, If you have data with problem and to tackle that you need to find problem pattern and propose solution pattern for that.
Note: No body owns the design pattern
Standard pattern are 23 those are listed above.
J2EE design pattern standardize by sun
- Intercepting Filter (apache mod rewrite)
- Composite View
- Front Controller
- Service to worker
- Business delegate
- Service Locater
- Transfer object assembler
An entity bean is representation of single row in a databases. Entity always be an heavy component. But the connectivity to database will be a transparent to developer. When you create a new entity bean automatically in database new row will be added.
ORM – Object Relational Mapping, row in a table will be one object in memory.
Stateless Session Bean can have pooled creation.
Statefull Session Bean can have cached creation.
But Entity bean can have either cache or pooled creation.
Whenever you need to work with processed or in other words process matters over data you should use session bean. But whenever you want to work with DATA or in other words DATA matters over process you should use entity beans.
Entity beans are heavy object because its a in memory object for database table. Where each instance of entity bean object refer to one record set in table or row in table.
Entity beans are of two types
Bean Managed Persistence
Container Managed Persistence
Favourite topic WSAD entity bean example 🙂 without writing a single line of code get the entity bean in place here we go
- Create new project EntityBean
- Create new Enterprise bean
- Select Type Entity bean
- Select CMP bean 2.0
- Bean detail select Remote & Local both the interfaces
- Select the project
- Run the Entity bean on server
- Configure new Test Server or run on existing server
- Create table and deploy entity bean
- It will show success message, i.e. it will test the create and alter statement on newly created table.
- Select server client local
- It will open Test Client
- Click on EntityExampleLocal
- Click on CMPLocal.findByPrimaryKey
- Enter value into and click invoke.
This how you will be testing tyour entity beans. Just now what we have seen is the Top to Bottom appoch, we have another approach which is Bottom to Top where in we will be having table already existing in and then will be creating the entity bean accordingly.
-EJB can be accessed using servlet
-Entity Bean should not be remote
-Session Bean should not be local
-In entity bean you should not use primitive data-type.
sCOPE oRGANIZATION wIDE
Controller = SERVLET
Why should we go for EJB?
Scalability (application should work same for 2 client and 2 million client.)
Should be catering to multiple request simulatanously.
Problem with the thread is Sycronization.
EJB CONTANER, will work on instance pooling and multiple instance.
to enable tansaction, first step is to make the autocomit off.
set autocommit flase applicable to the JVM where this property is set.
focus should be buisness logic, let transaction manage by somebody so this will be managed by CTM (container transaction management)
Web server & application server
Application server is super set of web server. In other words web server can be one component in application server.
Main diffrence will be application server is aware of its surroundings.
- Application control
- Infrastructural Capability
Application Server Main Properties
- Transaction management
Enterprise Level Application
EJB can be deploy only on Application Server. Used for scalable problems.
MESSAGE BEANS: asyncronous communication
If you need to generalizes something you make implementation and every one will write interface for it.
EJB distributed component need security any request comes in from cinet has to be checked.
EJB Contaner will decide whether to provide you access or not.
Per bean there will be one instance object.
Rule of thumb: One client one bean one instance will be always true.
Types of Bean
- Session Bean
- Stateless bean
- Statefull bean
- Enttyty Bean
- CMP – Container Managed Persistence
- BMP – Bean Managed Persistence
- Message Driven Bean (MBD) – Asyncronous beans
what to used and when to use
Dealing with process, Its a temporary or volatile.
Stateless-Session bean without any instance variables. i.e. processed are not dependent on each other. Example could be Controlling Mechenism
Statefull-Session bean with instance variable i.e.
Dealing with DBMS or Data
EJB FrameworkEJB framework Session Facade (Mean entry point.)
Creating session bean from Web Sphear Application Development.
EJB Module -> Project -> EJB -> Create 2.0 EJB -> Project Name -> Module Deps -> Finish
Reflection & Retropection
Runtime can find out class and charachterstics
Call back method
Calles when an event occurs.
Thoughts on java
Java in not 100% OO?
1) Static classes, does not require instance to acces its charachterstics.
2) Reperesantation of real world entity without charachterstic is not possible. But we can create java class without any class variables.
Real world entity properties create class.
Coupling and Cohesion Software Engineering.