How To Print A Triangle In Java Using For Loop


hello guys , i remember what kind of homeworks in java students get at the start so i started to post solutions in this even i had to do this when i was doing java (a diploma) our sir asked us to make a program that prints out a triangle using For Loops so i created my own answer but my sir showed us a different one it doesn't even looks like a triangle but it has the triangle shape but mine is exactly a triangle .

this is my answer , NOTE : the easiest and the best way to print a real triangle



How To Make Label Typing Effect In VB.NET


For this tutorials we will need a timer and a label and a public string and a public integer thats all we need to begin add a label and add a timer now lets go do coding i have written the codes so no need to write one by one

Cryptographic Algorithms For VB.NET



I wanted to share some Cryptographic Algorithms with you all and by the way cryptographic is a very important resource for programmers all the way .

Triple DES - triple data encryption (3DES)

Imports System.Text
Imports System.Security.Cryptography

Public Class 3_DES
    Public Shared Function Encrypt(ByVal toEncrypt As String, ByVal key As String, ByVal useHashing As Boolean) As String
  Dim keyArray As Byte()
  Dim toEncryptArray As Byte() = UTF8Encoding.UTF8.GetBytes(toEncrypt)

  If useHashing Then
    Dim hashmd5 As New MD5CryptoServiceProvider()
    keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key))
  Else
    keyArray = UTF8Encoding.UTF8.GetBytes(key)
  End If

  Dim tdes As New TripleDESCryptoServiceProvider()
  tdes.Key = keyArray
  tdes.Mode = CipherMode.ECB
  tdes.Padding = PaddingMode.PKCS7

  Dim cTransform As ICryptoTransform = tdes.CreateEncryptor()
  Dim resultArray As Byte() = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length)

  Return Convert.ToBase64String(resultArray, 0, resultArray.Length)
    End Function
End Class

How To Make A GUI(Graphical User Interface) In Java

first java application

heyy guys !! i am back with java .. , so today i am gonna teach you how to make a your very first java GUI program after that i will write more tutorial on adding controls to the interface and giving click events .. , first of all open your favorite text editor and after that these are the codes i have written so go ahead and put them in

How To Add Facebook Comment Box To Your Website

facebook commenting

adding facebook comment made easy by facebook ! there are lots of use from using facebook comment box  instead other comment systems . if you have not seen a facebook comment box below are two designs that facebook gives you

facebook comment box - dark

facebook comment box

facebook comment box - light

facebook comment

ok now go to this link  scroll down and you will see something like this

set up facebook commenting

How To Make A Simple Digital Clock Using Javascript

digital clock javascript !!!!!

i remember i have written a tutorial on making a clock using javascript before but i know that it was not explained and that codes were not clean so i thought make it again with nice codes . first we need to create a html document to make a the javascript codes work or make the javascript functions work so go ahead and create a new html document and type the regular html tags and under head tag add these codes




now close the head tag and start the body tag now put these codes there




now close the body tag and check your html page boom ! a small digital clock in javascript ! you can also use some awesome css and some other things to make this beautiful !

How To Play A Wave Sound File In Background Mode In C#

wave file

this is gonna be a snippet and i call it a useful snippet , you just need to add a namespace and add 4 lines of codes to a event .

add this namespace :

Using System.Media;

after that you need to add these 4 lines of codes for a event (for example form_load , button_click)

SoundPlayer wave = new SoundPlayer();
            string path = "path to .WAV";
            wave.SoundLocation = path; 
            wave.Play(); 

now replace path to .WAV with the destination (for example C:/new folder/hello.wav)

i hope you enjoy this !

Drop Shadow At The Form Border In C#

shadow


i hope you guys didn't forget the same thing that i have written for VB.NET . alright like that we are now going to make the form border drop shadow that will make the form look awesome :) if your on a project that doesn't matter or create a new project to test it .

under

    public partial class Form1 : Form
    {


add these codes

 protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ClassStyle |= CS_DROPSHADOW;
                return cp;
            }
        }

now debug and enjoy the shadow

c# shadow at form

share ! comment ! like us on facebook ! follow us on twitter !

How To Validate Textbox : Only Numbers, Only Characters, Not Null, Only Email in VB.NET

vb.net , textbox


Today I have brought you something delicious :) so you guys wonder how it works , first we have to create a module and we just have to assign the textbox for a validation (Only Number,Only Characters,Not Null,Only Email) so first of all lets create a new module and add this codes

Imports System.Text.RegularExpressions
Module Module1
    Public Enum ValidationType
        Only_Numbers = 1
        Only_Characters = 2
        Not_Null = 3
        Only_Email = 4
    End Enum
    Public Sub AssignValidation(ByRef CTRL As Windows.Forms.TextBox, ByVal Validation_Type As ValidationType)
        Dim txt As Windows.Forms.TextBox = CTRL
        Select Case Validation_Type
            Case ValidationType.Only_Numbers
                AddHandler txt.KeyPress, AddressOf number_Leave
            Case ValidationType.Only_Characters
                AddHandler txt.KeyPress, AddressOf OCHAR_Leave
            Case ValidationType.Not_Null
                AddHandler txt.Leave, AddressOf NotNull_Leave
            Case ValidationType.Only_Email
                AddHandler txt.Leave, AddressOf Email_Leave
        End Select
    End Sub
    Public Sub number_Leave(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        Dim numbers As Windows.Forms.TextBox = sender
        If InStr("1234567890.", e.KeyChar) = 0 And Asc(e.KeyChar) <> 8 Or (e.KeyChar = "." And InStr(numbers.Text, ".") > 0) Then
            e.KeyChar = Chr(0)
            e.Handled = True
        End If
    End Sub
    Public Sub OCHAR_Leave(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
        If InStr("1234567890!@#$%^&*()_+=-", e.KeyChar) > 0 Then
            e.KeyChar = Chr(0)
            e.Handled = True
        End If
    End Sub
    Public Sub NotNull_Leave(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim No As Windows.Forms.TextBox = sender
        If No.Text.Trim = "" Then
            MsgBox("This field Must be filled!")
            No.Focus()
        End If
    End Sub
    Public Sub Email_Leave(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim Email As Windows.Forms.TextBox = sender
        If Email.Text <> "" Then
            Dim rex As Match = Regex.Match(Trim(Email.Text), "^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,3})$", RegexOptions.IgnoreCase)
            If rex.Success = False Then
                MessageBox.Show("Please Enter a valid Email Address", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
                Email.BackColor = Color.Red
                Email.Focus()
                Exit Sub
            Else
                Email.BackColor = Color.White
            End If
        End If
    End Sub
End Module

now lets test the module i mean lets add 4 textboxes and assign each for a validation and see whether it works !

add 4 textboxes  now add labels for each like this

validate textbox in vb.net

you can only enter numbers in textbox1
you can only enter characters in textbox2
you cannot leave textbox3 blank
you can only enter email in textbox4

now go to form_load event and add these codes

    

        AssignValidation(Me.TextBox1, ValidationType.Only_Numbers)
        AssignValidation(Me.TextBox2, ValidationType.Only_Characters)
        AssignValidation(Me.TextBox3, ValidationType.Not_Null)
        AssignValidation(Me.TextBox4, ValidationType.Only_Email)

thats where we assign the textbox for a validation !!

now lets test it just debug and try entering characters in textbox1 you cannot enter , go to textbox2 try entering characters you cannot enter , go to textbox3 and without entering anything go to textbox4 a message box will popup now go to textbox4 and enter something and click into another textbox and he textbox4 will be red in color and you will get a message

thanks for reading hope this is useful ! share ! comment !