Jack Of All
Thursday, 26 July 2012
Thursday, 22 March 2012
Failure Breeds Success
|
Wednesday, 29 February 2012
Find it difficult to focus on work after lunch?
Do you always feel like grabbing a snooze after lunch? These simple tips will help you stay at your sharpest even after your meal.
Why do you feel tired after lunch?
There could be a variety of factors causing you to feel sleepy after lunch:- What you eat plays an important part in deciding your energy levels. While some foods can boost your energy, others can zap it out. Junk food, sugary food or fatty food will make you feel lethargic and sleepy. These foods increase your blood sugar causing your body to release more insulin. This in turn triggers tryptophan, a kind of amino acid, known for its role in producing brain messengers or neurotransmitters related to sleep and relaxation.
- Have you been getting adequate rest? It may seem obvious but if you’ve been having stressful and sleepless nights, you’re bound to feel sleepy during the day. Try getting at least 6 -7 hours of sleep every day.
- If you have been eating healthy and are getting adequate sleep, you could be suffering from an illness. Sometimes, low fitness levels or some underlying disease could be responsible for draining you out. Your doctor should be able to detect this easily.
Tips to feel energetic after lunch
- Watch what you eat: Junk food is a strict no no. Stick to a low carbohydrate and high protein diet. In simple terms, it means potatoes, white rice and pasta are out and sprouts, beans and cabbage are in. Keep your meal portions small as large meals require more effort to digest.
- Save the alcohol for the weekend: Even if it’s an office party and you can have a glass of wine or beer, if you are expected to get back and work, it’s preferable to stay off the alcohol.
- Take a little walk after lunch: Walk off your drowsiness by taking in some fresh air. Apart from getting rid of your lethargy, it’s a good way to include some activity in your daily schedule. Especially if your job involves sitting in one place.
- Minimise your caffeine intake: I know coffee seems like a great perk-me-up, but the more coffee you consume, the more immune you get to its effects. Switch to water. Many people don’t feel thirsty in an air conditioned office and end up dehydrating their bodies.
- Make sure you have breakfast: One cannot stress enough, the importance of having breakfast. Studies show that people who have a healthy breakfast are mentally and physically more active than those who skip it.
Sunday, 26 February 2012
Monday, 30 January 2012
HOW TO SURVIVE A HEART ATTACK WHEN ALONE
Let's say it's 6.15pm and you're going home (alone of course),
after an unusually hard day on the job. You're really tired, upset and frustrated. Suddenly you start experiencing severe pain in your chest that starts to drag out into your arm and up into your jaw. You are only about five miles from the hospital nearest your home. Unfortunately you don't know if you'll be able to make it that far. You have been trained in CPR, but the guy that taught the course did not tell you how to perform it on yourself..!!
NOW HOW TO SURVIVE A HEART ATTACK WHEN ALONE..
Since many people are alone when they suffer a heart attack, without help, the person whose heart is beating improperly and who begins to feel faint, has only about 10 seconds left before losing consciousness.
However, these victims can help themselves by coughing repeatedly and very vigorously.
A deep breath should be taken before each cough, and the cough must be deep and prolonged, as when producing sputum from deep inside the chest.
A breath and a cough must be repeated about every two seconds without let-up until help arrives, or until the heart is felt to be beating normally again.
Deep breaths get oxygen into the lungs and coughing movements squeeze the heart and keep the blood circulating.
The squeezing pressure on the heart also helps it regain normal rhythm. In this way, heart attack victims can get to a hospital.
after an unusually hard day on the job. You're really tired, upset and frustrated. Suddenly you start experiencing severe pain in your chest that starts to drag out into your arm and up into your jaw. You are only about five miles from the hospital nearest your home. Unfortunately you don't know if you'll be able to make it that far. You have been trained in CPR, but the guy that taught the course did not tell you how to perform it on yourself..!!
NOW HOW TO SURVIVE A HEART ATTACK WHEN ALONE..
Since many people are alone when they suffer a heart attack, without help, the person whose heart is beating improperly and who begins to feel faint, has only about 10 seconds left before losing consciousness.
However, these victims can help themselves by coughing repeatedly and very vigorously.
A deep breath should be taken before each cough, and the cough must be deep and prolonged, as when producing sputum from deep inside the chest.
A breath and a cough must be repeated about every two seconds without let-up until help arrives, or until the heart is felt to be beating normally again.
Deep breaths get oxygen into the lungs and coughing movements squeeze the heart and keep the blood circulating.
The squeezing pressure on the heart also helps it regain normal rhythm. In this way, heart attack victims can get to a hospital.
Sunday, 29 January 2012
How to Store or Save and Read Image in SQL Server table
How to Store or Save Image in SQL Server table
To store an image in to sql server, you need to read image file into a byte array. Once you have image data in byte array, you can easity store this image data in sql server using sql parameters. Following code explains you how to do this.
private void cmdSave_Click(object sender, EventArgs e)
{
try
{
//Read Image Bytes into a byte array
byte[] imageData = ReadFile(txtImagePath.Text);
//Initialize SQL Server Connection
SqlConnection CN = new SqlConnection(txtConnectionString.Text);
//Set insert query
string qry = "insert into ImagesStore (OriginalPath,ImageData) _
values(@OriginalPath, @ImageData)";
//Initialize SqlCommand object for insert.
SqlCommand SqlCom = new SqlCommand(qry, CN);
//We are passing Original Image Path and
//Image byte data as sql parameters.
SqlCom.Parameters.Add(new SqlParameter("@OriginalPath",
(object)txtImagePath.Text));
SqlCom.Parameters.Add(new SqlParameter("@ImageData",
(object)imageData));
//Open connection and execute insert query.
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
//Close form and return to list or images.
this.Close();
}
Following code explains how to read image file in to a byte array.
//Open file into a filestream and
//read data in a byte array.
byte[] ReadFile(string sPath)
{
//Initialize byte array with a null value initially.
byte[] data = null;
//Use FileInfo object to get file size.
FileInfo fInfo = new FileInfo(sPath);
long numBytes = fInfo.Length;
//Open FileStream to read file
FileStream fStream = new FileStream(sPath, FileMode.Open,
FileAccess.Read);
//Use BinaryReader to read file stream into byte array.
BinaryReader br = new BinaryReader(fStream);
//When you use BinaryReader, you need to
//supply number of bytes to read from file.
//In this case we want to read entire file.
//So supplying total number of bytes.
data = br.ReadBytes((int)numBytes);
return data;
}
How to read image data bytes from SQL Server table
To read images from SQL Server, prepare a dataset first which will hold data from SQL Server table. Bind this dataset with a gridview control on form.
void GetImagesFromDatabase()
{
try
{
//Initialize SQL Server connection.
SqlConnection CN = new SqlConnection(txtConnectionString.Text);
//Initialize SQL adapter.
SqlDataAdapter ADAP = new SqlDataAdapter("Select * from ImagesStore", CN);
//Initialize Dataset.
DataSet DS = new DataSet();
//Fill dataset with ImagesStore table.
ADAP.Fill(DS, "ImagesStore");
//Fill Grid with dataset.
dataGridView1.DataSource = DS.Tables["ImagesStore"];
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Once you have image data in grid, get image data from grid cell. Alternatively you can also get image data from Dataset table cell.
//Store image to a local file.
pictureBox1.Image.Save("c:\test_picture.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
If you want you can extend this code to save image from Picture Box to a local image file.
//Store image to a local file. pictureBox1.Image.Save("c:\test_picture.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);Points of Interest
If you see frmImageStore in design mode, I have placed picturebox1 into a panel. This panel's AutoScroll property is set to True and SizeMode property of PictureBox1 is set to True. This allows picturebox to resize itself to the size of original picture. When picturebox's size is more than Panel1's size, scrollbars becomes active for Panel.
To store an image in to sql server, you need to read image file into a byte array. Once you have image data in byte array, you can easity store this image data in sql server using sql parameters. Following code explains you how to do this.
private void cmdSave_Click(object sender, EventArgs e)
{
try
{
//Read Image Bytes into a byte array
byte[] imageData = ReadFile(txtImagePath.Text);
//Initialize SQL Server Connection
SqlConnection CN = new SqlConnection(txtConnectionString.Text);
//Set insert query
string qry = "insert into ImagesStore (OriginalPath,ImageData) _
values(@OriginalPath, @ImageData)";
//Initialize SqlCommand object for insert.
SqlCommand SqlCom = new SqlCommand(qry, CN);
//We are passing Original Image Path and
//Image byte data as sql parameters.
SqlCom.Parameters.Add(new SqlParameter("@OriginalPath",
(object)txtImagePath.Text));
SqlCom.Parameters.Add(new SqlParameter("@ImageData",
(object)imageData));
//Open connection and execute insert query.
CN.Open();
SqlCom.ExecuteNonQuery();
CN.Close();
//Close form and return to list or images.
this.Close();
}
Following code explains how to read image file in to a byte array.
//Open file into a filestream and
//read data in a byte array.
byte[] ReadFile(string sPath)
{
//Initialize byte array with a null value initially.
byte[] data = null;
//Use FileInfo object to get file size.
FileInfo fInfo = new FileInfo(sPath);
long numBytes = fInfo.Length;
//Open FileStream to read file
FileStream fStream = new FileStream(sPath, FileMode.Open,
FileAccess.Read);
//Use BinaryReader to read file stream into byte array.
BinaryReader br = new BinaryReader(fStream);
//When you use BinaryReader, you need to
//supply number of bytes to read from file.
//In this case we want to read entire file.
//So supplying total number of bytes.
data = br.ReadBytes((int)numBytes);
return data;
}
How to read image data bytes from SQL Server table
To read images from SQL Server, prepare a dataset first which will hold data from SQL Server table. Bind this dataset with a gridview control on form.
void GetImagesFromDatabase()
{
try
{
//Initialize SQL Server connection.
SqlConnection CN = new SqlConnection(txtConnectionString.Text);
//Initialize SQL adapter.
SqlDataAdapter ADAP = new SqlDataAdapter("Select * from ImagesStore", CN);
//Initialize Dataset.
DataSet DS = new DataSet();
//Fill dataset with ImagesStore table.
ADAP.Fill(DS, "ImagesStore");
//Fill Grid with dataset.
dataGridView1.DataSource = DS.Tables["ImagesStore"];
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Once you have image data in grid, get image data from grid cell. Alternatively you can also get image data from Dataset table cell.
//Store image to a local file.
pictureBox1.Image.Save("c:\test_picture.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
If you want you can extend this code to save image from Picture Box to a local image file.
//Store image to a local file. pictureBox1.Image.Save("c:\test_picture.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);Points of Interest
If you see frmImageStore in design mode, I have placed picturebox1 into a panel. This panel's AutoScroll property is set to True and SizeMode property of PictureBox1 is set to True. This allows picturebox to resize itself to the size of original picture. When picturebox's size is more than Panel1's size, scrollbars becomes active for Panel.
Subscribe to:
Posts (Atom)