Threads and Synchronization in Ruby..!

Ruby No Comments »

I was just free this weekend,so just gotta a chance and dropped myself with a little program on threads and synchronization in ruby.This program  generates a secret number which is implemented as sync_server_thread on the server side and then assigns the same variable on the the client side.

In this program , I took care of things like mutual exclusion and deadlocks.In the very first line I am requiring thread class and creating a new object for Mutex(a class which handles stuff related to mutual exclusion of threads), a instance of condition variable (a condition variable is a semaphore which is mainly used in accordance with mutex class,its main purpose is to take of processes in the critical section which are stuck in themselves while waiting for some external resources like non ruby programs).The sync_var_1 and sync_var_2 are local variables which will contain the secret number that will be generated at the server side and will be assigned to the client side program.

The first thread is the server side which runs on the server side and is responsible for generating the secret number on the server side. In The server side thread we can see that the condition variable sync_prevention.wait, there is no such implication on the presence of this statement in the program,but I have actually kept it if in case we include any functionality in the program which generally calls some external program to run as a part of the thread for example if I use a third party secret number generator for generating a secure secret number which may take a ample of time to generate the secret number.The wait method of condition variable generally tends to release the current thread under mutex and  re invokes that process later when the external program has responded.

Similarly in the second thread, the signal method of the condition variable tends to wake up the first thread waiting for the external resource.By doing this, we can maintain a balance of load on the server where multiple requests for generating the secret number.

The join method is one of the coolest and a must use method in the Thread class,I call it a must use method because when a ruby program containing some code related to thread runs,All the threads creating during the course of execution of the program will and must be killed once the program exits out of its execution.So To make sure that these threads complete at their whole, we use the associate them the join method.And finally the sync_diff is make sure that the same values at the server as well as the client remain intact at any point of time and the difference between them should always be zero.

 There are some implcations in the existing program, that the client and server run on the same file. In my coming posts you will see that the

the server thread runs under the server enviornment like webbrick or mongrel or may be a backgroundDRB…!…and the client thread will be running as a controller process in case of our rails app and will be synchronized with the server’s secret value.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Book.mark.hu
  • co.mments
  • Technorati
  • YahooMyWeb
  • IndianPad
  • DZone

Climb And Hack The Firewall

Hacking 1 Comment »

Climb And Hack The Firewall 

Have You ever wondered about how to bypass firewall which blocks your favourites sites and presents before you some dummy page saying  “This Page Is Blocked under the category  “FUN/HUMOUR”. Then here I present before you a work around to climb over the firewall and access your favourite site. 

Just download the web browser called Operator which is nothing but a mixing of Opera (A Web Browser) and TOR(keeps to anonymous when online) 

http://archetwist.com/opera/operator 

A operator plug-in for Mozilla firefox is also available for download 

https://addons.mozilla.org/en-US/firefox/addon/4106 

You can just download the setup of operator from the below link 

The operator ships along with Privoxy and proxy based system which will trick your firewall in a very simple way. 

When you start the operator you will see a blue icon with a “P” alphabet in the group of tray icons in your taskbar. 

What operator actually does is it relays all the http traffic over port 8118 which is set to default rather then the standard port 8080, along with proxy url internally generated by privoxy and your dear admin tends to put the firewall rules on this port.So,this is how it goes and  how operator allows you to access your favourite sites and keeps you happy. 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Book.mark.hu
  • co.mments
  • Technorati
  • YahooMyWeb
  • IndianPad
  • DZone

The Rails Song..!

Fun On Rails No Comments »

Presenting before you the “The Rails Song”…

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Book.mark.hu
  • co.mments
  • Technorati
  • YahooMyWeb
  • IndianPad
  • DZone

Rails KeyNotes By DHH

Rails Videos No Comments »

Poested below are a few keynotes On Rails by David Heinemer Hansson during RailsConf in Europe

 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Book.mark.hu
  • co.mments
  • Technorati
  • YahooMyWeb
  • IndianPad
  • DZone

If Not Agile Then Project Goes Fragile

Rails Articles 1 Comment »

As my post name “If Not Agile Then Project Fragile” itself tells us that what will happen to your project if its not agile and will also tell us that what will happen if it goes agile.

Whats Agility??????

 Agile also called as Agility is the ability to change the body’s position, and requires a combination of balance, coordination speed, reflexes , and strength as so is the case when you think that body to be you own “Project”. The Agile Software development provides a backbone or a scaffold for a software engineering process that promotes software developments in a set of “Iterations”.

Each iteration is an entire software project: including planning, requirement analysis, design, coding, testing, and documentation.For a better understanding, I can say that an Iteration is nothing but a “small plan” , towards which the team works in a best possible time to achieve it.And Once the things are done the whole team  sits back to evaluate on what they have done and whats next…!

 What Do We Need To Do Go Agile….??????

To become a Agile Evangelist like me communicate more about your project with your team friends rather then making exemplery docs which generally waste your time.But, Agile method generally tend to provide you with a minimum of documentation with respect to your project.You people can work in some kind of fresh open place whcih I generally refer to as a bullpen.I work with my client ,my team mates, the testers so that everybody hads a common understanding of the issue and how are we supposed to be dealing with it.

Note:The below link will take you Agile manifesto which is nothing but like a prayer to the “God Agile”

         http://agilemanifesto.org/

 How Do I Make The My Project Go Agile…?????

 There are various methodologies using which you can make your project go Agile…!..They are

Scrum (1986), Crystal Clear, Extreme Programming (1996), Adaptive Software Development, Feature Driven Development, and DSDM(1995).

 Agile methods are a family of development processes, not a single approach to software development.

From a project perspective , agile methods come into play when the client or the customer need tha product at an emergency, along with a rapid intermediate changes been applied to the product.The agile method is also used for project with longer lifelines and these projects are seem to scale in a cool manner where in each programming guy gets the a quick feed back of what he has done as per the chnges asked by the client and also also tends to workout with any discrepancies found while the project is in progress.

I also believe that the vertical stack describing the life cycle of a waterfall model or the genearlly called traditional software development model now goes horizontal when pushed into the agile methodologies hence making the development up to date and faster for each iteration.

Also before we actually get our feets wet in this methodologies we also need to aslo need to take care of the factors that an important role whcile the project is been setup:

The culture of the organization must be supportive of negotiation People must be trusted Fewer staff, with higher levels of competency Organizations must live with the decisions developers make Organizations need to have an environment that facilitates rapid communication between team members

Can My Underground Data Be Agile….????

I was a little confused when I thought about this but I finally found that agile practices tend to use techinques like generative data model to keep up your project reflexive irrespective of the databse changes.Like in Rails, we achieve this through what we call as the database migration which allows us for rapid database changes and maintaining the reflexivity of the project(code execution) on the other side.But, some caveats lie if in case your database has complex relational mappings between them and can serve to be a blockage points for your project,to overcome this if you build your relational mappings keeping in mind the agility of your project then you can ensure yourself that your project goes maintains the reliablilty and it transperancy with the DB changes through out its lifecycle.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • Book.mark.hu
  • co.mments
  • Technorati
  • YahooMyWeb
  • IndianPad
  • DZone

WordPress Theme & Icons by N.Design Studio. Packaged by Edublogs - education blogs.
Entries RSS Comments RSS Login