Translate

Saturday, August 4, 2012

Forensic Engineering – A probe into what the country should produce as Materials Engineers to compete global.


Failures in Engineering Materials are accountable for majority of catastrophic engineering failures. However the Engineering students who study Materials Engineering in the country are drastically loosing this very interesting area of research. One could identify this as an area where you need expertise with better training and comprehensive practical exposure along with the professional association which definitely have earn better global prospects to this tiny island. The area of “Forensic Engineering is the investigation of materials, products, structures or components that fail or do not operate or function as intended, causing personal injury or damage to property. The consequences of failure are dealt with by the law of product liability. The field also deals with retracing processes and procedures leading to accidents in operation of vehicles or machinery. The subject is applied most commonly in civil law cases, although may be of use in criminal law cases. Generally the purpose of a Forensic engineering investigation is to locate cause or causes of failure with a view to improve performance or life of a component, or to assist a court in determining the facts of an accident. It can also involve investigation of intellectual property claims, especially patents. ” – Borrowed from wiki.


I am writing this post in view of challenging and convincing the authorized individuals about the improper unproductive deployment of Materials Engineers we produce in the country. If one could even look at the local industry given the above explanation you see the legitimate use of true knowledge on the field of materials engineering in determining accountability and preventing the catastrophic engineering disasters, the nation face. I could give you hundreds of examples, among them the study of catastrophic disasters of national air force aircrafts during the war period and after, the need of testing for propellers at power plant turbines, Need of testing for the armory and careful examinations and testing of sophisticated engineering structures could be highlighted at large. However if some students who need some inspiration out of the significance of the field of materials Engineering I thought the following video give some sense. I know what you see in the video is relatively old. But it is such a very interesting application of knowledge you grabbed as a Materials Engineer.




Wednesday, August 1, 2012

Awesome Paint Brush



Well, this happens to me accidentally while I  was teaching a set of my kiddies who were indeed interested in making computer games about how to do kinda’ simulation using a computer programming language (java). On the other hand I too wanted them to show kind of multiple inheritance in action.  As you see in the code below the mistake was incredible. Miraculously I have written down a piece of code to simulate a paint brush. The code is very original and indeed may have some hidden professional mistakes. I want let em as they are and some body down who read this blog is expected to correct this code for professional mistakes. 



Picture :  An awesome art from an awesome tool


If you run the code below try whether you could draw the above paint :D.


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class Pinsal extends JPanel implements
 MouseMotionListener {
  private int X, Y;
  private Image image1;
  private Image image2;

 
public static void main(String[] args) {
  JFrame frame = new JFrame();
  frame.getContentPane().add(new Pinsal());
  frame.setSize(500, 300);
  frame.show();
  }
  public Pinsal() {
  addMouseMotionListener(this);
  setVisible(true);
  }
  @Override
  public void mouseMoved(MouseEvent event) {
                  // implements MouseMotionListner.mouseMoved
  X = (int) event.getPoint().getX();
  Y = (int) event.getPoint().getY();
  repaint();
  }
  @Override
  public void mouseDragged(MouseEvent event) {
        // implements MouseMotionListner.mouseDragged
  mouseMoved(event);
  }
  @Override
  public void update(Graphics graphics) {
        // javax.swing.Jcomponent.update
  paint(graphics);
  }
  @Override
  public void paint(Graphics g) {
        // javax.swing.Jcomponent.paint
  Dimension dim = getSize();
  draw();
  Graphics graphics1 = image1.getGraphics();
  Graphics graphics2 = image2.getGraphics();                 
  graphics1.setColor(getBackground());
  graphics1.fillRect(0, 0, dim.width, dim.height);
  //colorScreen(image1.getGraphics());
  colorScreen(image2.getGraphics());
  //g.drawImage(image1, 0, 0, null);
  g.drawImage(image2, 0, 0, null);
  }                                                   
  private void draw() {
  Dimension dim = getSize();
  if (image1 == null || image1.getWidth(null) != dim.width
  || image1.getHeight(null) != dim.height) {
  image1 = createImage(dim.width, dim.height);
  }
  if (image2 == null || image2.getWidth(null) != dim.width
              || image2.getHeight(null) != dim.height) {
              image2 = createImage(dim.width, dim.height);
              }
  }
  public void colorScreen(Graphics g) {
  int size = 15;
  g.setColor(Color.CYAN);
  g.fillOval(X - size  / 2, Y - size  / 2, size , size );
  }
}

Sunday, July 29, 2012

The 3G Kitchen platform: A no cost possible solution to better attract 3G signals to your home.


Background Story

It was once a pain in my ass, as when I got my rural home (Pannala), I always am losing the connection I hold with the outer world. That is good in a way as I get a true relieve out of the busy bragging competitive civilization once in few months when I return to home. Yet it is very painful as I miss my daily internet meals. The people in my village have given up their thoughts on buying a SLT line or at least a 3G wireless connection after a generation long painful struggle with authorities.  I also have experimented with every wireless 3G providers for internet at my rural home; unfortunately I could not find anybody who could afford to solve the poor 3G signal issue at our village. Therefore normally when I got home, I got to climb trees or moved in to the rocky sites of 3G signals with the Dongle and the Laptop in search of haunting freaking 3G signals appearing and disappearing in and around the village.  

The luck I found

One day, I left the Laptop connected dongle in the kitchen for some urgency and have accidently put my dongle in a very silver/aluminum pot. The miraculous lucky pot is in fact old over generations.  However on my return an unexpected wonderful sight was spotted. Surprisingly my dongle software has recorded an unexpected exponential climb of 3G signals while the mighty dongle was resting on my grandma’s pot. Wow!!! I got it off the pot. Signals drastically dropped. Oh … hoo; now I am sure that aluminum plates or similar pots could be well used as mighty wireless 3G antennas. I am no longer a sad boy at my home who risks his life to get internet by climbing steep walls and tall trees.  It was an awesome invention and indeed was such an incredible feeling after all; internet is now at my home.


Picture: The First on the spot picture of the noble invention of 3G Kitchen Platform

However with a victorious mind, I search in the web for 3G antennas. My god, you will find similar antennas are already in use.  Nevertheless, when you prepare your own 3G booster antenna based on noble 3G kitchen platform, probably the bellows would help.

Very important

Tests proved that the orientation/establishment of the Dongle is so important for the success of your 3G kitchen Platform. Lol. In order to get better results.
 
         1.Locate the central point of your Aluminum Plate/Pot and place your dongle there.
         2.Must always keep the dongle in the perpendicular plane against the antenna body.

1. Tests Results

Issue is well observable as in the picture 1 : 3G signals were absent to my kitchen and to any other place belonging to our teritorial inheritance :D.  But with the introduction of new Kitchen made 3G antenna platform; We observed convincing results. The results were very promising as the effective signal strength enhance exceeding the level of 29% so that we were able to observe two coloured dashes of the traditional 3G signal indicator (Picture 2). 

1.1 Issue

Though there are remote sites close to my home where freaking 3G signals were intermittently present, at my home there was no way I could use a 3G dongle to connect internet from any of those Internet Service Providers who boast about their island wide coverage.


Picture 1 : No 3G signals. (Awful rural kitchen)

1.2 Fix

After the introduction of Kitchen 3G Platform signal strength for the dongle gradually started to rise So that any dongle could be used from home to connect to internet.




Picture 2 : Successful introduction of Kitchen 3G antenna. 3G Signal strength gradually climbed up to 29%. The current state of 3G at my rural home is more than enough to watch my favorite tube streams without any trouble.


1.3 Limitations

1. Remember this is an Antenna. So for the best performance you will be required to place the aparatus to the direction of the nearest tower from where you get 3G connection.

2. You know a typical antenna is not a signal station. Therefore when you put this in a Zero signal area, the antenna coud do nothing. So it is expected that at least signals are intermittently smelling to the site so that antenna could strength them. Generally evey signal has its own limitation, based on various factors, like weather condition, itnterferences bla bla bla. As they traverse through the atmosphere, it is inevitable the energy get lost. This is common for 3G as well. So you could do nothing with this aparatus when you get a dead signal.

  
2. Commercial Release of the Kitchen 3G antenna

The kitchen 3G platform principles were further strengthened in order for better commercialization. Following 3G antenna apparatus was engineered from a traditional set of rural kitchen equipment.

Tools and equipment required
    1. A box of matches
    2. A metal plate
    3. Old TV antenna  (optional).
    4. Some glue

2.1 Method

Locate the center of the Plate. Apply some glue on the match box and fix it in the middle of the plate as shown below so that the match box will act as your dongle holder.



 
Picture 3:  The birth and R&D of awesome 3G kitchen platform at Pannala Kitchen Labs (PKL) with my buddy Hora Poos (à·„ොර පූà·ƒ්).
 
2.2 The Ultimate Commercial Product

The product bellow in the picture is for genuine presentations. Naaaaaaah !!! Just kiddin…  It indeed shows how you are going to mount your dongle in to the kitchen based antenna platform.  The last thing you gonna do is fixing your dongle to the laptop. You know how to do it. Lol!!! :D.  Now no longer have you needed to climb the trees, or conquer bushes once you get your rural home. 3G is readily working at your room.

Special offer, you don’t have to pay me for Patents. Enjoy. :P




 Picture 4: My dongle performs awesome in the 3G kitchen platform



Wednesday, July 18, 2012

Effective Leadership is vital for success of offshore outsourced software project management





Introduction

This article aims to look at the significance of leadership role as a Project manager in an offshore outsourced project from a balanced perspective from the various conflicting stakes in terms of diverse stake holders (Foreign client, Local management, Foreign management, local employees and support teams, foreign teams who work collaboratively etc). The reader must not read this from just perspective of offshore outsourcing as just an strategic effort for cost reduction. The article is also not about managing and leading an offshore outsourced development as part of a business partnership. Article discuss about the core importance of leadership profile of a project manager who is working remotely with his client from a far shore with any given multicultural highly diverse team in terms of skills, knowledge attitudes and technologies to achieve set of unclear business objectives which exactly have no prior proof of success.  The background scheme for this article is Sri Lanka; as an offshore software outsourced destination, where the local project managers have different challenges to overcome when dealing with short term high quality expectations of western Business Partners.

Discussion

“People think it is communication which is so crucial during managing an offshore project. But I believe that it is something which exceeds the term communication. It is the remote nature of work which is very challenging to manage without fully seeing the correct picture.”

It is a general habit in the offshore outsourced software industry that people around the globe belonging to various virtual teams are regularly having status meetings, and communications over various electronic means (emails, webdocs, phone, mobile, sms, blogs, wikis etc) with participation of various stakeholders from different parts of the world. Since this is the information age people tend to perceive these methods are very accurate ideal ways for communication while maintaining the  costs at a  minimum.  However there are some known issues of such remote communications. One complaint is that it is highly perception driven. Another charge is that decoding of a channeled message may be highly dependent on individual's capacity; hence making more vulnerabilities for miscommunication. Moreover tricky skillful people could articulate limitations of channeled communications to manipulate and persuade them as the best performers. This could negatively impact on the morality of genuine performers. Generally when you manage a team working remotely, it would take long time to understand the true comparative individual skills and performances. Realizing the correct relative performance is so important, as it help the project managers to reward the desired behaviors, and demotivate the undesired behaviors while controlling a project. Due to the tentative short term nature (max 3 years) of many offshore projects, time that takes for correctly recognizing the relative specialization of individuals, and genuinely evaluate their actual relative performances,  will consume a significant portion of Project Manager's schedule time.  If remote managers failed to identify the the true performers early, the damage could be more. It is also noted that if misleadingly wrong performers are incorrectly highlighted and rewarded, the optimum synergy which could have to be attained over deployed resources will be drastically wasted. In the technological landscape wrong resource choices could create huge technological incompatibilities. They may be surfaced during the very latter parts of the ongoing projects resulting very costly remedies. Managing This unseen illusive dogma in remote perceptual communication is very crucial towards the team motivation. That is one such critical place where you need very talented participative leaders who consistently live and die with the project life cycle while making the right decisions with least perceptual mistakes.

Today, for many project managers, a project is a set of baselines which they are trying to avoid been exceeded. On the other hand they always want to see a good burning down of product backlog. Once somebody triggers some issue: it is at the first impression; just a mere technical competency shortage, trying to fix the issue on the spot without realizing the true causes and possible effects.  With prejudiced stereotyped mindset modern project managers in the offshore software industry sometimes effectively failed to identify the realistic perceptual and political landscape of the team which is curing not in favor towards the ultimate expectations of project. It is generally accepted that such team orientations and bi polarities are motivated towards individual interests. Typically a Project Manager see the political nature of project from a different angle than what the project members see.  However as a project manager he may need to induce control as an when it is needed for advantage of meeting the project objectives. Obviously, not in his individual favor indeed. Yet, should well align in favor of original expectations of the project. Internal politics could be a double sided blade for a project manager. If properly handled politics could be beneficial. However politics is generally disastrous if a project manager failed to dilute the unfavorable political agendas at the early stages.

Knowingly or unknowing, for many cases the expectations of a project is highly defined and dependent on the way they defined and directed by the project manager. This is one reason why I would suggest a project manager to be absolutely impartial and consistent to the maximum level he can, towards original objectives ahead of various conflicting stakes of different stakeholders.  It is a common fact that a success of project is always about meeting the defined objectives during the given time provided the limited resources. However changes are inevitable. You will have to welcome them at any time at cost of various things. Provided this dynamic uncertain nature, the role of managing project is exceptionally challenging. A well compromised project will always be challenging and stressing the individual comfort zones of each stakeholders. That is another reason why a strong consistent and participative leadership is so important for success of any project to fight the frictions of evils of individual stakes. The objective should be to manipulate a unique homogeneous governance stature for every different stakeholder, making a healthy project environment with just and peace. Such culture will eliminate many evil forces which could hinder the project success.   

Challenge is comparatively intensive in the remote attire of today’s offshore outsourced business. As explained once above, identifying and knowing the stakeholders and their true interests seems to be deceiving due to the obstacles in perceived communication. Baseline driven controls may be effective when controlling and monitoring the triple constraints: Time : Costs and Scope. However the ultimate success is always depend on the people who are behind all these plans of the ultimate project. It is a known fact that, as a matter of fact according to the PMI, majority of projects are failures (80%) such that they have partially achieved the initial project objectives or otherwise they have missed the original objectives after the completion.  Even many professional partitioning project managers avoid admitting this reality as they are in a misconception that this statement questions their credibility about what they really capable of delivering. However it is very important that a genuine project manager should understand this uncontrollable uncertain nature of project, where there the general tendency is generally towards not meeting the original objectives precisely as planned. The only sustaining and genuine solution for the project manager is to communicate the tendency towards deviation of original objectives regularly to his project management office or his superiors as and when the symptoms of threats are triggered exceeding the limits of safe tolerances. For a project manager communicating the true picture in a remote work environment could be very challenging, If he is not accepted as a true project leader. Because remote receivers could perceive such circumstances as lack of the project managers’ credibility and competency of meeting the challenge. 

Conclusion

Provided above domain specific realistic issues, one could conclude that a successful offshore project manager should spur his flux of leadership in every nook and corner throughout the project during the project life cycle. The landscape of successful project Leadership is not always about tight control. There, effective leadership will include the skills of empathy, effective influencing, guts to communicate the genuine picture to the demanding management, maintain trustworthiness between conflicting groups, maintaining and communicating a fair balanced just yardstick for governance, establishing correcting project cultures, bringing inspiration, vision and motivation while earning a set of mission driven followers.
 

Thursday, May 10, 2012

Jumping cursors - Freaking Dell Inspiron

When once you buy a new laptop (a Dell) you may sometimes find your cursor is jumping to the front of the line you already typed. This happens randomly at unnoticeable times. If you want to get to get rid of this annoying jumping issue - you may do the following.


Open the Control Panel, find "Mouse" , then the
"Pointer Options" tab, then UNCHECK the box next to "Enhance pointer
precision", then Apply, then OK.


You may be a computer geek, yet such distinguished absurd wearied extra features would exhaust you a lot. However it is also advisable that you touch the keys precisely.

You have to learn the rules of the game. And then you have to play better than anyone else.

                              -- Albert Einstein


Monday, February 27, 2012

Algorithm Complexity



Runtime complexity of an algorithm is always a huge confuse for me when I was at the college. Further, the math of variously termed Big O notation was hard to realize in practice. Trying to find a definition from Google, I would agree “Big O notation is used in Computer Science to describe the performance or complexity of an algorithm”. Generally Big O describes the worst-case scenario, and can further be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm. I found the best way to understand Big O thoroughly was to produce some examples in code, which in fact not my own original thought. For Big O, I generally would compare the complexity of algorithm comparative to the input. Big O notation denotes the limiting factor of an algorithm. It’s a simplified expression of how run time of an algorithm scales with relation to the input.

For example (in Java):

/** takes an array of strings and concatenates them

* @param strings the array of strings to concatenate

* @returns a string that is a result of the concatenation of all the strings

* in the array

*/

public static String badConcat(String[] Strings){

String totalString = "";

for(String s: strings){

for(int i = 0; i < s.length(); i++){

totalString+=s.charAt(i);

}

}

return totalString;

}

Now think about what this is actually doing. It is going to throw every character of input and adding them together. This seems straightforward. The problem is that String is immutable. So every time you add a letter onto the string you have to create a new String. To do this you have to copy the values from the old string into the new string and add the new character. This means You will be copying the first letter n times where n is the number of characters in the input, you will be copying the character n-1 times... so total there will be (n-1)*n/2 copies. This is (n^2-n)/2 and for big O notation we use only the highest magnitude factor(usually) and drop any constants that are multiplied times it and we end up with big O(n^2). Using something like a StringBuilder will be along the lines of O(nLog(n)). If you calculate the number of characters at the beginning and set the capacity of the StringBuilder you can get it to be O(n). So if we had 1000 characters of input, the first example would perform roughly a million operations. The simple StringBuilder would perform 10,000, and the StringBuilder with set capacity would perform 1000 operations to do the same thing. This is rough estimate, but O(n) notation is about orders of magnitudes, not exact run times.

O(1)

O(1) describes an algorithm that will always execute in the same time (or space) regardless of the size of the input data set.

bool checkFirstBlock(String[] strings)

{

if(strings[0] == null)

{

return true;

}

return false;

}

O(N)

O(N) describes an algorithm whose performance will grow linearly and in direct proportion to the size of the input data set. The example below also demonstrates how Big O favors the worst-case performance scenario; a matching string could be found during any iteration of the for loop and the function would return early, but Big O notation will always assume the upper limit where the algorithm will perform the maximum number of iterations.

bool ContainsValue(String[] strings, String value)

{

for(int i = 0; i < strings.Length; i++)

{

if(strings[i] == value)

{

return true;

}

}

return false;

}

O(N2)

O(N2) represents an algorithm whose performance is directly proportional to the square of the size of the input data set. This is common with algorithms that involve nested iterations over the data set. Deeper nested iterations will result in O(N3), O(N4) etc.

bool ContainsDuplicates(String[] strings)

{

for(int i = 0; i < strings.Length; i++)

{

for(int j = 0; j < strings.Length; j++)

{

if(i == j) // Don't compare with self

{

continue;

}

if(strings[i] == strings[j])

{

return true;

}

}

}

return false;

}

O(2N)

O(2N) denotes an algorithm whose growth will double with each additional element in the input data set. The execution time of an O(2N) function will quickly become very large.

Logarithms

Binary search is a technique used to search sorted data sets. It works by selecting the middle element of the data set, essentially the median, and compares it against a target value. If the values match it will return success. If the target value is higher than the value of the probe element it will take the upper half of the data set and perform the same operation against it. Likewise, if the target value is lower than the value of the probe element it will perform the operation against the lower half. It will continue to halve the data set with each iteration until the value has been found or until it can no longer split the data set.

This type of algorithm is described as O(log N). The iterative halving of data sets described in the binary search example produces a growth curve that peaks at the beginning and slowly flattens out as the size of the data sets increase e.g. an input data set containing 10 items takes one second to complete, a data set containing 100 items takes two seconds, and a data set containing 1000 items will take three seconds. Doubling the size of the input data set has little effect on its growth as after a single iteration of the algorithm the data set will be halved and therefore on a par with an input data set half the size. This makes algorithms like binary search extremely efficient when dealing with large data sets.

Oh, and do I use it?

Yes, all the time - when I'm figuring out how efficient my code is it gives a great 'back-of-the-envelope- approximation to the cost. Obviously, you may find 100 examples in internet for Big O. They may include polynominal, factorial, logarithm and other boring math. However many experienced developers I often use to consult confused at why they really need this information and could that be useful for them to save the day. Well, what the Big-O Is Good For? The good news is that the Big-O belongs to an entire family of notation. It also serves as a good indicator of what algorithm to use once you take your individual circumstances into consideration. I do use Big O notation on occasion to convey algorithmic complexity to fellow programmers. I use the underlying theory (e.g. Big O analysis techniques) all of the time when I think about what algorithms to use.

In a nutshell, the Big-O of a given algorithm combined with the specific problem knowledge is a great way to choose the best algorithm for your situation. I also agree that the Big-O lives in the land of theory and doesn't care very much about the real world.

So why is Big-O commonly associated with worst-case running times, and why is that imprecise?

It's because when considering the worst possible case, it is natural to give a limit on how bad that worst case can be, not how good it can me. That is, we want to give an upper bound on its degree of badness. Similarly, we often want to give a lower bound on how good the best-case is (i.e, even on good inputs, there's still a limit on how fast the algorithm can go; what is that limit?), so Big-Omega gets associated with best-case.

That's why Big-O gets associated with worst-case running times and Big-Omega with best-case. And it's true that if someone just says "the running time" is O(n^2), then n^2 is indeed "closer" to the worst-case running time than to the best-case running time, in the sense that n^2 is "bigger" than all possible running times, and the worst-case running time is "bigger" than the best-case running time. But O(n^2) doesn't mean that the worst-case running time actually is n^2, just that it is at most n^2.

Myths about Big O

You cannot use Big-O to compare the speed of two algorithms. Big-O only says how much slower an algorithm will get (approximately), if you double the number of items processed or how much faster it will get, if you cut the number in half.

However, if you have to entirely different algorithms and one (A) is O(n^2) and the other one (B) is O(log n), it is not said that A is slower than B. Actually with 100 items, A might be ten times faster than B. It only says that with 200 items, A will grow slower by the factor n^2 and B will grow slower by the factor log n. So if you benchmark both and you know how much time A takes to process 100 item and how much time B needs for the same 100 items, and A is faster than B, you can calculate at how many items B will overtake A in speed (as the speed of B decreases much slower than the one of A, it will overtake A sooner or later, this is for sure).

Math of Big O

'Big-O' notation is used to compare the growth rates of two functions of a variable (say n) as n gets very large. If function f grows much more quickly than function g we say that g = O(f) to imply that for large enough n, f will always be larger than g up to a scaling factor.

It turns out that this is a very useful idea in the analysis of algorithms, because we are often precisely concerned with the growth rates of functions which represent, for example, the time taken by two different algorithms. Very coarsely, we can determine that an algorithm with run-time t1(n) is more efficient than an algorithm with run-time t2(n) if t1 = O(t2) for large enough n which is typically the 'size' of the problem - like the length of the array or number of nodes in the graph or whatever.

This stipulation, that n gets large enough, allows us to pull a lot of useful tricks. Perhaps the most often used one is that you can simplify functions down to their fastest growing terms. For example n^2 + n = O(n^2) because as n gets large enough, the n^2 term gets so much larger than n that the n term is practically insignificant. So we can drop it from consideration.

However, it does mean that big-O notation is less useful for small n, because the slower growing terms that we've forgotten about are still significant enough to affect the run-time.

What we now have is a tool for comparing the costs of two different algorithms, and a short hand for saying that one is quicker or slower than the other. Big-O notation can be abused which is a shame as it is imprecise enough already! There are equivalent terms for saying that a function grows less quickly than another, and that two functions grow at the same rate.