Sunday, December 28, 2014

Why you should use the "Lotto Noodle" app instead of playing Quick Pick

Why you should use the "Lotto Noodle" app to play the lottery instead of playing Quick Pick Lottery!
The "Lotto Noodle" app doesn't increase/decrease your chance of winning/losing.
Since all numbers are equally likely to come up in the upcoming draw, there's no way to increase/decrease your odds of winning/losing.
But why should you use the "Lotto Noodle" app then?
Simply because it is more ... FUN!
It's fun coming up with different strings/words/phrases to be used as a noodle to get lottery numbers from.
You can buy "Natalie Portman" numbers for your lottery ticket.
You can buy "Bacon and Eggs" or anything else that you've had for breakfast.
You can buy "A house".
You can buy "A cat".
You might even buy "Jackpot".
You can buy anything, and that's what makes it fun.
And also along with your noodle, you can get numbers based on your noodle and your GPS location which makes your numbers unique to you even if you buy the same noodle as someone else who's from a different location.  By buying GPS based numbers, you're decreasing the odds of someone else sharing your Jackpot, if your numbers are a winner.
The "Lotto Noodle" app is FREE and available in the Google Play store.

So you've written a free android app.

So you've written a free android app and now, you want to share it with the world!

Maybe it has ads to earn you some coins, but it is FREE and available in the Google Play store.
Like me, I have a free app called "Lotto Noodle".
Now, how to advertise/promote your app?  Of course, you're gonna try to search for forums that have people talking about your topic, they're more likely to install your app.

Like my app, it's Lottery related so I searched for lottery forums and came up pretty high up on a Google search result.

So i thought "Hey yeah, people who read/comment on lottery forums are probably more likely to be most interested in my app".  So I registered an account with the forum and shared my app.

However, the forum's owner/webmaster considered this spamming and banned me for good from the site.
I think it was a good way of sharing the app with lottery players, and since it's lottery related it would help the forum's relevancy in Google searches.  Also if people searched for my app's name, my's post showed up on the first page of the search, I would say that really helps the forum and should be considered mutual benefit (People who view the forum gets exposed to my app, and people who search for my app gets exposed to the forum).

The forum's owner/webmaster didn't share my same view.  That's too bad.

So if you've ran into similar problems while trying to promote your app for free (since the app itself is free) and you've ran into this post this means that this post has some good relevancy on Google searches.  You can freely share your apps here in the comment section.

I wish you'll get many users/installs for your app.

Saturday, December 27, 2014

Lotto Noodle's latest version.

Lotto Noodle's latest version now will also generate numbers for the American Mega Millions as well. The app will generate five numbers from 1 to 75 and a Mega ball number from 1 to 15 based on your entered noodle.  The app will also generate five numbers from 1 to 75 and a Mega ball number from 1 to 15 based on your noodle and your GPS location combination.  This will make it more fun for Mega Millions lottery players.  Good luck, y'all!

Friday, December 26, 2014

Buying a single lottery ticket makes a big difference compared to not buying.

My junior-high math teacher (Mr. Downey) told us that the difference between buying a lottery ticket and not buying one is huge.  If you buy one, you have a chance. If you don't buy one, you're guaranteed 100% to not win anything.  But he also told us to buy just one ticket because buying thousands of tickets (compared to all the possibilities of a lottery draw) is still a very small chance.
To this day, i still agree with him.

If you don't buy one, you have absolutely no chance at all and there isn't really much to talk about.
If you buy one ticket, you have a chance (a very slim chance) but a chance.

So to the lottery players out there, always buy one ticket.  This guarantees you have a chance.  And good luck playing... most important thing is to have fun.

I created a free app to help my uncle have more fun when getting numbers to buy.  Since all numbers have equal chance of coming up in a draw, using this app doesn't increase/decrease your chance of losing/winning but it makes it more fun.  The app allows you to enter any string (aka noodle) and give you numbers based on your noodle.  It also gives you numbers based on your noodle and GPS location combination so that if you use the same noodle as someone else in a different location, you'll get different numbers.  The app is called "Lotto Noodle".  It's a free app available on Google Play Store.  Download it and have fun coming up with noodles.  Your noodle can be anything (ie. "Bacon and eggs", "I want to win!", "Ichiban", Your birth-date or any date, your pet's name, name of your crush).

Saturday, December 20, 2014

Lotto Noodle App

An app that will give you numbers for any string (aka noodle) you enter for the Lottery 6/49, LottoMax and Powerball.
It also gives you numbers based on your noodle and GPS location so that your numbers are unique to your location when you use a similar noodle as someone else from a different location.

This app can be downloaded at google play store for FREE.

Tuesday, December 16, 2014

Pick lottery numbers based on what you had for breakfast
go to the about section and click the url and you'll be taken to a codeskulptor program.
Click on triangle to run program, and enter what you had for breakfast (it's case sensitive, so "Beef" is different from "beef") or anything really! Your full birthdate, your favorite TV show anything.
and 6 numbers will be chosen for you to play the 6/49.

Based on what you've had for breakfast or your thing entered, you will get different numbers, but if you enter the same thing for example: "Beef" then "Beef" again you'll always get the same numbers.
So your answer is directly correlated to those given numbers.

Could what your birthdate give you winning numbers for the next draw?  Maybe your favorite snack foods?  Maybe your favorite colour? Anything, maybe the name of your crush might give you winning numbers. Who knows? but it's sure fun to play and be able to say things like: "I bought 'bacon and eggs' for the upcoming lottery draw!".

If you download one free app this XMAS, make it this one.

This app will suggest activities to do based on current weather conditions.
Another good use for it is: If you wish to do something for current weather condition but are too busy to do, you can create an activity for current weather.  Then at another time, when a similar weather condition occurs, it'll suggest the activity you've created for it.

Tuesday, November 11, 2014

Is your name "Katy Perry"? or if you're a well-known artist/singer!

If your name is "Katy Perry".  You're likely never going to see this page/blog.
But if you do, you should think about singing this song lyrics my friend and I came up with when we were working at Canadian Tire (we were bored) like more than a decade ago.
The song is submitted to
It's a silly song lyrics about rain.
Sing it "Katy Perry"! Sing it!
If you make a video of you singing it, please leave a link to video in the comment below.
Chances are you won't sing this song unless catches on and attract many internet users/song writers.  Which would be awesome.

Then if you're "Kate Perry" or another well-known artist, you can just search for your name and songs that have your name as suggested artist will show up, and you can see which songs have the most votes and you can make your fans/voters happy by singing the suggested song.

Don't forget to help me promote that site by encouraging other artists/song writers/voters to visit

Have a pleasant day!

Do you know a song writer?

If you know someone or a friend who's a song writer,
get them to submit their song lyrics to
When they submit their song lyrics, they also get to suggest which famous artist(s) to sing their song.
If you like a song's lyrics, you can then vote up.
As number of votes soar, the site will attract famous artist(s) and your friend's songs will more likely be considered to be sung/performed by these artist(s).

Where to send your song lyrics

Where to send my song lyrics?

so you think you have a hit song lyrics, and you want a famous artist to sing your song!  You can try sending the artist your song directly but what are the chances that they'll get to it? They're famous, they are likely to not have time to go over all the songs sent to them by fans/song writers.

Now if there was a way to get the attention of famous artist(s).

This is why was born.  

It's a site where you can submit any song lyrics of yours and suggest a famous artist or artists to sing your song.  The site was born on Nov 10, 2014.  It has a very simple user interface!  Songs are listed alphabetically.  You can search for any user submitted songs by words in song title, song lyrics, suggested artist's name(s), or contributor name(s)/email.

The idea here is that if your song is in fact a possible hit song, it'll get high votes from you, your friends, and even random internet users.  If people like your song lyrics, they'll vote up.  As number of votes increase, and as the site becomes more popular it'll attract more internet users.  And obviously, if vote numbers soar, it'll attract famous artist(s) to check out your song lyrics. 

Voters are all potential future buyers/consumers of the song they vote up for.  So it's more likely that famous artist(s) will actually consider singing your highly voted songs.  It just makes sense. 

The site allows song writers to get their songs out there to share their work and allow song listeners the ability to vote while saving the famous artist(s)' time.  For example: If you were a famous artist, and you saw a song lyrics with 2 million votes and the suggested singer/artist is your name, you're more likely to consider singing it more than having to go through thousands of emails from fans/random song writers not knowing which song to pick out of the bunch.

Submit your song lyrics/ASMS at today and share with your friends/family members to spread the word and get votes.

We decided to call the submitted songs on the site an ASMS (pronouned azums) simply because ASMS stands for "Artist Sing My Song".  We think it's a fun name.

Who knows, one of your song might be sung by Katy Perry or Lady GaGa in the future!  The site is dependent upon users/song writers like you.  It is only a simple tool to aid internet users in the process of attracting famous artist(s) based on vote counts.

Monday, November 10, 2014

A new website. is a brand new web-site where you can submit your own song lyrics and suggest a well-known artist or artists to sing your song.

As the site becomes more popular, and the number of votes goes up if it goes viral, the high number of votes should attract the attention of well-know artist(s) and increase the likelihood of them actually getting to singing your song.

Monday, October 6, 2014

Six colours in Vietnamese but similar to Calgary Stampede's 6 color gambling game

Similar to Calgary Stampede's 6 color gambling game.  In Calgary Stampede's game, you bet on a color, then someone tosses a ball into a net and it drops onto a colored wheel with groves at the edges of the color wheel.  If it lands on the color that you bet you win 4 times the amount you bet.  If it lands on another color, you lose you bet.
This game is similar to that game, except instead of a ball, it's an arrow pointing to a color.  If the arrow points to the same color as your bet you win $4.  If the arrow points to another color different from your bet, you lose $1.
The game can be found at
just click the triangle in the upper left corner to run program/game.  Place your bet by clicking on a color, then click "Spin" button.  Enjoy gambling with your $10 of virtual money.  When you run out of money the game ends, but you can always start it again by clicking on triangle again.

Monday, September 22, 2014

rock paper scissors lizard Spock game

A simple game created that lets you choose your hand and play against the computer in python coded in CodeSkupltor. can be found here -> rock paper scissors lizard Spock
just click on triangle to run program in browser, it'll open another browser window for you to play. enjoy!!! :)

Saturday, August 23, 2014

IBM has created a "brain" chip.

This could be the very beginning to it all, before future robots take over the world.
I have created a facebook page for us all to democratically vote ourselves to be on a "DO NOT KILL" and "DO NOT HARM" list.  To prevent us from being harmed by future robots.  A democratic system should be better than google's killer-robots.txt since anyone can like the page to help represent a large group of people which will be a more successful in telling future robots so.
The page can be found at:  Go there and like the page to join the list and not be harmed by future robots that will become self-aware in the very near future.

Friday, June 20, 2014

Aloe Vera cures cancer, liver disease, diabetes and high blood pressure.

Not sure where my mother got this article but it's in Vietnamese.  And it shows how to Aloe Vera can cure sickness.
Bài thuốc đặc trị
Bệnh Ung Thư Bệnh Xơ Gan Cổ Chướng Tiểu Đường và Cao Huyết Áp
Here's a photo of that article in Vietnamese.

Thursday, June 19, 2014

One of the things i love doing to a black and white photograph.

Is split-toning it!
Make the shadow areas blue-er and make the high-lights yellow-er.
You can follow this instruction/tutorial found at to properly split-toned an image.
Read it, it's really good.

But there's also a quick and dirty way of split-toning an image in GIMP. by using (while inside GIMP) select Colors -> Color Balance. Then a dialog window will pop up where you can select Shadows and make it blue-er then select Highlights and make it yellow-er.

 Here's a before and after split-toning using Colors->Color Balance in GIMP.
before split-toning

after split-toning

How long do you have to buy the Lotto Max before you'd have a chance to win?

If you play the Lotto Max, every week (1 draw per week). Your chance of winning is 1 out of 85,900,584. If you play every week, every year you have 52 chances of winning. So if you keep playing, after about 1,651,934.30 years you're likely to win once. If you live have about 80 year long lifespan and you spend all of your adult years playing (since you're 18) you'd play about 62 years per life. You'd have to reincarnate about 26,644.10 times to win the Lotto Max Jackpot.

How long do you have to buy the lottery 6/49 before you have a chance to win.

The probability of you winning a lottery is 1 over 13,983,816. So if you play a ticket, every time there's a draw (twice a week). There are about 104.35 draws per year. You'd likely to win one ticket after 13,983,816 / 104.35 years. That's about 133,999.60 years. If you spend all of your adult years playing (since 18 years old) and you live to be about 80, you'd spend about 62 years playing per life time. You'd have to reincarnate about 2,161.27 times in order to have a chance at winning the jackpot. So if you do win a lottery jackpot, consider yourself very, very lucky.

Friday, May 30, 2014

calling "script-fu-perspective-shadow" returns error

I got this error while trying to use "script-fu-perspective-shadow" procedure Error while executing script-name: Error: (:1) <: argument 1 must be: number As it turns out, this procedure/function does not need run-mode the first parameter mentioned in documentation/procedure browser. So to call it properly, I deleted the run-mode parameter and it runs fine.

Thursday, April 24, 2014

How to create a 4-bit(16 colors maximum) image in GIMP that sort of looks like the work of Andy Warhol's digital art.

1) Load an image in GIMP.
2) Click on "Image" menu, then "Scale Image".

3) A "Scale Image" window appears. Remember the width of the image as you'll need to rescale image to this size at a later step.
Enter a number as width (pick a small number like 100 or 150) so that when we rescale the image later it'll reveal the pixels in our image.
Click "Scale" button when done.

4) Click on "Image" menu, then "Mode", then "Indexed".

5) The "Indexed Color Conversion" window appears.
Select the "Generate optimum pallete" option. Enter 16 for the "Maximum number of colors". Then for "Color dithering:", choose "Floyd-Steinberg(normal)".
Click "Convert" button when done.

6) Click on "Image" menu, then "Scale Image".

7)A "Scale Image" window appears. This time enter original width (remembered from step 3).
Click "Scale" button when done.
And you should have a 4-bit image (Maximum of 16 colors). Here's an example image.

Wednesday, April 23, 2014

How to create a polygon art in GIMP, manually done by hand.

New improved method that uses 6 line script to aid in filling the manually selected polygon with average color is located here ->

This post is also posted on GIMP LEARN (where you can register and share your polygon art as well).
Or search for polygon art on GIMP LEARN

1) In GIMP, load an image that you'd like to use as reference to create polygon art out of.
2) Make sure the image doesn't have an Alpha Channel. You can do so by right clicking on the layer that contains the image and click on "Remove Alpha Channel" like shown in image below.

3) Click on "Free Select Tool", then select a polygon (in this example, we're selecting a triangle by clicking on 3 points of the triangle and then click the first point to close the triangle, like shown below).

4) Click on "Color Picker Tool", then click on the middle of the polygon (selected in the above step). To get an average color sample, you can adjust how large the area of average color area will be in the options of the "Color Picker Tool".

5) Now that we have the average color (of about the middle of the polygon) selected as foreground color, we swap foreground and background color by clicking on arrow (highlighted in image below) to make that the background color.

6) Now to fill the polygon, with the background color, we simply cut away the polygon by hitting Ctrl-X (hit Ctrl key and hold it and hit X key) to cut. And the polygon will be replaced with the selected background color (since we don't have Alpha Channel in our image, it will not be transparent, this was done in step 2 to make sure it doesn't have an Alpha Channel). The polygon will look like below image.

7) Repeat step 3 to step 6 as many times as needed to fill the whole image with polygons, and you'll have a piece of polygon artwork manually done by hand.

If you're patient enough to finish, you can end up with something as beautiful as this(shown below) or even better depending on how creative you are with the polygons. Good luck and enjoy.

- Download the javascript files (zipped, you just have to open index.html, download to run locally on your PC offline
- View Polygon Art App demo video
- Go to Polygon Art App facebook page (where you can share/view polygon arts)

Sunday, April 13, 2014

How to "System Restore" on Windows 8

1. move your mouse cursor to Top Right of Desktop for side bar to appear.

2. click on Search (magnifying glass) and type "control panel" and hit <Enter> key.

3. "Control Panel" appears, click on "System and Security".

4. "System and Security" appears, click on "System".

5. "System" appears, click on "System Protection" (on left hand side, highlighted below).

6. "System Properties" appears, under "System Protection" tab, click on "System Restore" button.

7. Continue with that and you should be able to select a restore point of an earlier date.

Wednesday, March 12, 2014

How to colorize a black and white photo using a colored image as reference (In GIMP).

There are other tutorials on how to colorize a black and white photo.  It is quite simple.  You basically create a copies of black and white images and add layer masks to them and then paint/select using the layer mask to block out sections or show different parts of the photo with different a single color on each layer.  Here's a tutorial that shows you details on how to create those layers and layer masks:

This tutorial is to show you how to colorize a single layer (for example a layer that only shows human skin) but instead of selecting a single color which doesn't look too realistic, we will use a sample colored image of skin as reference.

First follow the mentioned tutorial to know how to get a layer to show just skin (or some other section). Then to use an selection of a colored image as reference for colorize, use this link:
At the time of this post I couldn't upload the images to my blogger account so that's why I have the above link to explain the steps.

The magic happens with menu item: Colors -> Map -> Sample Colorize... which is mentioned in details in the above link.

Saturday, March 8, 2014

Kệ Niệm Phật

Kệ Niệm Phật

Liên Tông Thập Nhị Tổ Triệt Ngộ Đại Sư

Tự Tánh Di Đà, Di Đà Tự Tánh
Chấp Tánh bỏ tu, nhân đó thành bệnh.
Phật chẳng ngoài Tánh, Tánh có Phật trong.
Như nước gặp nước, như không hợp không.
Phật ở trong Tánh, Tánh há ngoài Phật,
Vốn tự viên dung, làm sao cách ngại.
Cực Lạc - Duy Tâm, Duy Tâm - Cực Lạc,
Rời độ luận tâm, rõ ràng lầm lớn!
Duy Tâm - Cực Lạc, Cực Lạc - Duy Tâm,
Núi tự cao cao, nước tự sâu sâu.
Chưa rõ duy độ, sao đạt duy tâm,
Vũ Phu đâu ngọc, Du Thạch chẳng vàng.
(Vũ Phu: tên một loài đá giống như ngọc;
Du Thạch: cái vân đẹp nhất trong ngọc đá)
Muốn hiểu duy tâm, nên rõ duy độ,
Sáng tỏ giữa đêm, ngày lại chẳng lộ.
Chín phẩm sen báu, tại lòng bàn chân.
Di Đà chẳng niệm, cô phụ chính mình.

Một tiếng Phật hiệu, một tiếng tâm
Nếu tín tâm thâm, Phật càng thâm
Mắt mộng chưa mở, tình loạn đuổi,
Từ quang thường chiếu cõi u trầm.

Một tiếng Phật hiệu, một tiếng lòng
Tuyệt diệu viên âm, nghe hiện kim.
Sao có biết bao "si hán tử"
Vẫn lấy lá úa bỏ vàng ròng.

Một tiếng Phật hiệu, một tiếng tâm,
Núi tự cao chừ, nước tự sâu
Chẳng phải cung thương bao khúc điệu
Chung - Kỳ vị tất đã tri âm.

Một tiếng Phật hiệu, một tiếng tâm,
Cửu Pháp - tàng khai, thâm lại thâm
Vạn luận ngàn kinh đều nói biết
Rõ ràng đề mục chỉ như kim. (hiện giờ)

Một thanh Phật hiệu, một thanh tâm,
Lá tốt là do tự rễ sâu.
Chi cậy gió Đông về khẽ thổi,
Ưu đàm hương vẫn nức tòng lâm.

Một thanh Phật hiệu, một thanh tâm,
Hướng thượng toàn đề nhập tủy thâm
Lâm Tế, Đức Sơn như chửa thấu,
Để rồi Trượng hét rộn thiền lâm.

Ta Bà uế độ: duy tâm uế,
Cực Lạc hương nồng: tự tánh hương,
Chẳng hướng tông này suy thấu triệt,
Thì sao tìm thấu chốn Tây Phương.

Nói đến Liên Bang mưa lệ rơi.
Diêm Phù nẻo khổ đáng thương thay!
Thế gian, xuất thế suy cùng khắp
Chẳng niệm Di Đà biết niệm aỉ

Si mê một niệm đọa Ta Bà.
Trường kiếp trầm luân biết phải là!
Uế độ muốn xoay thành Tịnh độ,
Toàn thân chuyển niệm Phật Di Đà.

Yên phần giữ phận thái bình Tăng,
Liễu tử thoát sanh chưa từng khước.
Chỉ nguyện danh đề trong nhụy phẩm,
Nào mong cao vọng đến truyền đăng

Nói đến vô thường những não lòng,
Trăm năm chỉ thoáng biết chi làm?
Chỉ mong Từ phụ giũ lòng thương,
Cho cành sen nhỏ cũng cam lòng.

Tròn phát ba tâm, tâm lại thiết,
Chỉ hoài một niệm, niệm càng kiên.
Suốt đời chẳng khởi lòng chi khác,
Chỉ dốc gieo mầm thượng phẩm liên.

Học đạo nay đà bốn chục niên,
Đường về quê hãy y nhiên.
Chuỗi tròn trăm tám luôn lần mãi
Tâm - Phật - Chúng sanh nhứt quán xuyên.

Di Đà tự t'anh lưỡng tương đương
Cùng chuyển cùng che chẳng ngại chương.
Niệm đến viên chung chẳng chỗ trệ,
Thì là ngửi được ngẫu hoa hương.

Khẩn thiết niệm như cứu cháy đầu,
Ta Bà nào phải ở hoài đâu.
Nay buông tay tức về ngay đó,
Sánh với tiền Hiền kém chút thôị

Một niệm Hồng danh, một đóa sen,
Thanh thanh lưu xuất tự trong tâm.
Chỉ sao niệm niệm cho tương tục,
Chẳng sợ Di Đà chẳng hiện tiền.

Tôi niệm Di Đà có khóa trình,
Sớm chiều mười vạn niệm phân minh
Muốn sao đến chết thường như vậy,
Tịnh nghiệp ai lo thành chẳng thành.

Cố hương biền biệt trải qua bao,
Thống thiết trong về mãi khát khao.
Mình niệm Di Đà, Ngài niệm lại,
Cha - Con bảnh tánh cùng tương giao.

Một A Di hết lại Di Đà,
Ngoài niệm đó thì chẳng biết chi.
Lần chuỗi niệm hoài cho chuỗi đứt,
Cơm thơm, rau chín đã lâu rồi.

Tăng quê này chuyên tu Tịnh Nghiệp,
Đến đây xin khách rủ hồng trần.
Thế gian có biết bao nam tử,
Chẳng biết đường Tây rất tối chân.

Tâm thường cơm cháo một nhàn tăng,
Luật giáo, thiền tông thảy chẳng năng
Phật hiệu sáu thời thường mật chuyển,
Nhất tâm bất loạn rốt chưa từng.

Tịnh Độ duy tâm biết chỉ tôi,
Người mê đường rẽ dắt xa xôi.
Cố hương về được, về ngay đó,
Kim sắc hoa khai chánh lúc này.

Duy tâm Tịnh độ mấy người tu?
Sáu chữ Hồng danh phải khẩn trì;
Mãi tới thủy cùng sơn tận xứ,
Lạc Bang chẳng cách một hào ly.

Sóng yên trăng hiện, chưa hoàn hảo,
Đất ấm hoa khai, dụ thật hay.
Phật hiệu nhất thanh, sen chín phẩm.
Thấp cao phần vị thuộc do ai?

Cùng với Di Đà có túc duyên,
Bình thường hiện rõ mãi như nhiên.
Bằng như chẳng đoạn trần duyên niệm,
Thì phụ trân trì đại bảo liên.

Duy tâm đủ tạo lý phân minh,
Chín phẩm liên hoa bởi niệm thành.
Thử giở Kim Kinh nghe giảng thuyết,
Câu câu cùng một lý tương đương.

Bốn cõi đâu từng khác cõi đây,
Ba thân đích thật chính thân này.
Thân - cõi vốn là xuyên nhất quán,
Mỗi lần cử niệm, mỗi lần thân.

Sáu chữ Di Đà niệm tựa ngây,
Giống như đã chết chỉ chưa maị (chôn)
Cảnh Ta Bà lắm sanh oan nợ,
Quyết phải trở về Tịnh độ thôi!

Cắt đứt duyên trần chẳng thiết chi,
Toàn thân dốc sức niệm A Di.
Ta Bà chán lắm luân hồi khổ!
Sớm hướng Liên trì chiếm một chi. (1 cành sen)

Mười vạn Di Đà niệm đã xong,
Đỉnh đồng trước án vẫn xông hương.
Áo y còn đắp nhưng mơ thiếp,
Hồn mộng du về thăm cố hương.

Một đóa hoa hàm một thánh thai,
Trên ghi tên tuổi thật kỳ thay!
Xưa nay nhân quả từ tâm hiện,
Lý ai đành rành chớ khá nghi.

Hồng danh sáu chữ: Thủy Thanh Châu,
Tấc dạ trong ngần, ưu lự thôi.
Mát mẻ đây chừ gì sánh được?
Giữa đời vạn dặm ánh trăng soi.

Đã, đang, sẽ nguyện; đã, đang sanh,
Phật đích thân truyền dạy chúng sanh.
Cớ chi ta Bà hoài quyến luyến,
Tự cam khổ lụy, chuộng đa tình!?

              Trích "Mộng Đông Thiền Sư Di Tập"
              Tỳ Kheo Thích Nguyên Thành dịch

Sunday, March 2, 2014

Pizza Unit Prices

Pizza Unit Prices for Domino's Pizza (location: Victoria BC Canada).


  Original Hand Tossed
  Crunchy Thin Crust

   Small 10" $6.99  ($0.089/square inch)
   Medium 12" $8.99 ($0.0795/square inch)
   Large 14" $11.99 ($0.0779/square inch)
  Handmade Pan
   Medium 12" $8.99 ($0.0795/square inch)
  Gluten Free Crust
   Small 10" $6.99  ($0.089/square inch)

  Pepperoni Feast
  Canadian Pizza

   Small 10" $9.99   ($0.1272/square inch)
   Medium 12" $11.99 ($0.106/square inch)
   Large 14" $14.99  ($0.0974/square inch)
  BBQ Chicken Feast
  Philly Steak

   Small 10" $10.99  ($0.1399/square inch)
   Medium 12" $12.99 ($0.1149/square inch)
   Large 14" $15.99  ($0.1039/square inch)
These above unit prices were calculated using Pizza Unit Price Calculator

Pizza Unit Price Calculator (for circular pizzas)

Pizza Unit Price Calculator (for circular pizzas)
Enter diameter and price then click on "Calculate" to see pizza area,
unit price, and how many square inches you get per dollar.
Pizza Area:not availablesquare inches
Unit price: $not availableper square inch
You get: not availablesquare inches per dollar

Sunday, January 12, 2014

How to get/retrieve lastest(most recent) records for each user

This question has been asked like a million times on stackoverflow. I will try to explain it with mysql. Let's say we have a table named comments like below:

table comments(sqlFiddle)

and we wanted to select the rows that are latest comments for each user_id (rows highlighted in green). What do we do?
First, we use MAX() function to grab the lastest timestamp for each user_id by using GROUP BY user_id like the query below (sqlFiddle):

SELECT user_id,MAX(timestamp) as maxtimestamp
FROM comments
GROUP BY user_id 

This will give us the below result:
result of maxtimestamp for each user_id
Now, with this result, we inner join back with our comments table to grab data such as comment field (we'll alias this result(subquery) as `maxtt`. So we'll have a query like below (sqlFiddle):

FROM comments c INNER JOIN
   (SELECT user_id,MAX(timestamp) as maxtimestamp
    FROM comments
    GROUP BY user_id

    )as maxtt
ON c.user_id = maxtt.user_id AND c.timestamp = maxtt.maxtimestamp

 Now we have our end result as rows from comments that are the latest (or most recent) for each user_id like below:
latest records for each user_id