Monday, August 17, 2015

Grocery Shopping in the Philippines

Security guard in official uniform outside SM Mall. 
When you are in a place long enough while traveling, you are going to have to venture out to get groceries at some point. You are going to have to pick up supplies and groceries or other food stuffs just as the locals do.  Living in Angeles City, Philippines this holds true as well.

Here there are little one room stalls or open markets all along the streets that you can visit if you like, but I am referring to the full blown action of the grocery store.  Most of the larger grocery store chains here are located in malls or bigger shopping centers.

Fish looking at me from Fish counter.
When you enter these grocery stores, you will have to go past security men/women that will more than likely check you with a metal detector or pat you down.  This is completely normal for this area of the world.  You will know the official security folks by their unique white and black uniforms (shown above).   

All of the markets in Asia will have a certain smell that just can't be described.  Soon as you step foot inside the doors, you can smell the distinct smell.  It is a mixture of fresh fish, seafood, poultry, pork, and other meats.  Some people are repulsed by it, but I on the other hand find it very comforting.  You will also get hints of durian and other asian fruits and veggies that are a bit out of the ordinary.  If you are unfamiliar with the durian fruit, you can read about the King of Fruits in my blog by clicking here.   This scent is so enticing to me, when I am in the United States, I seek out Asian Markets to shop in.  It takes me back to my homes I have had abroad.
Packets of mayo with jars sold below.

Here in the Philippines, there are many ways to buy a certain product.  You can purchase a regular size jar of an item lets say mayonnaise.  Or you can a full sized packed of mayonnaise to refill your previous jar with.  Or you can pick up single-serving packets of the mayonnaise.  These single packets are actually bought up by people and taken to  their road side store or stand in their local village in most cases.  I am just using mayonnaise as an example. Any item for the most part can be purchased like this.  The pinoy (relating to the Philippines or the Filipinos) seem to be a single-serving culture and I love them for that.

Roadside market showing the individual packets hanging.
If you are a creature of habit and wish to purchase specific brands that you have grown accustom to, you can find a lot of the same products on army bases, duty free stores, or some stores have a foreign section as well.  Please be aware that these foreign products may be two or three times the cost of what you are use to paying in your home country.

The Philippines are also really strict when it comes to rules.  They have check out isles that are for certain shopping cart sizes (they refer to them by color and size).  The orange carts are the hand held carts we are use to here in the United States, but they also can have a push cart that holds 2 of these hand held carts which is still makes it okay to check out in the orange cart isle.  They also have a big cart check out and those usually vary in color, but are strictly referred to as Big Cart Isle.  Then last but not least they have a Senior Citizen or Pregnant Isle to check out.  Even if all the Big Cart Isles and the Orange Cart Isles are backed up with 10 or 15 people, they will not allow anyone who isn't a Senior or Pregnant to check out in the Senior or Pregnant Isle.  Crazy but true fact.

I hope this has helped you or entertained you in some way.  If you have any questions, please feel free to ask.  I will be glad to answer them.  Thank you for taking the time to read my blog.
Senior & Pregnant Isle.

Big Cart Isle.



If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Thursday, August 13, 2015

UPDATE A Column With Its Current Value With Addition (SQL)

This week I ran upon an issue in SQL where I needed to actually do a Google Search to find an answer.  I knew how to do this in Visual Basic.Net (VB.Net), but had no clue how to do it via one single SQL statement which is my preferred method.  I needed to UPDATE A Column with its current value with an additional word added.  The column I was needing to update had multiple options.  Below I will show you 2 ways to complete the same project and you see which one you prefer.

I could have designed an update for every specific possible outcome and it would have worked just fine, but here lately I try to accomplish something with one perfect query.   Below I will show you both ways that  I am talking about.  You can pick the best one for your project.

Example.

I have a table called tblTable and in that table I have a fields/columns called DocumentType and DateReceived.  I wish to ADD the year to the end of specific DocumentTypes that were received in 2015 for archiving purposes. The DocumentType I wish to archive are Certificate and Report only.
Table original called tblTable.

DocumentNameDocumentTypeDateReceived

Cow.docCertificate1/2/2015
Dog.docEntry 2/5/2015
Chicken.docReport5/5/2015
Horse.docEntry1/9/2015
Pig.doc Certificate 8/8/2014
Pony.doc Certificate 5/1/2015


Table results after the SQL statements below.

DocumentNameDocumentTypeDateReceived

Cow.docCertificate 20151/2/2015
Dog.docEntry 2/5/2015
Chicken.docReport 20155/5/2015
Horse.docEntry1/9/2015
Pig.doc Certificate 8/8/2014
Pony.doc Certificate 2015 5/1/2015


The first way would be to do 2 separate update statements that would UPDATE each specific DocumentType with the desired results.

UPDATE tblScanDocs
Set DocumentType = 'Report 2015'
where DocumentType = 'Report' and YEAR(DateReceived) = '2015'

And

UPDATE tblScanDocs
Set DocumentType = 'Certificate 2015'
where DocumentType = 'Certificate' and YEAR(DateReceived) = '2015'


The second way (the way I prefer) is to combine both of the above statements into one.


UPDATE tblScanDocs
Set DocumentType = DocumentType + ' 2015'
where DocumentType in ('Certificate' , 'Report')
and YEAR(Datereceived) = '2015'

Both ways will give you the desired outcome, but as you can see the second way would be a great time saver if you had quite a few DocumentTypes that needed to be updated.

If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Friday, August 7, 2015

Aloe Vera Internal Benefits

During my years of travel to and from Asia, I have developed an acquired taste for a lot of the drinks and foods the different cultures have to offer.

One of the unique items I can't get enough  of is a nutritional drink known as Aloe Vera Water or Juice.  Aloe vera juice contains leaf pulp that is rich in natural nutrients and fiber. The one that I normally drink is actually flavored with the essence of grapes. It tastes like a bight crisp water with the fibrous pulp from the aloe making it seem most like the inside of a grape itself.  I actually started drinking it before I knew of its beneficial properties.  Below are just a few of aloe's benefits when ingested by way of this nutritional drink.

Please do not consume aloe vera that isn't made for internal consumption.

Heart Benefits



This is the Aloe Vera Water that I usually buy.
Mostly found in Asian Markets in the US.
Ingesting aloe vera helps improve the circulation of blood in the body.  It helps fight blood clots in the arteries of the heart and body while reducing fatty deposits.  Aloe helps stop the body's absorption of cholesterol, thus reducing overall cholesterol levels and promoting good health.

Immune Benefits



Aloe vera aid the immune system by ridding the body of harmful pathogens and toxins because it contains bacterial, anti-fungal, and anti-viral properties.  It helps the immune system directly by reducing effect of allergies, arthritis, and other inflammatory immune disorders.


Digestive Benefits



When ingested, aloe vera contains nutrients that heal and soothe the lining of the digestive tract. Aloe can decrease irritation while aiding in the repair of ulcers in the mouth, stomach, and intestines.  Aloe is an adaptogen that  can increase healthy bacteria that regulate bowel movements, while easing acid reflux.  It also contains a substance called anthraquinone, which is a natural laxative.  Aloe rids the body of bad bacteria while regulating diarrhea and constipation.  Aloe vera juice decreases inflammation in both the stomach and intestines thus helping  in irritable bowel syndrome (IBS), colitis, and other inflammatory disorders of the stomach.


If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Tuesday, August 4, 2015

Inserting Across Databases (SQL)

Last night, I got an email  from someone needing to insert records from one database to another without exporting and importing or writing an SSIS package or SQL Server Integration Services package.  This is something that is done easily in SQL.

The coding to accomplish this task is just slightly different from Tip 8: SQL INSERT INTO SELECT Statement.  Below I will use you the same 2 pieces of code I used in Tip 8, but will add the extra code to account for the separate databases.

Example:

Database1 contains tblOriginal (Table 1) and houses the original data we wish to move to tblTarget (Table 2) located in Database2.  For this example, we are assuming these two tables contain identical column names.

Here I will show you two different ways to accomplish this task.   

The first way will copy all of the columns from tblOriginal (Table 1) in Database1 to the tblTarget (Table 2) located in Database2.

INSERT INTO Database2.dbo.tblTarget
SELECT * FROM Database1.dbo.tblOriginal;

The second way will copy specific columns from tblOriginal (Table 1) located in Database1 to the tblTarget (Table 2) located in Database2.

INSERT INTO Database2.dbo.tblTarget
(Column1, Column2, Column5)
SELECT Column1, Column2, Column5
FROM Database1.dbo.tblOrigninal;

I hope this helps someone out a bit and saves them a bit of time. I know it helped me out greatly.

If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Tuesday, July 28, 2015

Decimal Rounding (VB.Net)

Today I ran upon an issue with using the ROUND function in Visual Basic .net (VB.net) that I would assume that others have also found to cause them a problem.

I was attempting to get 65.3125 to round correctly up to 65.313 and every way I tried to edit the code I was getting 65.312.   At first I was thinking that it was an order of operations issue, but after dissecting the code, I realized that it was not.

I was using the following code and failing every time:

Dim dblTotal as Double

dblTotal = ROUND(65.3125 , 3)

Result of the above code is 65.312.

The issue with the above coding is that you cannot represent 65.3125 because it rounds a double-precision floating-point value to a specified number of fractional digits. So when using the ROUND function it uses true representation and rounds down.

Correct way to code it to make it round is using MATH.ROUND :

Dim dblTotal as Double

dblTotal = MATH.ROUND(65.3125 , 3, MidpointRounding.AwayFromZero)

Result of the above code is 65.313.

The reason  the above code works is it rounds a double-precision floating-point value to a specified number of fractional digits. A parameter specifies how to round the value if it is midway between two numbers.

I hope this helps someone out a bit and saves them a bit of time. I know it helped me out greatly.

If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Monday, July 20, 2015

SQL INSERT INTO SELECT Statement

The other day I ran upon some of my code that I thought might be helpful to some of you.  It is a quick and easy way to use an INSERT INTO statement combined with a SELECT statement in SQL to copy data from one table to another existing table.  Please note that any existing data that is already in the target table is unaffected by this process.

Here I will show you two different ways to accomplish this task.   

The first way will copy all of the columns from tblOriginal table to the tblTarget Table.

INSERT INTO tblTarget
SELECT * FROM tblOriginal;

The second way will copy specific columns from tblOriginal table to the tblTarget Table.

INSERT INTO tblTarget
(Column1, Column2, Column5)
SELECT Column1, Column2, Column5
FROM tblOrigninal;

I hope this helps someone out a bit and saves them a bit of time. I know it helped me out greatly.

If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...


Wednesday, July 15, 2015

Concatenate many rows into one single text string (SQL)

I recently starting re-coding some of my old Visual Basic 6 code to make it faster and more efficient while adding it to VB.Net and taking out many of the steps.  In this process, I have taken many lines of code and let SQL do most of the work for me by being smarter with my SQL Statements I produce.  One huge time saver I ran across was this one that I am going to show you.


I have three tables (tblOwner, tblDogs, EndTable) that I am working with.  The field Dog is found common in all three tables (I made typed it in Red Font).  I have a field called Owner that I wish to add together while being separated with commas without having to write code to loop and edit from VB.  Luckily I ran across a couple of articles that explained it to a degree.  I was able to join two tables with a one-to-many relationships.  In SQL, I found that XML Path method can do the concatenation of the rows very easily.


Table called tblOwner:

Dog             Owner
----------      -------------
13               Mark
13               Jerry
13               Paul
44               John
44               Duke

Table called tblDogs:

Dog             DogName
----------      -------------
13               Fido
44               Snoopy

Here is my code:

Update EndTable 
set Owner = t.Owners 
              from (Select distinct ST2.dog,  
          substring( 
          (   Select  ', '+  Owner  AS [text()] 
              From  tblDogs ST1 
              join tblOwners on st1.dog = tblOwners.dog 
              Where ST1.dog = ST2.dog               
              ORDER BY ST1.dog 
              For XML PATH ('') 
           ), 2, 1000) [Owners] 
From dbo.EndTable ST2)  t  
join EndTable 
on EndTable.dog = t.dog 
where t.dog > 0

Result that are expected for EndTable:

Dog             DogName              Owners
----------      -------------        -------------
13               Fido                 Mark, Jerry, Paul
44               Snoopy               John, Duke
I hope this helps someone out a bit and saves them a bit of time.  I know it helped me out greatly.


If you like this post and want to see more, follow me on my website www.chadcompton.com
Or if you prefer...