Friday, January 27, 2012

S M A R T - E X E R C I S E - T I P S & ( B M I )

Be sure to consult your doctor before beginning any exercise program.
Books, videotapes, internet and personal trainers are all great sources of information on exercise program. Make sure the information comes from a credible source such as 'The American College of Sports Medicine' (ACSM) or 'The American Council on Exercise' (ACE).

For every good information resource, there is also a gimmick or fad. A simple rule of thumb is that if it sounds too good to be true, then it probably is. The best route to a happier, healthier life is good old-fashioned work - 20 + minutes per day, 3-5 times per week. Several key considerations will help you determine the best program for you.

FIT ( Frequency, intensity, time) , heart rate, exercise variety and setting goals.

  • Frequency: How often you workout. Three to Five time per week is best. 
  • Intensity: Whatever your exercise goals, you need to exercise at the right intensity level. If you don't exercise hard enough, you won't get the results you want. Exercise too hard and you could experience unnecessary pain and risk injury, leading you to abandon your exercise routine altogether. 
  • Time: Time is the duration of your workout. To achieve the results you are looking for, it's important that you exercise for 20 minutes. If you are new to exercise, slowly increase the duration of each workout. A great method is to add one minute to each workout until you reach your desired time.

Heart Rate: Your heart rate is your body's speedometer. The best way to gauge your exercise intensity is by measuring your heart rate.
What should my heart rate be?
To understand exercise intensity you must first determine your theoretical maximum heart rate (TMHR) by substracting your age from 220. The lower limit of your heart rate training zone is 55 % of your TMHR; the upper limit is 90 % of TMHR. You should always exercise within these numbers.

Example: for a 30 year old exerciser:
220-30 = 190 TMHR in beats per minutes (BPM)
Lower Limit: 190 * 0.55 = 104.5  BPM
Upper Limit: 190 * 0.90 =  171.0 BPM

This shows that a 30-year-old exerciser's heart rate should be between 104.5 and 171 beats per minutes during a workout.

If your exercise goal is to burn fat and lose weight, you should exercise in the range of 60 % to 70 % of your TMHR. You should also exercise for a longer period of time, at least 30 minutes. This will maximize the calories being burned from fat stores.
If your goal is to improve your cardiovascular level, then you should train at a higher intensity, in the 75 % to 90 % TMHR range. While exercising in this higher intensity range, you will be conditioning your heart and lungs to maximize your overall cardiovascular fitness.


BMI : Body Mass Index

What is BMI?
Body Mass Index (BMI) is a number calculated from a person's weight and height. BMI is a fairly reliable indicator of body fatness for most people. BMI does not measure body fat directly, but research has shown that BMI correlates to direct measures of body fat, such as underwater weighing and dual energy x-ray absorptiometry (DXA).1, 2 BMI can be considered an alternative for direct measures of body fat. Additionally, BMI is an inexpensive and easy-to-perform method of screening for weight categories that may lead to health problems.

How is BMI used?
BMI is used as a screening tool to identify possible weight problems for adults. However, BMI is not a diagnostic tool. For example, a person may have a high BMI. However, to determine if excess weight is a health risk, a healthcare provider would need to perform further assessments. These assessments might include skinfold thickness measurements, evaluations of diet, physical activity, family history, and other appropriate health screenings.

Why CDC use BMI to measure overweight and obesity ?
Calculating BMI is one of the best methods for population assessment of overweight and obesity. Because calculation requires only height and weight, it is inexpensive and easy to use for clinicians and for the general public. The use of BMI allows people to compare their own weight status to that of the general population.

What are some other ways to measure obesity? Why doesn't CDC use those to determine overweight and obesity among the general public?
Other methods to measure body fatness include skinfold thickness measurements (with calipers), underwater weighing, bioelectrical impedance, dual-energy x-ray absorptiometry (DXA), and isotope dilution. However, these methods are not always readily available, and they are either expensive or need highly trained personnel. Furthermore, many of these methods can be difficult to standardize across observers or machines, complicating comparisons across studies and time periods.

How is BMI Calculated and Interpreted?
BMI is calculated the same way for both adults and children. The calculation is based on the following formulas:
Interpretation of BMI for adults:
For adults 20 years old and older, BMI is interpreted using standard weight status categories that are the same for all ages and for both men and women. For children and teens, on the other hand, the interpretation of BMI is both age- and sex-specific.

The standard weight status categories associated with BMI ranges for adults are shown in the following table.

Useful Links being in America.

  1. Your access to Free Credit Report - Know Your Rights.
  2. For Indians - 'Consulate General of India' - San Francisco.
  3. Best site with all information about your american immigration.
  4. Tax Filing & Return - IRS 
    1. Get Electronic Filing Pin - IRS Site
    2. HR Block - Create Your Account 
    3. IRS Free File Tax Filing
  5. CAR Buying Tips:
    1. Check Values of CAR on Kelly Blue Book (KBB)
    2. Check CAR History - CARFAX
    3. Take the CAR (with permission from CAR seller) to the CAR Brand Dealer, ask them to inspect - they usually charge small price.
    4. Come up with the price w.r.t. Step #1, Step #2 and Step #3. Reduce your price bit more and bargain with the seller (Seller don't want to go to dealers because they don't want to pay extra money to go through dealers, they prefer to sell to you ;) ).

Sunday, January 22, 2012

Creating the wlfullclient.jar using the WebLogic JarBuilder tool

Creating a wlfullclient.jar for JDK 1.6 client applications


  1. Change directories to the server/lib directory. $ cd WL_HOME/server/lib
  2. Use the following command to create wlfullclient.jar in the server/lib directory:$ java -jar wljarbuilder.jar
  3. You can now copy and bundle the wlfullclient.jar with client applications.
  4. Add the wlfullclient.jar to the client application’s classpath.

 Creating a wlfullclient5.jar for JDK 1.5 client applications


  1.  Change directories to the server/lib directory. $ cd WL_HOME/server/lib
  2. Use the following command to create wlfullclient.jar in the server/lib directory: $ java -jar wljarbuilder.jar -profile wlfullclient5
  3. You can now copy and bundle the wlfullclient5.jar with client applications.
  4. Add the wlfullclient5.jar to the client application’s classpath.

Saturday, January 14, 2012

GIT - GITOSIS & GITWEB - SETUP

Intall Git
After logging into your box, let’s install Git (if not already installed):
"$ sudo apt-get install git-core"
Press enter or type ‘Y’ and press enter and git will be installed. Type the following to confirm:
"$ git --version"
and you’ll see something like: git version 1.6.3.3

Intall python-setuptools
Also install the python-setuptools because we’ll need them (gitosis is written in python):
"$apt-get install python-setuptools"

Download Gitosis
We need to clone the gitosis source locally to install it:
"$ mkdir src && cd src"
"~/src $ git clone git://eagain.net/gitosis.git"
Install Gitosis Now let’s install it:
"~src $ cd gitosis"
"~/src/gitosis $ python setup.py install"
"result": http://gist.github.com/352769
Gist. Gitosis is now installed. Next steps are to create git user and handle a file permission on a git hook.
Create Git User:
"$ sudo adduser --system --shell /bin/bash --gecos --group --disabled-password --home /home/git git"
Use local, public ssh key
You need to initially use your public ssh key (id_rsa.pub). If you have one, it will be at $HOME/.ssh/id_rsa.pub and if you have never generated one, you can do so by running the following command (accept the default location and you don’t need to enter a passphrase when prompted):
"$ ssh-keygen -t rsa"
Now you need to upload it to the server/slice. I usually use the scp (secure copy command):
"$ scp $HOME/.ssh/id_rsa.pub user@192.168.1.1:/tmp/"
This will upload the local id_rsa.pub file to the /tmp/ folder on the server. Why there? So that the git user can use it. How is that possible? The folder has permissions of 777 (drwxrwxrwt) meaning everyone has read and write access to it.
Sidenote: SSH Port
If you have your sshd daemon running on a different port other than 22 (which is the default, but I highly suggest changing), then you need to use scp like this:
"$ scp -P 1234 $HOME/.ssh/id_rsa.pub user@192.168.1.1:/tmp/"
I believe the “-P” option must be capitalized.
Initialize gitosis-admin repository
On the server, issue the following command to set your public ssh key as the first authorized key of a new gitosis-admin repository:
"$ sudo -H -u git gitosis-init < /tmp/id_rsa.pub"
Change Permissions on post-update hook
You have to set the permissions on the post-update git hook of the gitosis-admin repository so that gitosis-admin can add new repository structures when they are added/removed to/from the gitosis.conf file.
"$ sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update"
Note: First round of this post, I didn’t make this change. When I added a new project, it failed because this hook didn’t have the right permissions.
Clone gitosis-admin repository
Now we’re going to use Git to administrate this gitosis instance. I think that is pretty ingenius. Let’s clone the gitosis-admin repository locally:
"$ git clone git@YOUR_SERVER_HOSTNAME:gitosis-admin.git"
We are now in the gitosis-admin repository folder locally
Two most common errors
#1> it is because you have used a port for SSH other than port 22 (the default). To fix this, you need to edit your .ssh/config file and add: "HOST YOUR_SERVER_HOSTNAME" / "PORT YOUR_PORT"
Of course, you need to put in your server hostname and port number (i.e., mydomain.com and 12345)
#2> This has usually hit me because I locked down my /etc/ssh/sshd_config file to only allow in certain users or groups. I have to change the AllowUsers line in my file from: "Allowusers dixitgitscm" to "Allowusers dixitgitscm git" and then restart the ssh daemon:
"$ sudo /etc/init.d/ssh restart"
Now the git user has access to reach my server/slice via ssh.
The local gitosis-admin repository
You now have a local clone of the gitosis-admin repository. The contents are only a conf file and key directory:
~/gitosis-admin(master)>ls
total 8
-rw-r--r-- 1 user staff 1148 May 22 21:31 gitosis/conf
drwxr-xr-x 3 user staff 1148 May 22 21:31 keydir
-----------------------------------------------------------------------------------------------
Note: before anyone asks, the (master) notation in my prompt is usage of the __git_ps1
I like knowing which Git branch I’m currently in. I use the git-ps1 function feature that comes with git-core. If you clone or download the git source: "$ git://git.kernel.org/pub/scm/git/git.git" There is a file in the contrib/completion folder called git-completion.bash:
~/code/git/contrib/completion<span class="o">(</span>master<span class="o">)</span> > ls
total 96
-rwxr-xr-x  1 user  staff    44K Apr 14 15:26 git-completion.bash
I copy this file to my $HOME folder as .git-completion.bash and then reference it and the ps1 propt feature in my .bashrc file
<span class="nb">source</span> ~/.git-completion.bash
<span class="nb">export </span><span class="nv">PS1</span><span class="o">=</span><span class="s1">'w$(__git_ps1 "(%s)") > '</span>
And now whenever I cd into a folder that is a Git repository I see something like the following prompt:
~/gitosis-admin<span class="o">(</span>master<span class="o">)</span> >
Notice the (master) notation. That is telling me I’m on the master branch. It’s just easier than issuing a “git branch” command everytime I want to know.
----------------------------------------------------------------

Add Projects and Contributors



Friday, November 11, 2011

Enhancing Security with Manifest Attributes

The following JAR file manifest attributes are available to help ensure the security of your applet or Java Web Start application:
  • The Permissions attribute is used to ensure that the application requests only the level of permissions that is specified in the applet tag or JNLP file used to invoke the application. Use this attribute to help prevent someone from re-deploying an application that is signed with your certificate and running it at a different privilege level.
    This attribute is required in the main JAR file when the Security Level slider in the Java Control panel is set to Very High or High. See Permissions Attribute in the Java RIA Development and Deployment Guide for more information.
  • The Codebase attribute is used to ensure that the code base of the JAR file is restricted to specific domains. Use this attribute to prevent someone from re-deploying your application on another website for malicious purposes. See Codebase Attribute in the Java RIA Development and Deployment Guide for more information.
  • The Application-Name attribute is used to provide the title that is shown in the security prompts for signed applications. See Application-Name Attribute in the Java RIA Development and Deployment Guide for more information.
  • The Application-Library-Allowable-Codebase attribute is used to identify the locations where your application is expected to be found. Use this attribute to reduce the number of locations shown in the security prompt when the JAR file is in a different location than the JNLP file or the HTML page. See Application-Library-Allowable-Codebase Attribute in the Java RIA Development and Deployment Guide for more information.
  • The Caller-Allowable-Codebase attribute is used to identify the domains from which JavaScript code can make calls to your application. Use this attribute to prevent unknown JavaScript code from accessing your application. See Caller-Allowable-Codebase Attribute in the Java RIA Development and Deployment Guide for more information.
  • The Trusted-Only attribute is used to prevent untrusted components from being loaded. See Trusted-Only Attribute in the Java RIA Development and Deployment Guide for more information.
  • The Trusted-Library attribute is used to allow calls between privileged Java code and sandbox Java code without prompting the user for permission. See Trusted-Library Attribute in the Java RIA Development and Deployment Guide for more information.

Sunday, August 7, 2011

Scripts to take multiple thread dump after regular interval - Weblogic

Its always recommended to take multiple thread dumps at close intervals (10 or 20 dumps at 10-30 seconds intervals). Why? A thread dump is a snapshot of threads in execution or various states. Taking multiple thread dumps allows us to peek into the threads as they continue execution.

In order take thread dumps use following script, name this scripts to some values, let's say we name it as td_take.sh and it is intended to make the task of collecting thread dumps easier. Its usage is quite simply and can be seen by running the script with no arguments, e.g.: ./td_take.sh
  1. Start the relevant Server the usual way.
  2. When the issue occurs, use td_take.sh to take thread dumps 10-20 seconds apart.
  3. After the Server has started completely, hung or crashed, provide us with the following:
  • Log file for server, usually located at: <WLS_HOME>/user_projects/domains/<domain_name>/servers/<server_name>/logs
  • Standard output file (.out) for server, usually located at: <WLS_HOME>/user_projects/domains/<domain_name>/servers/<server_name>/logs
  • If using the "nohup" command to start the server than the nohup.out, otherwise discard this last file.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 #!/bin/sh

if [ $# -le 1 ]
then
    echo
    echo "Usage:"
    echo "To take threads indefinitely:"
    echo "    ./tdtake.sh <PID> <interval_in_seconds>"
    echo "To take a specific amount of threads:"
    echo "    ./tdtake.sh <PID> <interval_in_seconds> <amount_of_threads>
"
    echo "e.g.: ./tdtake.sh 512 10 5"
    echo "will take 5 thread dumps, 10 seconds apart each for process ID 512.
"

    exit 0
fi

function take_dumps {
    kill -3 $1
    echo Waiting $2 seconds...
    sleep $2
}

if [ -z $3 ]
then
    echo "Taking thread dumps indefinitely."
    echo "Press <Ctrl>+C to terminate."
    i=1
    while [ $i -gt 0 ]
    do
        echo Taking thread dump $i
        take_dumps $1 $2
        i=`expr $i + 1`
    done
else
    echo "Taking a total of $3 threads."
    echo "Press <Ctrl>+C to terminate before completion."
    i=1
    while [ $i -le $3 ]
    do
        echo Taking thread dump $i
        take_dumps $1 $2
        i=`expr $i + 1`
    done
fi

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

Tuesday, July 26, 2011

Understanding US Debt Ceiling Standoff

Congress has until Aug. 2 to raise the federal borrowing limit or the government will run out of money and possibly default on its debt. House Republicans say they won't raise the debt limit without equal spending cuts. President Barack Obama and Democrats insist that higher revenues must be included.


Thursday's developments: House Speaker John Boehner predicted a majority of House Republicans will end up supporting some kind of compromise to avoid a government default. Democrats insisted higher tax revenue be part of a deal. And both sides disputed reports that Obama and Boehner were near an agreement on a grand bargain. Hopes for a compromise ran into renewed resistance from Republicans opposed to higher taxes and Democrats hesitant to cut Medicare and other benefit programs. A new backup plan that would cut spending by $1 trillion or slightly more immediately and raise the debt limit by a similar amount appeared to be gaining momentum.


Markets react: News that European leaders were drawing up a new rescue plan for Greece and taking a broader approach to dealing with Europe's debt troubles drove markets higher as the Dow rose 152 points. Concerns about raising the U.S. debt limit seemed overshadowed by the news from Europe.


What's Next: The GOP's "cut, cap and balance" plan that passed the House faces likely rejection by the Democratic-controlled Senate on Friday or Saturday, to be followed by an unveiling of a fallback plan crafted by Senate Majority Leader Harry Reid and Senate Republican leader Mitch McConnell to allow Obama to raise the debt ceiling. A separate bipartisan deficit-reduction plan that drew support from Republican senators earlier in the week appeared to be running into obstacles — related to revenue measures.


Some background:


Q: What is the debt ceiling?
A) It's a legal limit on how much debt the government can accumulate. The government takes on debt two ways: It borrows money from investors by issuing Treasury bonds, and it borrows from itself, mostly from the Social Security trust fund, which comes from payroll taxes. Congress created the debt limit in 1917. It's unique to the United States. Most countries let their debts rise automatically when government spending outpaces tax revenue. Congress has increased the debt limit 10 times since 2001.


Q: What is the federal deficit, and how does it differ from the debt?
A) The deficit is how much government spending exceeds tax revenue during a year. Last year, the deficit was $1.29 trillion. The debt is the sum of deficits past and present. Right now, the national debt totals $14.3 trillion — a ceiling set in 2010.


Q: Why is the prospect of not raising the debt ceiling so worrisome?
A) The government now borrows more than 40 cents of each dollar it spends. If the debt ceiling does not rise, the government would need to choose what to pay and what not, including benefits like Social Security, wages for the military or other bills. It also might delay interest payments on Treasury bonds. Any default could lead to financial panic weakening the country's credit rating, the dollar and the already hobbled economy. Interest rates would likely rise, increasing the cost of borrowing for the government and ordinary Americans.


Q: Who holds the $14.3 trillion in outstanding U.S. debt?
A) The U.S. government owes itself $4.6 trillion, mostly borrowed from Social Security revenues. The remaining $9.7 trillion is owed to investors in Treasury securities — banks, pension funds, individual investors, state and local governments and foreign investors and governments. Nearly half of that — $4.5 trillion — is held by foreigners including China with $1.15 trillion and Japan with $907 billion.


Q: How did the debt grow from $5.8 trillion in 2001 to its current $14.3 trillion?
A) The biggest contributors to the nearly $9 trillion increase over a decade were:

  • 2001 and 2003 tax cuts under President George W. Bush: $1.6 trillion.
  • Additional interest costs: $1.4 trillion.
  • Wars in Iraq and Afghanistan: $1.3 trillion.
  • Economic stimulus package under Obama: $800 billion.
  • 2010 tax cuts, a compromise by Obama and Republicans that extended jobless benefits and cut payroll taxes: $400 billion.
  • 2003 creation of Medicare's prescription drug benefit: $300 billion.
  • 2008 financial industry bailout: $200 billion.
  • Hundreds of billions less in revenue than expected since the Great Recession began in December 2007.
  • Other spending increases in domestic, farm and defense programs, adding lesser amounts.