Thursday, January 13, 2011

Basic Chemistry Syllabus upto 10th Standard Students

RAM RAM Friends

Basic Chemistry Syllabus upto 10th Standard Students

When I got chance to teach chemistry to students upto 10th standards, I found that they found chemistry very strange & non-understandable subject. So after spending some days with them, I observed that they don't know much about basics of Chemistry. So before getting started with their books, I teach them some basic topics of Chemistry which would be necessary & very helpful to understand & even love to study Chemistry.
So below is the very basic topics I used to cover before starting teaching Chemistry to make proper background in Chemistry so that they can understand Chemistry whenever & wherever they study it.
Due to lack of time, I had posted the pictures of syllabus as below









Note :-->>Request from all the teachers of entire universe
  • Please teach students by providing them real life examples in their local language so that they can understand much better & use the knowledge in their daily life (helping their friends, relatives, neighbors etc).
  • Please make classroom atmosphere friendly & fearless so that students can express their feelings, understand topic much better, & most important ask any Questions without any kind of hesitation.
  • Always remember, what you do with student, they may follow you & make future world the way you are as everyone know students are the future of any world.
I hope above information would be helpful.



Tuesday, January 11, 2011

How to make SQL Query to get Birthday & Anniversary Alert

RAM RAM Friends

How to get list of clients from Database whose Birthday or Anniversary would come within the next few days

When I got this problem, first I thought it would be normal & not tough.
But when I start working on it, I found it very very difficult & like anyone else I tried to find its solution on the Internet using Google etc, but after searching a lot for few days, I feel very upset as I didn't get the correct solution neither the hint to solve it.
But after getting tired from net, I never gave up & decided to solve this problem by my own way,
so after a lot of hard work I found the way & moreover when writing this blog, I also found other ways to make the whole procedure very simple.

Below is the summary of the whole procedure which I implemented in the project

Note: Please note that whole procedure is written in VB6.0  & MS SQL Server 2000


    Dim S As String, IsShow As Boolean
    Dim UserDays As Integer
    Dim AlertDt As Date, CurrentDt As Date, CurrentNextYrDt As Date

                CurrentDt = Format$(Now, "DD/MMM/YYYY")
                UserDays = Val(IIf(IsNull(GDREC!settingvalue) = False, GDREC!settingvalue, "0"))
                
                AlertDt = CurrentDt + UserDays

                CurrentNextYrDt = DateAdd("yyyy", 1, CurrentDt)

Note: In below SQL Query, 

  • All capital words are Keywords of SQL Server
  • CurrentDt="26Oct2010"
  • AlertDt="01Mar2011"  ,  (UserDays ="01Mar2011" - "26Oct2010")
  • CurrentNextYrDt="26Oct2011"
      SELECT  Bday,ClientId,ClientName,Phone,Mobile,AlterBDay
      FROM (SELECT Bday,ClientId,ClientName,Phone,Mobile,
                     CASE WHEN MONTH(BDay) < MONTH(GETDATE()) THEN
                                             DATEADD(YEAR,DATEDIFF(YEAR,BDay,'26Oct2011'),BDay)
                                 Else
                                            DATEADD(YEAR,DATEDIFF(YEAR,BDay,'26Oct2010'),BDay)
                                 END As AlterBDay
                       FROM ClientMaster WHERE BDay IS NOT NULL AND NOT(BDay='01Jan1900')
                    ) AS NewClientMaster
      WHERE AlterBDay BETWEEN '26Oct2010' AND '01Mar2011'
      ORDER BY AlterBDay


  • Explanation of above Query:
    • Here I have used one kind of Nested query with Case, When Else End As clause
    • Here I used nested query to return a table (view) from which main query extract desired data
    • In the nested query, I created one new column "AlterBDay" which use value of  BDay (Birthday) column &  have modified date by making year part to either current year or next year of BDay column according to AlertDt ("01Mar2011") value.
    • After studying & understanding the above query & you would certainly get lot of ideas to make this query more short & also easy to understand, as I think, this query would be more easy if you use/create Views instead of nested query.
  • Below is the use of above query in VB6 project
    • by passing the whole query in the string variable named "S"

                S = " SELECT Bday,ClientId,ClientName,Addr1,Phone,Mobile,AlterBDay "
                S = S & " FROM (SELECT Bday,ClientId,ClientName,Addr1,Phone,Mobile, "
                S = S & " CASE WHEN MONTH(BDay) < MONTH(GETDATE()) THEN "
                S = S & " DATEADD(YEAR,DATEDIFF(YEAR,BDay,'" & Format$(CurrentNextYrDt, "DD/MMM/YYYY") & "'),BDay) "
                S = S & " Else "
                S = S & " DATEADD(YEAR,DATEDIFF(YEAR,BDay,'" & Format$(CurrentDt, "DD/MMM/YYYY") & "'),BDay) "
                S = S & " END As AlterBDay "
                S = S & " FROM ClientMaster WHERE BDay IS NOT NULL AND NOT(BDay='01Jan1900') "
                S = S & " ) AS NewClientMaster WHERE AlterBDay BETWEEN '" & Format$(CurrentDt, "DD/MMM/YYYY") & "' AND '" & Format$(AlertDt, "DD/MMM/YYYY") & "' "
                S = S & " ORDER BY AlterBDay "

I hope this query would help you a lot in case you get this kind of problem.

Happy Programming.

I uses programming as a way to help people to make their life more comfortable.




    


Friday, January 7, 2011

Basic English Course Syllabus to read, write & understand English

RAM RAM Friends
Friends during my struggle days, I used to be a private tutor. As I live in town area, where most of the students of poor or middle class families who mostly study in Government schools, face lots of difficulty while studying English. When I got chance to teach them English, I have to teach them very basic things in English to make their base in the language. For this I have to teach the same topics to various students in different batches.
I had to remember all the topics & write them again & again. To overcome this problem I made Basic English Course Syllabus & then start teaching them according to that, this make me much comfortable & it would be very good for them to make quick revision & also help their friends & relative to learn it.
So keeping in mind these benefits, I decide to provide it online so that everyone in the world who want to learn English Language, would be benefited from it.


Please note that it is just a Syllabus.


Following are the various topics

  • Basic Formula for making Simple Sentence

Sub+HV+MV+Ob+Ad+.

where
Sub-->Subject (Who)
HV -->Helping Verb
Ob--->Object
           a. Living (Whom)
           b. Non Living (What)
Ad---->Adverb/Adjective
              Where
              When
              How
              Why

  • Following are very basic terms 

    • Subject Adv Object
      I    My  Me
      We  Our  Us



      You Your   You



      He His   Him
      She Her Her
      They Their Them
      It Its It


  • Below In More details
    • I My Mine Me Myself
      We Our Ours Us Ourselves





      You Your Yours You Yourself/Yourselves





      He His His Him Himself
      She Her Hers Her Herself
      They Their Theirs Them Themselves
      It Its Its ItItself

  • Some more Important Daily use Subjects etc
    • This
    • That

    • These
    • Those

  • Difference between Singular & Plural

  • Difference between A & An

  • Various Important Helping verbs (Most frequently used)
    • Is
    • Am
    • Are

    • Was
    • Were

    • Will be
    • Shall be

    • Will
    • Shall

    • Has
    • Have

    • Had

    • Will have
    • Shall have

    • Is to
    • Am to
    • Are to

    • Was to
    • Were to

    • Has to
    • Have to

    • Had to

    • Will have to
    • Shall have to

  • Modals (Special Helping Verbs)
    • Can
    • Could
    • May
    • Might
    • Should
    • Ought to
    • Need
    • Dare
    • Will
    • Shall
    • Would
    • Must

  • Some Important Sentence building words
    • It
    • There
    • Let
    • Would that ____ were____

  • Types of Sentences
    • Simple/Affirmative Sentences
    • Negative Sentences
    • Interrogative Sentences
      • Interrogative Sentences without wh-family
      • Interrogative Sentences with wh-family
        • Without Object
        • With Object
    • Interrogative Negative Sentences
      • Without wh-family
      • With wh-family
        • without object
        • with object
    • Imperative Sentences
  • Wh-Family words  (Most common are below)
    • Who
    • What
    • How
    • Where
    • When
    • Why
    • Whose
    • Whom
    • Which
    • How many
    • How much
    • How old
    • How far
    • How long
    • From where
    • To whom
    • In which
  • Various useful words (whose meaning one should know)
  • So This is because Thus
    Hence Therefore That is why
    But However Since
    As When Moreover
    Whatever Thereafter Whatsoever
    Because While Whereas
    Which Who That
    Already After Before
    Just For Of
    In Into On
    Onto From With
    Without Once Ago
    According to Opinion Latest
    At least At last Eventually
    Fortunately Unfortunately Till
    Until Etc. E.g.
    i.e. So on In case of
    Like Between Among
    Each other One another as well as
    if --- else otherwise instead of
    rather either--or neither--nor
    although--yet although----, on the other hand
    is called is known as only
    due to one of the most--- if ---- then
    if ---- , in order to as a result
    if

  • Now do following after learning all above
    • Tense chart
    • Tenses
    • Voices (Active voice & Passive voice)
    • Narration ( Direct & Indirect sentences)
    • Non-Finite
    • Complete any translation book
I hope it would be helpful for the persons who want to learn English language




Monday, January 3, 2011

How to send E-Mail from VB 6.0 via Internet

RAM RAM Friends
How to send E-Mail from VB 6.0 via Internet

When I got this work to implement in our project, first I got very excited but when I tried to search this topic on Internet via Google etc, I had to struggle a lot to find the correct method.

Here I would try to explain HOW TO SEND EMAIL FROM VB via INTERNET

Below is a very simple program to explain this


Private Sub cmdSend_Click()
    On Error GoTo ArunKakkarErr
    Dim iMsg As Object
    Dim iConf As Object
    Dim Flds As Variant
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    
    iConf.Load -1 ' CDO Source Defaults
    Set Flds = iConf.Fields
    Dim Schemas As String
    'Schemas = "http://schemas.Microsoft.Com/cdo/configuration/" 'causing error as it is very case sensitive
    Schemas = "http://schemas.microsoft.com/cdo/configuration/"
    With Flds
        .Item(Schemas & "smtpusessl") = 1 'True
        .Item(Schemas & "smtpauthenticate") = 1
        .Item(Schemas & "sendusername") = Trim(Me.txtMailId.Text) '"yourmail@gmail.Com"
        .Item(Schemas & "sendpassword") = Trim(Me.txtPwd.Text) '"yourpassword"
        .Item(Schemas & "smtpserver") = Trim(Me.txtSMPT.Text) '"smtp.Gmail.Com" it causes error as it is case sensitive, use "smtp.gmail.com"
        .Item(Schemas & "sendusing") = 2
        .Item(Schemas & "smtpserverport") = 25 '465 
        .Update
    End With
       
    strBody = Trim(Me.txtBody.Text) & vbCrLf & Now  '"Sample message " & Time
    
    With iMsg
        Set .Configuration = iConf
        .To = Trim(Me.txtTo.Text) 'sendto
        .CC = Trim(Me.txtCC.Text) '""
        .BCC = Trim(Me.txtBCC.Text) '""
        ' Note: The reply address is not working if you use this Gmail example
        ' It will use your Gmail address automatic. But you can add this line
        ' to change the reply address .ReplyTo = "Reply@something.Com"
        .From = Trim(Me.txtFrom.Text) '""
        .Subject = Trim(Me.txtSubject.Text) '"subject"
        .TextBody = strBody
        .AddAttachment Trim(Me.txtAttachment.Text)
        .AddAttachment Trim(Me.txtAttachment2.Text)
        .Send
    End With
    MsgBox ("Mail has been sent successfully, Please check the mail if you have any doubt.")

    Exit Sub
ArunKakkarErr:
    MsgBox "There is an error while sending mail. And details are =" & Err.Description
End Sub

Important Notes:
  1. Please Allow this program to access Internet in your Firewall setting or Antivirus program if they ask for it else you can't send the email.
  2. Your program may take time while sending email so make proper coding in your program so that user may know that your program is busy. ( e.g  by changing your mouse pointer etc)
  3. Please take the commented notes given in above code very seriously to get proper result.
Good luck for programming.

How to send SMS from VB 6.0 via Internet


RAM RAM Friends

At last I got time to write one of important topic here.
How to send SMS from VB6.0 via Internet

When I got this work to implement in our project, first I got very excited but when I tried to search this topic on Internet via Google etc, I had to struggle a lot to find the correct method.

Well We can send SMS from VB6.0 by two ways
  1. By using Internet (this method is explained Here )
  2. By Using Mobile Phone (Not explained here)


After long time, I finally got chance to provide download link to demo project which is below
The downloaded file is rar compressed. In case you don't have software to extract it, just download wrar320 or higher version free of cost from the internet via Google etc.
Please note: You need some valid Developer API.
Please either contact company or create an demo account to get developer API from the site, I had mentioned Below.

click here to Download SMS Demo project Setup without code 2.67mb

Here I would try to explain HOW TO SEND SMS FROM VB via INTERNET

  1. The very first thing is that U need to contact to any SMS Providers (e.g. in India some are
    1. http://www.mysmsmantra.com/
    2. http://www.smscountry.com/ (click on Register now button at top)
    3. http://www.freesmsapi.com/ (click on Sign Up button at top)
    4. http://mirchsms.com/bulk_sms.html (please contact at no. provided at top or email at bottom to request to get trial sms api ). I also tested it very well, you may also refer my name to them.)
  2. Now get the Developer API from these SMS Providers either by purchasing account or if you want to test before purchasing then you can ask these SMS Providers to provide you a free trial account so that you can test their service) 
    1. Below is one of the example of Developer API
    2. 'http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=demouser&password=399501089&sendername=DM&mobileno=919999999999&message=Hello"
  3. Now just use the following code in your VB program to send SMS
    1. Dim WinHttpReq As Object
    2. Dim sResult As String, strURL As String
    3. Set WinHttpReq = CreateObject("Msxml2.XMLHTTP")
    4. strURL="http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=demouser&password=399501089&sendername=DM&mobileno=919999999999&message=Hello"
    5. 'Replace the Message & MobileNo with the no to whom you want to send SMS
    6. With WinHttpReq
    7.       .Open "GET", strURL, False
    8.     .Send
    9.     sResult = .responseText
    10.  End With
    11. MsgBox "Status of Sent SMS  is=" & sResult
  4. Some Important notes We should keep in mind while Sending SMS
    1. Check the Maximum Message Length that you can send as allowed by your SMS Service Providers
    2. Check whether you have to make your Message encode according to WWW standards, confirm it from your SMS Providers
    3. While sending data over internet/network, some letters can not be sent as it is, they need to be converted to send them to internet. e.g " &"  can not be send as it, it needs to be converted to send it over internet.
      1. URL encoding converts characters into a format that can be transmitted over the Internet.
      2. For more information see following link
        1. http://www.w3schools.com/html/html_urlencode.asp
    4. Always Allow the access of your program to get connected with Internet which would be asked by the Firewall of your OS or Antivirus program else you could not send SMS 
    5. As sending SMS may take time, you should do appropriate changes in your program to show user that your program is busy in sending SMS like change Mouse Pointer Shape from normal to HourGlass & after sending make it normal.

After long time, I finally got chance to provide download link to demo project which is below
The downloaded file is rar compressed. In case you don't have software to extract it, just download wrar320 or higher version free of cost from the internet via Google etc.
Please note: You need some valid Developer API.
Please either contact company or create an demo account to get developer API from the site, I had mentioned above.


Below is a sample which I used in my project 






Private Sub cmdSMSTest_Click()
    'validate information
  'Message(max 160 Chars)


    Me.MousePointer = 11 'Hourglass
    Call SendMySMS(myMob, myMsg, True, Trim(Me.txtSMSDeveloperAPI),  Trim(Me.txtSMSMobileText), Trim(Me.txtSMSMsgText))
    Me.MousePointer = 0 'Default


End Sub


Public Function SendMySMS(ByVal myMob As String, ByVal myMsg As String, Optional ByVal IsTest As Boolean = False, Optional ByVal UserDeveloperAPI As String = "", Optional ByVal MobText As String = "", Optional ByVal MsgText As String = "", Optional ByVal AskToSend As Boolean = True, Optional ByVal ShowStatus As Boolean = True) As Boolean


'Here you write your code

Following is the sample code to test it--- but of course you need Developer API to use the code


Private Sub cmdSMSTest_Click()
    'validate information
    'Message(max 160 Chars)
    If Me.chkSMSActivateService.Value = 0 Or Len(Me.txtSMSDeveloperAPI) < 1 Or Len(Me.txtSMSMobileText) < 1 Or Len(Me.txtSMSMessageText) < 1 Then
        MsgBox "Please enter all setting values"
        Me.txtSMSDeveloperAPI.SetFocus
        Exit Sub
    End If
 
 
    Dim s As String
    Dim myMob As String
    Dim myMsg As String
 
    s = "Enter Mobile nos separated by , then put @ now write your msg not more than 160 chars"
    s = s & vbCrLf & "e.g 9971745868,9811994797@Hi this is test sms by ABM Infotech"
    s = InputBox(s, , "9971745868,9811360935@Hi this is test sms by ABM Infotech")
    myMsg = Mid(s, InStr(1, s, "@", vbTextCompare) + 1)
    If Len(myMsg) > 155 Then
        myMsg = Left$(myMsg, 155)
    End If
    myMob = Mid(s, 1, InStr(1, s, "@", vbTextCompare) - 1)
 
    Me.MousePointer = 11 'Hourglass
    Call SendMySMS(myMob, myMsg, True, Trim(Me.txtSMSDeveloperAPI), Trim(Me.txtSMSMobileText), Trim(Me.txtSMSMessageText))
    Me.MousePointer = 0 'Default

End Sub

Public Sub SendMySMS(ByVal myMob As String, ByVal myMsg As String, Optional ByVal IsTest As Boolean = False, Optional ByVal UserDeveloperAPI As String = "", Optional ByVal MobText As String = "", Optional ByVal MsgText As String = "", Optional ByVal AskToSend As Boolean = True, Optional ByVal ShowStatus As Boolean = True)
    'myMob,myMsg, Optional IsTest,UserDeveloperAPI , MobText, MsgText,AskToSend ,ShowStatus As Boolean = True
    On Error GoTo ArunKakkarErr
 
    Dim sMobText1 As String
    Dim sMobText2() As String
    Dim sMobText3() As String
 
    Dim sResult As String, strURL As String
    strURL = ""
 
    If IsTest Then
     
    Else 'retrieve settings from db
         '''SMS_IsActivate        1,0 SMS_DeveloperAPI SMS_MobileText SMS_MessageText
         If UserPreferencesGetValue("SMS_IsActivate", "0") = "0" Then Exit Sub
         UserDeveloperAPI = UserPreferencesGetValue("SMS_DeveloperAPI")
         MobText = UserPreferencesGetValue("SMS_MobileText")
         MsgText = UserPreferencesGetValue("SMS_MessageText")
    End If
 
 
    'To put 91 etc for more than one mobile nos
    sMobText2 = Split(MobText, "=")
    sMobText1 = ""
    If UBound(sMobText2) > 0 Then
        sMobText1 = sMobText2(1) '2nd element
    End If
    If Len(sMobText1) > 0 Then
        sMobText3 = Split(myMob, ",")
        If UBound(sMobText3) > 0 Then
            myMob = ""
            For i = LBound(sMobText3) To UBound(sMobText3)
                If myMob = "" Then
                    myMob = sMobText3(i) '1st Mobile No
                Else
                    myMob = myMob & "," & sMobText1 & sMobText3(i) '2nd, 3rd, 4th Mob No
                End If
            Next i
        End If
    End If
 
 
    strURL = UserDeveloperAPI & "&" & MobText & myMob & "&" & MsgText & myMsg
 
    If AskToSend Then
        If MsgBox("Do you want to send SMS?", vbYesNo + vbDefaultButton1) = vbNo Then
            Exit Sub
         
        End If
    End If
    Dim WinHttpReq As Object
 
    Set WinHttpReq = CreateObject("Msxml2.XMLHTTP")
    'strURL = "http://bulksms.mysmsmantra.com:8080/WebSMS/SMSAPI.jsp?username=demouser&password=399501089&sendername=DM&mobileno=919999999999&message=Hello"
    'Replace the Message & MobileNo with the no to whom you want to send SMS
    With WinHttpReq
          .Open "GET", strURL, False
        .Send
        sResult = .responseText
    End With
    If ShowStatus Then MsgBox "Status of Sent SMS  is=" & sResult
   
    Exit Sub
ArunKakkarErr:
    MsgBox ("Sorry there is some error while sending sms" & vbCrLf & Err.Description)
 
End Sub



Public Function UserPreferencesGetValue(ByVal SettingName As String, Optional ByVal DefaultValue As String = "", Optional ByVal myTable As String = "UserPreferences", Optional ByVal NameCol As String = "SettingName", Optional ByVal ValueCol As String = "SettingValue")
    Dim s As String
    s = ""
    Dim rptRs As New ADODB.Recordset
    If rptRs.State Then rptRs.Close
    rptRs.Open "select * from " & myTable & " where " & NameCol & "='" & SettingName & "'", Scon, adOpenStatic, adLockReadOnly
    If rptRs.EOF = False Then '  if already present then return
        s = IIf(IsNull(rptRs!SettingValue) = False, rptRs!SettingValue, DefaultValue)
    Else ' if not present then return default
        s = DefaultValue
    End If
    UserPreferencesGetValue = s
End Function

Public Sub UserPreferencesSetValue(ByVal SettingName As String, ByVal SettingValue As String, Optional ByVal myTable As String = "UserPreferences", Optional ByVal NameCol As String = "SettingName", Optional ByVal ValueCol As String = "SettingValue")
    Dim rptRs As New ADODB.Recordset
    If rptRs.State Then rptRs.Close
    rptRs.Open "select * from " & myTable & " where " & NameCol & "='" & SettingName & "'", Scon, adOpenStatic, adLockReadOnly
    If rptRs.EOF = False Then '  if already present then update
        Scon.Execute "Update " & myTable & " set " & ValueCol & "  = '" & SettingValue & "' where " & NameCol & " = '" & SettingName & "'"
    Else ' if not present then insert
        Scon.Execute "Insert into " & myTable & " (" & NameCol & "," & ValueCol & ") values ('" & SettingName & "','" & SettingValue & "')"
    End If
End Sub

Public Sub AKakkar_Error(Optional ByVal Source As String = "")
    Dim s As String
    s = "Sorry for the inconvinence, There is some error"
    s = s & vbCrLf & "ABM Source=" & Source
    s = s & vbCrLf & "Error No=" & Err.Number
    s = s & vbCrLf & "Error Description=" & Err.Description
    s = s & vbCrLf & "Error Source=" & Err.Source
    MsgBox s, vbCritical
End Sub

Note:::>>>> If someone need sample program, just mail me, I would like to help you.


Now after learning it you can explore it in details to get more powerful options for your programs.
Best of Luck for Programming.