Tuesday, June 30, 2015

typeof in C# Me.GetType() in VB.net

Thursday, June 25, 2015

ERROR: Failed to backup website http://localhost

ERROR: Failed to backup website http://localhost/....

just delete that project from solution and added it back from the correct file folder.


Wednesday, June 24, 2015

Troubleshooting 503 "service unavailable" errors

http://mvolo.com/where-did-my-iis7-server-go-troubleshooting-503-quotservice-unavailablequot-errors/

Saturday, June 20, 2015

Friday, June 19, 2015

Fix MHT if missing two "-" at the end of file

Below seemed to work for me.

  Sub Main()
        Dim inputfile As String = "c:\6.mht"
        FixMht(inputfile)

    End Sub
    Private Sub FixMht(ByVal tempFileName As String)
        Dim all As String = File.ReadAllText(tempFileName)
        Dim last As Integer = all.LastIndexOf("------=_NextPart_000_00")
        Dim newall As String = all.Remove(last)
        Dim builder As New StringBuilder
        builder.Append(newall)
        builder.Append("------=_NextPart_000_00--")
        File.WriteAllText(tempFileName, builder.ToString, Encoding.UTF8)

    End Sub

Tuesday, June 16, 2015

Execl can not take one ', you have to use two ''

I tried to concatenate strings enter one ' in one row, it will not do it, you have to use two ''

Monday, June 8, 2015

DB2 SQL needs less than 80 characters for mainframe FTP whatever

'This routine fix the input file which just SQL for DB2 and split them into less than 80 characters per 'line

Imports System.IO
Module Module1

    Sub Main()
        'Dim inputfile As String = "c:\aurorasql.txt"
        'Dim outputfile As String = "c:\out.txt"
        Dim inputfile As String = "c:\printer.txt"
        Dim outputfile As String = "c:\outprinter.txt"

        ' split SQL statement into less than length 80
        ' first separate by ","
        ' the first line has SQL command "insert" and it is default lenght is less than 80 so no need of comma
        ' others than need comma

        Using sw As StreamWriter = New StreamWriter(outputfile, True)

            For Each line As String In File.ReadLines(inputfile)
                'Console.WriteLine(line)
                Dim len = 80
                Dim arr = line.Split(",")
                For Each Str As String In arr
                    If Str.Length > 80 Then
                        sw.Write(",")
                        Dim arr1 = Str.Split(" ")
                        Dim str2 As String = String.Empty
                        For Each str1 As String In arr1
                            str2 = str2 & str1 & " "
                            If str2.Length > 70 Then 'this is just make sure total is less than 80
                                sw.WriteLine(str2)
                                str2 = String.Empty
                            End If
                        Next

                        sw.WriteLine(str2)
                        str2 = String.Empty
                    Else
                        If Str.Contains("INSERT") Then
                            sw.WriteLine(Str)
                        Else
                            sw.WriteLine(" ," & Str)
                        End If
                    End If
                Next

            Next
        End Using
        Console.WriteLine("done")
    End Sub

End Module

Saturday, June 6, 2015

SPA examples

http://jaliyaudagedara.blogspot.com/2014/06/creating-empty-aspnet-project-powered.html?m=1