Programming guides for beginner...
Any comments are welcomed....
I hope it helps!!! Thanks for drop by...

Saturday, July 30, 2011

Some simple features of css3

I believe that there are many people whom designing their blog or website using CSS.

1) What is CSS
  • CSS stands for Cascading Style Sheets.

2) What does CSS use for?
  • CSS is use to design web page. Previously, the styling of html webpage is done internally with the html coding. With CSS, these styling coding can be done externally which save a lot of works and make html coding cleaner in view.

3) What is CSS3?
  • CSS3 is the latest standard for CSS. It has new interesting features which cannot be done in older standard of CSS.
Here is some examples of CSS3: (* CSS3 might not works with old version of internet browser. In order to view these features perfectly, get the latest internet browser. )

1)Text Transform
Text Transform 50 degree.


Coding:
{
transform:rotate(50deg);
-ms-transform:rotate(50deg); /*IE*/
-moz-transform:rotate(50deg); /*Firefox*/
-webkit-transform:rotate(50deg); /*Chrome and Safari*/
-o-transform:rotate(50deg); /*Opera*/
}



2)Rounded Corner

ROUND CORNER AT THE BRODER


Coding:
{
border:2px green solid;
border-radius:25px;
-moz-border-radius:25px;/*Firefox*/
}



3)Shadow

Shadow of the box


Coding:
{
box-shadow: 10px 10px 5px #888888;
-moz-box-shadow: 10px 10px 5px #888888; /*Firefox*/
-webkit-box-shadow: 10px 10px 5px #888888; /*Safari*/
}



Shadow of Text



Coding:
{
text-shadow: 10px 10px 3px #FF0000;
}


4) Box re-size


This box is re-sizable but the minimum size is fixed.


Coding:
{
resize: both;
}



With these few css3 features, I believe that it will make your webpage looks more nicer.
There are still a lot of new features in css3 which you can refer to here.



Tuesday, June 14, 2011

Modified Tic Tac Toe with computer player

    

     As “bluedot” ask me for guides to create a computer player in Tic Tac Toe, I make a decision to create the AI user. Previously, I had created a two player Tic Tac Toe game in Visual Basic 2008 and also posted a video in YouTube. Due to my slow upload speed, I had decided not to upload videos this recent. So, I will just show some pictures on the my Tic Tac Toe with computer player.

7

This is the default Tic Tac Toe with two players.

8

       There are options for player vs player, player vs easy com, and player vs normal com. The difference between easy and normal com is that easy com will click randomly while normal com will try to win first before blocking player from wining. Playing with normal com might get more draws than winning or losing. Following are some pictures:

910115

 

     For those who want to try this game, please feel free to download at my website (will be available soon). Please comment on any bugs and improvements that can be done.  For those who want to have the source, please leave your email at the comment. I will send it to you asap.

Sudoku game with 9x9 and 16x16 by VB.Net

Recently, I am quite lazy to update this blog. I had done this Sudoku game since last month. This Sudoku game will randomly create and user is provided with option for 9x9 and 16x16. For 9x9 Sudoku game, the apps will generate in just few seconds. For 16x16 game, I am still figuring out how to make the game generate faster. It might took up to 2-3 minutes to generate for 16x16 Sudoku (sometimes just few seconds).

At here I will show so picture of the game and I will upload the game for downloading in my website asap.

imageThe interface for 9x9 Sudoku game

image image

The interface for 16x16 Sudoku game without and with solution shown.

Please comment and also for those who want to have a look in this source code, please leave me your email at the comment so that I can send you the sources.

Sunday, May 1, 2011

Another Google AdWords Free Voucher to share.

 

          Here, I would like to share my Google AdWords voucher which given free by Google to me. This voucher can be used for advertising. The voucher value is RM125 and might be useful to those who planned to start out a small business. Since I had nothing to advertise, I shared it here for someone who need it. This voucher can only be claimed once so FIRST COME FIRST GET.

          Reminder, this voucher is for those who don’t have Google AdWords account. You will need to sign up here. This may require you to pay a minimum of RM20* activation fee.

When you sign up, there is a called ‘Promotional Code’ field where you can enter unique voucher code(including dashes). You can enter the following code to claim free RM125.

5NHR-HG6A-VPSK-3GVD-5TQS

The voucher expires on 15th May 2011.

 

*The activation fee might not be the latest. Refer to Google AdWords for confirmation.

Saturday, April 16, 2011

Picture Editor for inserting Text in VB.Net

 

      It had been few weeks after my last post. In this post, I will show a simple application that might be useful to some of you. A picture editor that only use for inserting text. As “picture speaks a thousand words”, I will show picture rather than explaining too much.

 

3First, open a picture from file menu.

12

Move your mouse cursor to where you want the text to be written to.
Notice that there are X and Y. X is to show mouse position X and Y is to show mouse position Y. After decide with the position, press enter and a textbox will appear at the top left. Enter the text you wish to. The font of the text can be changed by selecting from the option above.

15

The color of the text can also be changed by selecting from the option above.

9

After finish typing and changing text option, to write the string to the picture, just click on the yellow color button at the bottom right. The text will show and the button will turn green.

10

This is the result of the text. If you wish to save the picture, just click on the green button. If you wish to continue, you can return to above steps or you can actually insert your own X and Y position and press enter to insert text.

 

This picture editor will be uploaded in my website soon and I hope that it will helps someone who needs it.

Saturday, March 19, 2011

My simple way of XML serialization and deserialization in VB.net

 

         XML (Extensible Markup Language) is a language that designed to transport and store data. It is an universal language that can be used in many programming languages to store data. XML serialization is the method to import data into XML file while XML deserialization is the method to export data from XML file. I had created a method of serialization and deserialization of XML which might be used by most of the people but still, there are some people that don’t know how these works in VB.net.

        Here I included a sample test for my method. I put 11 checkboxes , 5 radiobuttons and 1 combobox in a form shown in the picture below.

image

Then insert the coding as following into this form source code.

Public Class Form1
Public str_filesavepath As String
Dim obj As New XML
Private Sub Form1_FormClosing(ByVal sender As Object, _
ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles Me.FormClosing
obj.submit()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
str_filesavepath = Environment.CurrentDirectory & "\Setting.xml"
If Not IO.File.Exists(str_filesavepath) Then
obj.submit()
End If
obj.getsetting()
End Sub
End Class

Create a class from Project>Add Class. Insert the following coding into the class.

Imports System.IO
Imports System.Xml.Serialization

Public Class XML

Public Sub submit()
Dim setting As New Properties()
setting.RadioButton1 = Form1.RadioButton1.Checked.ToString
setting.RadioButton2 = Form1.RadioButton2.Checked.ToString
setting.RadioButton3 = Form1.RadioButton3.Checked.ToString
setting.RadioButton4 = Form1.RadioButton4.Checked.ToString
setting.RadioButton5 = Form1.RadioButton5.Checked.ToString
setting.checkbox1 = Form1.CheckBox1.CheckState
setting.checkbox2 = Form1.CheckBox2.CheckState
setting.checkbox3 = Form1.CheckBox3.CheckState
setting.checkbox4 = Form1.CheckBox4.CheckState
setting.checkbox5 = Form1.CheckBox5.CheckState
setting.checkbox6 = Form1.CheckBox6.CheckState
setting.checkbox7 = Form1.CheckBox7.CheckState
setting.checkbox8 = Form1.CheckBox8.CheckState
setting.checkbox9 = Form1.CheckBox9.CheckState
setting.checkbox10 = Form1.CheckBox10.CheckState
setting.checkbox11 = Form1.CheckBox11.CheckState
setting.combobox1 = Form1.ComboBox1.Text
setting.Savefilepath = Form1.str_filesavepath
SerializeToXML(setting)
End Sub
Public Sub SerializeToXML(ByVal setting As Properties)
Dim serializer As New XmlSerializer(GetType(Properties))
Dim textWriter As TextWriter = New StreamWriter(Environment.CurrentDirectory _
& "\Setting.xml")
serializer.Serialize(textWriter, setting)
textWriter.Close()
End Sub


Public Sub getsetting()
Dim deserializer As New XmlSerializer(GetType(Properties))
Dim textReader As TextReader = New StreamReader(Environment.CurrentDirectory _
& "\Setting.xml")
Dim setting As Properties
setting = DirectCast(deserializer.Deserialize(textReader), Properties)
textReader.Close()
getData(setting)
End Sub

Public Sub getData(ByVal setting As Properties)
Form1.RadioButton1.Checked = setting.RadioButton1.ToString
Form1.RadioButton2.Checked = setting.RadioButton2.ToString
Form1.RadioButton3.Checked = setting.RadioButton3.ToString
Form1.RadioButton4.Checked = setting.RadioButton4.ToString
Form1.RadioButton5.Checked = setting.RadioButton5.ToString
Form1.CheckBox1.Checked = setting.checkbox1
Form1.CheckBox2.Checked = setting.checkbox2
Form1.CheckBox3.Checked = setting.checkbox3
Form1.CheckBox4.Checked = setting.checkbox4
Form1.CheckBox5.Checked = setting.checkbox5
Form1.CheckBox6.Checked = setting.checkbox6
Form1.CheckBox7.Checked = setting.checkbox7
Form1.CheckBox8.Checked = setting.checkbox8
Form1.CheckBox9.Checked = setting.checkbox9
Form1.CheckBox10.Checked = setting.checkbox10
Form1.CheckBox11.Checked = setting.checkbox11
Form1.ComboBox1.Text = setting.combobox1
Form1.str_filesavepath = setting.Savefilepath
End Sub

End Class

And add another class with the following coding.


Public Class Properties
Private Radiobutton(4) As String
Private Checkbox(10) As String
Private combobox(0) As String
Private filepath(1) As String
Public Property RadioButton1()
Get
Return Radiobutton(0)
End Get

Set(ByVal Value)
Radiobutton(0) = Value
End Set
End Property
Public Property RadioButton2()
Get
Return Radiobutton(1)
End Get

Set(ByVal Value)
Radiobutton(1) = Value
End Set
End Property

Public Property RadioButton3()
Get
Return Radiobutton(2)
End Get

Set(ByVal Value)
Radiobutton(2) = Value
End Set
End Property
Public Property RadioButton4()
Get
Return Radiobutton(3)
End Get

Set(ByVal Value)
Radiobutton(3) = Value
End Set
End Property
Public Property RadioButton5()
Get
Return Radiobutton(4)
End Get

Set(ByVal Value)
Radiobutton(4) = Value
End Set
End Property
Public Property checkbox1()
Get
Return Checkbox(0)
End Get
Set(ByVal value)
Checkbox(0) = value
End Set
End Property

Public Property checkbox2()
Get
Return Checkbox(1)
End Get
Set(ByVal value)
Checkbox(1) = value
End Set
End Property

Public Property checkbox3()
Get
Return Checkbox(2)
End Get
Set(ByVal value)
Checkbox(2) = value
End Set
End Property

Public Property checkbox4()
Get
Return Checkbox(3)
End Get
Set(ByVal value)
Checkbox(3) = value
End Set
End Property
Public Property checkbox5()
Get
Return Checkbox(4)
End Get
Set(ByVal value)
Checkbox(4) = value
End Set
End Property
Public Property checkbox6()
Get
Return Checkbox(5)
End Get
Set(ByVal value)
Checkbox(5) = value
End Set
End Property

Public Property checkbox7()
Get
Return Checkbox(6)
End Get
Set(ByVal value)
Checkbox(6) = value
End Set
End Property
Public Property checkbox8()
Get
Return Checkbox(7)
End Get
Set(ByVal value)
Checkbox(7) = value
End Set
End Property

Public Property checkbox9()
Get
Return Checkbox(8)
End Get
Set(ByVal value)
Checkbox(8) = value
End Set
End Property

Public Property checkbox10()
Get
Return Checkbox(9)
End Get
Set(ByVal value)
Checkbox(9) = value
End Set
End Property
Public Property checkbox11()
Get
Return Checkbox(10)
End Get
Set(ByVal value)
Checkbox(10) = value
End Set
End Property
Public Property combobox1()
Get
If combobox(0) = Nothing Then
Return "F5"
Else
Return combobox(0)
End If

End Get
Set(ByVal value)
combobox(0) = value
End Set
End Property
Public Property Savefilepath()
Get
Return filepath(1)
End Get
Set(ByVal value)
filepath(1) = value
End Set
End Property

End Class


With this, the XML serialization and deserialization will works. You might be thinking how to test whether it is working or not….


   To the the coding, just simply run the program and check or uncheck any checkbox and radiobutton. Beside that, you can also change the text in combobox. The default text in combobox is “F5” which is hard-coded in the coding. When you close the program, a Setting.xml file will be created in the directory where the .exe file is. You can open it with notepad or other text editor and you will see that any changes you makes will save inside the file. When you rerun the program, you can see that all changes had been saved.


    This is how xml file works nowadays. It used to stored data and then restores it back when you need it.

Sunday, March 13, 2011

My first Android apps–Bit Converter

 

   As my friend, Meng Suan and I planned to write a program for Bit Converter in android since October 2010, he had actually completed his program on 7th November 2010 and posted on his blog while I completed mine but not for android. Mine is in Visual Basic (posted at another blog of mine which is not updated for quite a long time) while he had done it using Google App Inventor within a day but as I mentioned in my previous post that I started to work at November 2010, I had no time for new programming language and at that time, I think that Java is a very hard programming language.

   The thought changes after I had been works for 3+ months. I had learnt from my supervisor that most of the languages are almost the same. The differences between programming languages is just the syntax. He said that, if you know the concept, it won’t be difficult at all. With this kind of thinking, I try to explore more about Eclipse and Java. I had downloaded some video tutorials from here. These videos are very useful for beginner in Eclipse and Java.

The following are pictures from my emulator showing my Bit Converter apps.

1

The interfaces with radio buttons selection for one kilo = 1024 or one kilo = 1000.

2

When click on the buttons, a dialog with radio buttons will shows.

3

The continue of the dialog. The conversion till Petabytes (same as my bit converter in visual basic)

4

The output after you select the unit you wish to convert to.

To download this apps, please visit my website. Please leave comments on any curiosity.