Search Here

MyLot Discussion

Tuesday, June 30, 2009

Deaf to Win

Better be deaf than normal, so every time you want to climb the highest mountain, you will not hear someone says "The mountain is too high!!! No one can climb that mountain!!!"

God's work

All your fear and negative assumption/thinking will only slow the God's work in your life

Different Responses

Try to responses problem/situation with different responses besides the general responses that people usually do. It will make your life more rich.

Point of View

If you face a problem, try to see it from a lot of different point of view, so you can see it clearly.

Dynamic Column Query Using Pivot

SET @strSQL =
'select tax_type "Tax Type", tax_service_Description "Tax Service Description",' + @cols + '
FROM (
select
ttSSP0.tax_type,
tmtarif.TAX_SERVICE_DESCRIPTION,
ttSSP0.company_code,
ttSSP0.tax_period_year,
case ttSSP0.tax_period_month
when ''01'' then ''January''
when ''02'' then ''February''
when ''03'' then ''March''
when ''04'' then ''April''
when ''05'' then ''May''
when ''06'' then ''June''
when ''07'' then ''July''
when ''08'' then ''August''
when ''09'' then ''September''
when ''10'' then ''October''
when ''11'' then ''November''
when ''12'' then ''December'' end tax_period_month,
sum(ttSSP0.PAY_AMOUNT) PAY_AMOUNT
from
ttSSP0 left join tmtarif
on ttSSP0.tax_type = tmtarif.tax_type and
ttSSP0.TAX_MAP_CODE = tmTarif.TAX_MAP_CODE
WHERE
ttSSP0.COMPANY_CODE = ' + CAST(@Company_Code as varchar) + '
AND ttSSP0.tax_period_year = ''' + @Tax_Period_Year + '''
AND ttSSP0.tax_period_month between ' + @Tax_Period_monthFrom + ' and ' + @Tax_Period_monthTo + '
group by
ttSSP0.tax_type,
tmtarif.TAX_SERVICE_DESCRIPTION,
ttSSP0.company_code,
ttSSP0.tax_period_year,
ttSSP0.tax_period_month
) p PIVOT ( SUM(PAY_AMOUNT)
FOR [tax_period_month]
IN (' + @colspvt + ')
) AS pvt'

EXEC SP_EXECUTESQL @strSQL

The @cols variable here must be set with value [January],[February]...etc. So the pivot query will change the original query where month name in a row to a column and it will sum the field PAY_AMOUNT for each month.
Examples :
The Original Query Result:
MonthName   Payamount
=====================
January   100
February   200
March   300
January   150

Pivot Query Result :
January   February   March
==========================
250   200   300

Friday, June 12, 2009

Import Excel File to Dataset (ASP.NET)

Dim filename as string
filename = Mid(uplFile.PostedFile.FileName, InStrRev(uplFile.PostedFile.FileName, "\") + 1, Len(uplFile.PostedFile.FileName) - InStrRev(uplFile.PostedFile.FileName, "\"))

'uplFile is ASP.NET Upload Component uplFile.PostedFile.SaveAs(System.AppDomain.CurrentDomain.BaseDirectory & filename)


Dim dbconn As New OleDb.OleDbConnection
Dim strconn As String
strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.AppDomain.CurrentDomain.BaseDirectory & filename & ";Extended Properties=Excel 8.0"
dbconn.ConnectionString = strconn
dbconn.Open()


Dim excelcmd As New OleDb.OleDbCommand
excelcmd.Connection = dbconn
excelcmd.CommandText = "select * from [Sheet1$]"


Dim excelda As New OleDb.OleDbDataAdapter(excelcmd)
Dim excelDs As New DataSet
excelda.Fill(excelDs)

Tuesday, March 31, 2009

Dynamic HTML Row Using ASP.NET

If you want to make dynamic row in asp.net, you must remember that every page post back you must draw it again and put the existing value for each control.Assume that you already have a dropdown, two textbox ,a button to insert the new row.


Private Sub InsertExistRow()
Dim row As HtmlTableRow
Dim cell As HtmlTableCell
Dim i As Integer
Dim btn As Button
Dim x() As String
x = Session("x")

For i = 1 To x.Length - 1
row = New HtmlTableRow
row.ID = "row" & x(i)
cell = New HtmlTableCell
Dim dropdown1 As New DropDownList
dropdown1.ID = "dropdown" & x(i)
dropdown1.Items.Add("0001")
dropdown1.Items.Add("0002")
dropdown1.Items.Add("0003")
dropdown1.Items.Add("0004")
dropdown1.Items.Add("0005")
dropdown1.Items.Add("0006")
dropdown1.Items.FindByText(Request.Params.Get("dropdown" & x(i)))
cell.Controls.Add(dropdown1)
row.Controls.Add(cell)

cell = New HtmlTableCell
Dim txt As New TextBox
txt.ID = "txt" & x(i)
txt.Text = Request.Params.Get("txt" & x(i))
cell.Controls.Add(txt)
row.Controls.Add(cell)

cell = New HtmlTableCell
Dim dropdown2 As New DropDownList
dropdown2.ID = "dropdown2" & x(i)
dropdown2.Items.Add("A100")
dropdown2.Items.Add("A200")
dropdown2.Items.Add("A300")
dropdown2.Items.Add("A400")
dropdown2.Items.Add("A500")
dropdown2.Items.Add("A600")
dropdown2.Items.FindByText(Request.Params.Get("dropdown2" & x(i)))
cell.Controls.Add(dropdown2)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.Text = "Insert"
btn.ID = "Insert" & x(i)
btn.CommandName = "group"
btn.CommandArgument = "Insert" & x(i)
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.Text = "Copy"
btn.ID = "Copy" & x(i)
btn.CommandName = "group"
btn.CommandArgument = "Copy" & x(i)
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.Text = "Paste"
btn.ID = "Paste" & x(i)
btn.CommandName = "group"
btn.CommandArgument = "Paste" & x(i)
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.Text = "Delete"
btn.ID = "Delete" & x(i)
btn.CommandName = "group"
btn.CommandArgument = "Delete" & x(i)
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

tblBasic.Rows.Add(row)
Next
End Sub

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

If Page.IsPostBack = True Then
If Session("i") > 0 Then
InsertExistRow()
End If
Else
Session("i") = 0
End If

End Sub


tblBasic is ID of table control that run at server. Code for button to insert new row :

Private Sub InsertRow(ByVal index As Integer)
Dim row As HtmlTableRow
Dim cell As HtmlTableCell
Dim btn As Button
Session("i") = Session("i") + 1
row = New HtmlTableRow
row.ID = "row" & Session("i")

cell = New HtmlTableCell
Dim dropdown1 As New DropDownList
dropdown1.ID = "dropdown" & Session("i")
dropdown1.Items.Add("0001")
dropdown1.Items.Add("0002")
dropdown1.Items.Add("0003")
dropdown1.Items.Add("0004")
dropdown1.Items.Add("0005")
dropdown1.Items.Add("0006")
cell.Controls.Add(dropdown1)
row.Controls.Add(cell)

cell = New HtmlTableCell
Dim txt As New TextBox
txt.ID = "txt" & Session("i")
cell.Controls.Add(txt)
row.Controls.Add(cell)

cell = New HtmlTableCell
Dim dropdown2 As New DropDownList
dropdown2.ID = "dropdown2" & Session("i")
dropdown2.Items.Add("A100")
dropdown2.Items.Add("A200")
dropdown2.Items.Add("A300")
dropdown2.Items.Add("A400")
dropdown2.Items.Add("A500")
dropdown2.Items.Add("A600")
cell.Controls.Add(dropdown2)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.ID = "Insert" & Session("i")
btn.Text = "Insert"
btn.CommandName = "group"
btn.CommandArgument = "Insert" & Session("i")
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.ID = "Copy" & Session("i")
btn.Text = "Copy"
btn.CommandName = "group"
btn.CommandArgument = "Copy" & Session("i")
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.ID = "Paste" & Session("i")
btn.Text = "Paste"
btn.CommandName = "group"
btn.CommandArgument = "Paste" & Session("i")
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

cell = New HtmlTableCell
btn = New Button
btn.ID = "Delete" & Session("i")
btn.Text = "Delete"
btn.CommandName = "group"
btn.CommandArgument = "Delete" & Session("i")
AddHandler btn.Command, AddressOf btn_click
cell.Controls.Add(btn)
row.Controls.Add(cell)

tblBasic.Rows.Insert(index, row)

Dim s() As String
ReDim s(tblBasic.Rows.Count - 1)
Dim a As HtmlTableRow
Dim x As Integer
x = 0
For Each a In tblBasic.Rows
s(x) = Mid(a.ID, 4, Len(a.ID) - 3)
x = x + 1
Next
Session("x") = s
End Sub


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Insert0.Click
InsertRow(1)
End Sub


Any question, please send email to : wokee_cs@yahoo.com

Sunday, March 22, 2009

Mother's Love

This story has many version, but all of it have one point. That is how big mother's love to us.This story will be told again by me to remind us to our beloved mother. Here is the story : One day, a little boy came out to his mother in the kitchen while she was cleaning plate and glass after supper.He gave her a piece of paper that he had been writing on.After his Mom dried her hands, she read it, and this is what it said:

For going to store to buy soap for you : $3
For cleaning the mess that made by my 5 years old brother : $4
For getting out garbage : $3
For getting excellent report card in school : $5
For helping you clean the dinner table : $1
For giving you massage when you are tired : $5

Total owed : $21

Well, his mother looked at him, and took a pen to write down on the paper.
Here what she wrote :

For nine months i bear you until you born : $0
For worrying and taking care of you when you sick : $0
For all your anger to me : $0
For food,clothes,education : $0
For taking care of you from born to this age : $0
For all crying when you hurt me : $0
For all pray to God asking him to protect you : $0
My son, when you added it up, the cost for my love to you is $0

When this boy finished reading what his mother had written, there were a big tears in his eyes, and he looked straight to his mother and said "Mom, i'm sorry, i sure do love you".And then he took the pen and in great big letters he wrote: "PAID IN FULL".


I just want you to know that you will never know how much your parents loves you, sometimes when you easily angry at them, they always still care of you. Sometimes they get angry to you to make you become a good people.They are really proud of you when they watch you sing in the church, when you do a good thing, when you help people.We can see parent's love just like sun light, always give, never asking back.So be a giver not an asker.

For you who still have your mother alive,give her a big kiss and ask for her forgiveness, taking care of her, don't easily get angry to her, tell her that you love her very much.If she far away from you, call her and tell her you lover her, always make her smile and proud of you.If she passed away, pray for her.

Pray everyday for your parents, asking God to watch and protect them.

Saturday, March 21, 2009

Vantage Point Review

Reviewed by me as an AUDIENCE not expert :

GENERAL INFO :

Starring Dennis Quaid, Matthew Fox, Forest Whitaker, Sigourney Weaver, and William Hurt

GENRE(S): Drama | Suspense/Thriller
WRITTEN BY: Barry L. Levy
DIRECTED BY: Pete Travis
RELEASE DATE: DVD: July 1, 2008
Theatrical: February 22, 2008
RUNNING TIME: 90 minutes, Color
ORIGIN: USA

Synopsis :
In Columbia Pictures' action-packed thriller Vantage Point, eight strangers with eight different points of view try to unlock the truth behind an assassination attempt on the president of the United States. Thomas Barnes and Kent Taylor are two Secret Service agents assigned to protect President Ashton at a landmark summit on the global war on terror. When President Ashton is shot moments after his arrival in Spain, chaos ensues and disparate lives collide in the hunt for the assassin. In the crowd is Howard Lewis, an American tourist who thinks he's captured the shooter on his camcorder while videotaping the event for his kids back home. Also there, relaying the historic event to millions of TV viewers across the globe, is American TV news producer Rex Brooks. As they and others reveal their stories, the pieces of the puzzle will fall into place...and it will become apparent that shocking motivations lurk just beneath the surface. (Columbia Pictures)

taken from here

REVIEW :
For the first 10 minutes i watched this movie, it had just enough mystery to get me excited without looking away. i was hypnotized with the story. There is a lot of view point here in this movie. It makes rewind to the beginning for every different viewpoint.It made me very curious. Maybe for some body the 'rewind' things makes it so annoying, but i think it made it much more awesome.Every 20 minutes or so you're right on the edge of your seat and are left hanging until the very end, it's totally worth it. It had the perfect combination of action and suspense.You can see the end by watching all the view point and it leads you all to the end of story.I give this 7 point of 10 to this movie.

Thursday, March 12, 2009

How to open paypal account


Step 1 :
Click here to open paypal site

Step 2 :
Click Sign Up Today! to sign up

Step 3 :
Choose you country and language and choose your account type

Step 4 :
Fill the required information, and press Create My Account.
Later, your email account that you entered will become your username for login and to transact using paypal.

Step 5 :
You will receive email from paypal. Check your email that you entered in step 4, and click the link in the email to confirm that you are the email's owner.

Step 6 :
You will be brought to paypal site again, enter your password to login and follow the next step. After that you will be brought to MY Account page.

Congratulations, YOU ALREADY OPEN PAYPAL ACCOUNT!

Tuesday, March 03, 2009

“Why I’m So Special?”

“Why I’m So Special?”

The simple answer is because NO ONE is exactly the same with me. God creates me differently from others.

I feel so special every day because I always say “Thank You God for what I have been blessed and gifted” and “Thank You God for what I am blessed and gifted”.

The point of Why I’m So Special is Thank God!

Below are some points of Why I’m So Special: (The rule here is I compare with most people in the world)
Thank God because I still have parents. Both of them! Some don’t have (die, divorce, some even don’t know who their parents are)
Thank God because I have all my brothers worked.
Thank God because I have jobs. I’m not unemployment. Most don’t have a job.
Thank God because I can eat proper food 3 times a day. Most can’t even have 1 time for a day
Thank God because I am healthy
Thank God because I have my own car
Thank God because I have my own apartment. Most don’t have house
Thank God because I have many friends supporting me
Thank God because I learn something new from Jennie’s blog
Thank God because I am alive today!
And a lot more…

In this moment, I want to ask readers to do exactly the same thing to Thank God. Please write down at least 10 reasons for Thank God! Starting now…!

Even if you do not know what to Thank God, just write down anything! Anything! Feel and try to compare with most people out there how special you are!

I assure you afterwards you will feel so special, so blessed, and so gifted…!

Take action Miracle happens, No Action Nothing happens!

Good luck and best wishes to you all!


Putera Lengkong
Director, Motivator, Trainer, Author
http://puteralengkong.blogspot.com


Thank God is an absolute way to attract more goodness and kindness into your life ~ Marci Shimoff