BestChange - exchange monitor, earn as an affiliate!

Friday, October 12, 2012

Reset MySQL root password – Windows 7

STEP #1: Go to START / CONTROL PANEL and click on System and Security
STEP #2: Click on Administrative Tools and select Services
STEP #3: Scroll down and stop MYSQL service
STEP #4: Now go to START / ALL PROGRAMS / ACCESSORIES and right click on Command Prompt – Select RUN as Administrator
STEP #5: Repeat it so you have two Command prompt windows running on your desktop.
STEP #6: In each of the Command prompt windows navigate to 
C:\Program Files\Mysql\Mysql server 5.1\bin>
STEP #7: In first Command prompt window type: mysqld.exe –skip-grant-tables and press ENTER
STEP #8: Go to second Command prompt window and type: mysql.exe –u root mysql and press ENTER, you should be granted access and be in mysql> prompt
STEP #9: Now while at the mysql> type here UPDATE mysql.user SET Password=PASSWORD(‘new password’) WHERE User=’root’ and press ENTER
STEP #10: If everything worked, you should receive QUERY OK
STEP #11: Now type FLUSH PRIVILLEGES; and press ENTER, you will receive another Query OK
STEP #12: Now you have to just reboot your machine and once you are back you should be able to log on with your new password. 


Thursday, September 27, 2012

Select Griview row by clicking anywhere

1. Add a CommandArgument to the link button.
<asp:LinkButton ID="LinkBtn3" runat="server" CommandName="Date" CommandArgument='<%# Eval("id") %>'  Text='<%#Eval("id") %>' Font-Underline="false" ForeColor="Black"></asp:LinkButton>
2. In the RowDataBound event
e.Row.Attributes.Add("onclick", Page.ClientScript.GetPostBackEventReference(DirectCast(sender, System.Web.UI.Control), "Select$" + e.Row.RowIndex.ToString()))
3. Then on the RowCommand Event:
If e.CommandName = "Select" Then
GrvDraft.EditIndex = e.CommandArgument
End If
4. If you get this error: Invalid postback or callback argument. Add this.
Protected Overloads Overrides Sub Render(ByVal writer As HtmlTextWriter)
For i As Integer = 0 To Me.GrvDraft.Rows.Count - 1
Page.ClientScript.RegisterForEventValidation(Me.GrvDraft.UniqueID, "Select$" & i)
Next
MyBase.Render(writer)
End Sub

Friday, September 21, 2012

Gridview with ImageURL

<asp:GridView ID="gvEmployees" runat="server" AutoGenerateColumns="False" pagesize="5" AllowPaging="True">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Team" HeaderText="Team" />
<asp:BoundField DataField="dateHired" HeaderText="Date Hired"
DataFormatString="{0:MMMM dd, yyyy}" />
<asp:BoundField DataField="empStatus" HeaderText="Employment Status" />
<asp:BoundField DataField="birthday" HeaderText="Birthday" />
<asp:BoundField DataField="civilStatus" HeaderText="Civil Status" />
<asp:BoundField DataField="noOfChildren" HeaderText="No. Of Children" />
<asp:BoundField DataField="cellphoneNo" HeaderText="Cellphone #" />
<asp:BoundField DataField="address" HeaderText="Address" />
<asp:BoundField DataField="contactPerson" HeaderText="Contact Person" />
<asp:BoundField DataField="contactNo" HeaderText="Emergency #" />
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl ='<%# "~/Images/EmpImage/"+Eval("idemployee").tostring()+".png" %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>

Thursday, July 19, 2012

Encryption


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Public Function SimpleCrypt(ByVal Text As String) As String
' Encrypts/decrypts the passed string using 
' a simple ASCII value-swapping algorithm
Dim strTempChar As String, i As Integer
For i = 1 To Len(Text)
  If Asc(Mid$(Text, i, 1)) < 128 Then
    strTempChar = _
CType(Asc(Mid$(Text, i, 1)) + 128, String)
  ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
    strTempChar = _
CType(Asc(Mid$(Text, i, 1)) - 128, String)
  End If
  Mid$(Text, i, 1) = _
      Chr(CType(strTempChar, Integer))
Next i
Return Text
End Function


Monday, July 2, 2012

C++ Notes

VARIABLES
variables must be:
declared (the type of variable)
defined (values assigned to a variable)
before it can be used in a program.

DATA TYPES
C++ supports the following inbuilt data types:-
int (to store integer values),
float (to store decimal values),
char (to store characters),
bool (to store Boolean value either 0 or 1) and
void (signifies absence of information).

KEYWORDS
reserved wordsjavascript:void(0)

IDENTIFIERS
name of functions, variables, classes, arrays etc.

CONSTANTS
fixed values which cannot change.

Friday, June 29, 2012

Layered Web Applications with ASP.NET

In the diagram in figure 1 you see a process go around in a counter clockwise direction. The process goes through the following 6 steps:



  1. The Presentation layer asks the BLL for some object, for example a contact person.

  2. The BLL can optionally perform some validation (for example, is the current user allowed to make this call?) and then forwards the request to the DAL.

  3. The DAL connects to the database and asks it for a specific record.

  4. When the record is found, it is returned from the database to the DAL.

  5. The DAL wraps the database data in a custom object and returns it to the BLL.

  6. Finally, the BLL returns the object to the Presentation layer, where it could be displayed on a web page for example.



Microsoft Visual Studio 2005 Express Edition full version download


Microsoft Visual Web Developer 2005 express edition offline installer download
Microsoft Visual c++ 2005 express edition offline installer download
Microsoft Visual Basic 2005 express edition offline installer download
Microsoft Visual C# 2005 express edition offline installer download
Microsoft Visual J# 2005 express edition offline installer download

InstallerSize.IMG file.ISO file
Visual Web Developer 2005
Express Edition
449,848 KB.IMG file.ISO file
Visual Basic 2005 Express Edition445,282 KB.IMG file.ISO file
Visual C# 2005 Express Edition445,282 KB.IMG file .ISO file
Visual C++ 2005 Express Edition474,686 KB.IMG file .ISO file
Visual J# 2005 Express Edition448,702 KB.IMG file .ISO file


Broken link? 
Need help in finding an ebook/pdf or installer?

Tuesday, June 26, 2012

Get values of selected row in Datagrid

1
2
3
4
5
6
    Protected Sub gvPhonebook_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles gvPhonebook.SelectedIndexChanged
Dim i As Integer = gvPhonebook.SelectedRow.RowIndex
txtGSMNo.Text = gvPhonebook.Rows(i).DataItem("gsmno")
txtName.Text = gvPhonebook.Rows(i).DataItem("name")
ddlTeams.Text = gvPhonebook.Rows(i).DataItem("team")
End Sub

Read Excel Cells and Rows

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim oExcel As Object
oExcel = CreateObject("Excel.Application")
Dim wbk As Object

wbk = oExcel.Workbooks.Open(Filename:="C:\Users\Dev1\Downloads\11-21-2011\Quest Technology Report - InVoice Account Daily_13-12-01-2011.xls", UpdateLinks:=False, ReadOnly:=False)
Dim firstletter As Integer = 65 '65 =A 90 Z
Dim secondletter As Integer = 0


' "Zipp Technologies LTD" last


objConn.open()
'For i As Integer = 5089 To 5937
For i As Integer = 4 To 102

With wbk.ActiveSheet

'For j = 2 To 5
firstletter = firstletter + 1

'If Len((.Range(Chr(firstletter) & "1").value)) > 0 Then

ListBox1.Items.Add(.Cells(i, 2).Value & "-" & formatDate(.Cells(i, 3).Value))

Dim CountSQl As String = "select * from invoice where accountno = '" & RTrim(.Cells(i, 2).Value) & "' and dateissue = '" & formatDate(.Cells(i, 3).Value) & "' and productcode = '" & .Cells(i, 9).Value & "'"

Dim cmd As OdbcCommand = New OdbcCommand(CountSQl, objConn)
Dim reader As OdbcDataReader
reader = cmd.ExecuteReader()


If reader.Read() Then
txtAccountNo.Text &= (.Cells(i, 2).Value)
'insertInvoice(.Cells(i, 2).Value, formatDate(.Cells(i, 3).Value), .Cells(i, 4).Value, .Cells(i, 5).Value, .Cells(i, 7).Value, .Cells(i, 8).Value, .Cells(i, 9).Value, .Cells(i, 11).Value)
Else
insertInvoice(RTrim(.Cells(i, 2).Value), formatDate(.Cells(i, 3).Value), .Cells(i, 4).Value, .Cells(i, 5).Value, .Cells(i, 7).Value, .Cells(i, 8).Value, .Cells(i, 9).Value, .Cells(i, 10).Value, .Cells(i, 11).Value)

End If




reader.Close()


'insertSimorder(.Cells(i, 1).Value, .Cells(i, 2).Value, .Cells(i, 3).Value, .Cells(i, 4).Value, .Cells(i, 5).Value, .Cells(i, 6).Value, .Cells(i, 7).Value, .Cells(i, 8).Value, .Cells(i, 9).Value, .Cells(i, 10).Value, .Cells(i, 11).Value, .Cells(i, 12).Value, .Cells(i, 13).Value, .Cells(i, 14).Value, "0000-00-00", .Cells(i, 16).Value, formatDate(.Cells(i, 17).Value), .Cells(i, 18).Value, .Cells(i, 19).Value)

'updateAcctMgr(.Range(Chr(firstletter) & "29").value(), searchClientID(.Range(Chr(firstletter) & "1").value()).Tables(0).Rows(0).Item("carrierDetailsID"))
'insertSimrequest(.Cells(i, 2).Value, .Cells(i, 3).Value, .Cells(i, 4).Value, .Cells(i, 5).Value, .Cells(i, 6).Value, .Cells(i, 7).Value, .Cells(i, 8).Value, .Cells(i, 9).Value, .Cells(i, 10).Value, .Cells(i, 13).Value, formatDate(.Cells(i, 19).Value), formatDate(.Cells(i, 21).Value), .Cells(i, 22).Value, .Cells(i, 23).Value, .Cells(i, 14).Value)
'insertSimrequest(.Cells(i, 2).Value, .Cells(i, 3).Value, .Cells(i, 4).Value, .Cells(i, 5).Value, .Cells(i, 6).Value, .Cells(i, 7).Value, .Cells(i, 8).Value, .Cells(i, 9).Value, .Cells(i, 10).Value, .Cells(i, 13).Value, formatDate(.Cells(i, 19).Value), formatDate(.Cells(i, 21).Value), .Cells(i, 22).Value, .Cells(i, 23).Value, .Cells(i, 15).Value)
'insertSimrequest(.Cells(i, 2).Value, .Cells(i, 3).Value, .Cells(i, 4).Value, .Cells(i, 5).Value, .Cells(i, 6).Value, .Cells(i, 7).Value, .Cells(i, 8).Value, .Cells(i, 9).Value, .Cells(i, 10).Value, .Cells(i, 13).Value, formatDate(.Cells(i, 19).Value), formatDate(.Cells(i, 21).Value), .Cells(i, 22).Value, .Cells(i, 23).Value, .Cells(i, 16).Value)


'End If


If firstletter = 90 Then
firstletter = 65
If secondletter = 0 Then secondletter = 65

If secondletter > 0 Then
secondletter = secondletter + 1
End If

End If


'Next

End With



Next
oExcel.Workbooks.close()
objConn.close()


MsgBox("done")



End Sub

Formatting Date

1
2
3
4
5
6
7
8
    Public Function formatDate(ByVal strDate As String) As String
' Dim now As DateTime = Convert.ToDateTime(strDate)
Dim newDate As String

newDate = Format(CDate(strDate), "yyyy-MM-dd HH:mm:ss")

Return newDate
End Function

Database Connection

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
     Public Function MyDataSet(ByVal strSQL As String) As DataSet
Dim ds As New DataSet
Dim mycmd As MySqlCommand = New MySqlCommand(strSQL, objConn)
Dim ad As MySqlDataAdapter = New MySqlDataAdapter
ad.SelectCommand = mycmd
objConn.Open()
ad.Fill(ds, "a")
objConn.Close()
Return ds
End Function

Public Function MsDataset(ByVal strSQL As String, ByVal strConn As String) As DataSet
Dim ds As New DataSet
Dim newStrConn As New SqlConnection(strConn)
Dim sqlcmd As SqlCommand = New SqlCommand(strSQL, newStrConn)
Dim ad As SqlDataAdapter = New SqlDataAdapter
ad.SelectCommand = sqlcmd
newStrConn.Open()
ad.Fill(ds, "a")
newStrConn.Close()
Return ds
End Function