Stored procedure working when run manually, not running in SQL Agent Job XML sp_OACreate

1
down vote
accepted
I had this same issue when google geocoding and parsing the XML result. Seems that when run via an SQL job the XML result was being truncated.

Found the solution here: http://www.progtown.com/topic376715-a-problem-with-spoagetproperty-p2.html

Had to put:

SET TEXTSIZE 2147483647;
at the start of my stored proc.

The decision: in the procedure beginning to write the instruction

SET TEXTSIZE 2147483647

Or any other size, sufficient what to find room returned http the server for the answer.
The reason of such behavior of the server, I think, it is clear.
The moderator: and for zoom-in – the warning

http://www.progtown.com/topic376715-a-problem-with-spoagetproperty-p2.html

Detect hashchange and hash existed code run duplicate?

https://stackoverflow.com/questions/33056521/detect-hashchange-and-hash-existed-code-run-duplicate

var hash = ”;
$(document).load(function() {
$(window).trigger(‘hashchange’);
});

$(window).on(‘hashchange’, function() {
if (hash == window.location.hash) {
// do nothing, hash is the same as it was previously
return;
}

hash = window.location.hash;

if (hash) {
alert(“Apple”);
}
});

Prevent Truncation of Dynamically Generated Results in SQL Server Management Studio

Changing the Setting From The Tools Menu
In the Options dialog box of Tools Menu, expand Query Results, expand SQL Server and then select Results to Text as shown in the image below. In the right side panel change the value of Maximum number of characters displayed in each column to 8192. Click OK to save the changes as shown in the image below. The changes will go into effect once you open a new query window.

https://www.mssqltips.com/sqlservertip/2795/prevent-truncation-of-dynamically-generated-results-in-sql-server-management-studio/

Steps

Turn svg to font icons

About
IcoMoon is striving to build and provide the best iconography and icon management tool for perfectionists. IcoMoon’s icon library features only the very best icon sets out there. All of our icons are designed on a precise pixel grid. The IcoMoon app lets you build and use your own icon packs in many different formats including SVG, Polymer, PDF, XAML, CSH, icon font or simple PNG/CSS sprites.

https://icomoon.io/

Send excel file to user in web

Private Sub ExportFile(ByVal strfilePath As String, ByVal strFilename As String)
Try
Response.Clear()
Response.ContentType = “application/vnd.ms-excel”
strfilePath = Server.MapPath(strfilePath)
If Not System.IO.File.Exists(strfilePath) Then
strfilePath = Server.MapPath(“~//Data//ExportToExcel//NoRecord.xls”)
Response.AddHeader(“content-disposition”, (“attachment;filename=” + (“NoRecord” + “.xls”)))
Else
Response.AddHeader(“content-disposition”, (“attachment;filename=” _
+ (strFilename + “.xls”)))
End If

Dim sourcefile As FileStream = New FileStream(strfilePath, FileMode.Open)
Dim filesize As Long
filesize = sourcefile.Length
Dim getcontent() As Byte = New Byte((CType(filesize, Integer)) – 1) {}
sourcefile.Read(getcontent, 0, CType(sourcefile.Length, Integer))
sourcefile.Close()
Response.BinaryWrite(getcontent)
Catch ex As Exception
ex = ex
Finally
Response.End()
End Try

End Sub

Export data from a DataSet into a real Excel 2007 file Open XML SDK

Ever wanted to add an “Export to Excel” function to your ASP.Net, WinForms or WPF application ?

This free C# and VB.Net library lets you export a DataTable or DataSet of data into a “real” Excel 2007 .xlsx file, using one line of code.

DocumentFormat.OpenXml.dll
From the Microsoft Open XML SDK library
WindowsBase.dll
From the Microsoft .Net Framework library

————————————————————————————

Public Class CreateExcelFile
Public Shared Function CreateExcelDocument(Of T)(ByVal list As List(Of T), ByVal xlsxFilePath As String) As Boolean
Dim ds As New DataSet()
ds.Tables.Add(ListToDataTable(list))

Return CreateExcelDocument(ds, xlsxFilePath)
End Function

‘ This function is adapated from: http://www.codeguru.com/forum/showthread.php?t=450171
‘ My thanks to Carl Quirion, for making it “nullable-friendly”.
Public Shared Function ListToDataTable(Of T)(ByVal list As List(Of T)) As DataTable

Dim dt As New DataTable
Dim row As DataRow
For Each info As System.Reflection.PropertyInfo In list.GetType().GetProperties()
dt.Columns.Add(New DataColumn(info.Name, GetNullableType(info.PropertyType)))
Next

For Each tValue As T In list

row = dt.NewRow()
For Each info As System.Reflection.PropertyInfo In list.GetType().GetProperties()

If Not IsNullableType(info.PropertyType) Then
row(info.Name) = info.GetValue(tValue, Nothing)
Else
row(info.Name) = info.GetValue(tValue, Nothing)
End If
Next
dt.Rows.Add(row)
Next
Return dt
End Function

Public Shared Function GetNullableType(ByVal t As Type) As Type

Dim returnType As Type = t

If (t.IsGenericType Or t.GetGenericTypeDefinition() Is GetType(Nullable(Of ))) Then
returnType = Nullable.GetUnderlyingType(t)
End If

Return returnType

End Function

Public Shared Function IsNullableType(ByVal type As Type) As Boolean

Return (type Is GetType(String) Or
type.IsArray Or
(type.IsGenericType And type.GetGenericTypeDefinition() Is GetType(Nullable(Of ))))
End Function

Public Shared Function CreateExcelDocument(ByVal dt As DataTable, ByVal xlsxFilePath As String) As Boolean

Dim ds As New DataSet
ds.Tables.Add(dt)

Return CreateExcelDocument(ds, xlsxFilePath)
End Function

Public Shared Function CreateExcelDocument(ByVal ds As DataSet, ByVal excelFilename As String) As Boolean
Try
Using document As SpreadsheetDocument = SpreadsheetDocument.Create(excelFilename, SpreadsheetDocumentType.Workbook)

Dim workbook As WorkbookPart = document.AddWorkbookPart

‘ document.AddWorkbookPart()
document.WorkbookPart.Workbook = New DocumentFormat.OpenXml.Spreadsheet.Workbook()

‘ My thanks to James Miera for the following line of code (which prevents crashes in Excel 2010)
document.WorkbookPart.Workbook.Append(New BookViews(New WorkbookView()))

‘ If we don’t add a “WorkbookStylesPart”, OLEDB will refuse to connect to this .xlsx file !
Dim workbookStylesPart As WorkbookStylesPart = document.WorkbookPart.AddNewPart(Of WorkbookStylesPart)(“rIdStyles”)

Dim stylesheet As New Stylesheet
workbookStylesPart.Stylesheet = stylesheet
workbookStylesPart.Stylesheet.Save()

‘ Dim sp As WorkbookStylesPart = document.WorkbookPart.AddNewPart(Of WorkbookStylesPart)()

CreateParts(ds, document)

End Using
‘Trace.WriteLine(“Successfully created: ” + excelFilename)
Return True

Catch ex As Exception
‘ Trace.WriteLine(“Failed, exception thrown: ” + ex.Message)
Return False
End Try

End Function

Private Shared Sub CreateParts(ByVal ds As DataSet, ByVal spreadsheet As SpreadsheetDocument)

‘ Loop through each of the DataTables in our DataSet, and create a new Excel Worksheet for each.
Dim worksheetNumber As UInt64 = 1
For Each dt As DataTable In ds.Tables
‘ For each worksheet you want to create
Dim workSheetID As String = “rId” + worksheetNumber.ToString()
Dim worksheetName As String = dt.TableName

Dim newWorksheetPart As WorksheetPart = spreadsheet.WorkbookPart.AddNewPart(Of WorksheetPart)()
newWorksheetPart.Worksheet = New DocumentFormat.OpenXml.Spreadsheet.Worksheet()

‘ If you want to define the Column Widths, you need to do this *before* appending the SheetData
http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/1d93eca8-2949-4d12-8dd9-15cc24128b10/

‘ If you want to calculate the column width, it’s not easy. Have a read of this article:
http://polymathprogrammer.com/2010/01/11/custom-column-widths-in-excel-open-xml/

Dim columnWidthSize As Int32 = 20 ‘ Replace the following line with your desired Column Width for column # col
Dim columns As New Columns

For colInx As Integer = 0 To dt.Columns.Count
Dim column As Column = CustomColumnWidth(colInx, columnWidthSize)
columns.Append(column)
Next
newWorksheetPart.Worksheet.Append(columns)

‘ create sheet data
newWorksheetPart.Worksheet.AppendChild(New DocumentFormat.OpenXml.Spreadsheet.SheetData())

‘ save worksheet
WriteDataTableToExcelWorksheet(dt, newWorksheetPart)
newWorksheetPart.Worksheet.Save()

‘ create the worksheet to workbook relation
If (worksheetNumber = 1) Then
spreadsheet.WorkbookPart.Workbook.AppendChild(New DocumentFormat.OpenXml.Spreadsheet.Sheets())
End If

Dim sheet As DocumentFormat.OpenXml.Spreadsheet.Sheet = New DocumentFormat.OpenXml.Spreadsheet.Sheet
sheet.Id = spreadsheet.WorkbookPart.GetIdOfPart(newWorksheetPart)
sheet.SheetId = worksheetNumber
sheet.Name = dt.TableName
‘ Sheets.Append(sheet)

spreadsheet.WorkbookPart.Workbook.GetFirstChild(Of DocumentFormat.OpenXml.Spreadsheet.Sheets).Append(sheet)
‘ AppendChild(new DocumentFormat.OpenXml.Spreadsheet.Sheet()
Next
End Sub

Private Shared Sub WriteDataTableToExcelWorksheet(ByVal dt As DataTable, ByVal worksheetPart As WorksheetPart)

Dim worksheet As Worksheet = worksheetPart.Worksheet
Dim sheetData As SheetData = worksheet.GetFirstChild(Of SheetData)()

Dim cellValue As String = “”

‘ Create a Header Row in our Excel file, containing one header for each Column of data in our DataTable.

‘ We’ll also create an array, showing which type each column of data is (Text or Numeric), so when we come to write the actual
‘ cells of data, we’ll know if to write Text values or Numeric cell values.
Dim numberOfColumns As Integer = dt.Columns.Count
Dim IsNumericColumn(numberOfColumns) As Boolean

Dim excelColumnNames([numberOfColumns]) As String

For n As Integer = 0 To numberOfColumns
excelColumnNames(numberOfColumns) = GetExcelColumnName(n)
Next n


‘ Create the Header row in our Excel Worksheet

Dim rowIndex As UInt32 = 1

Dim headerRow As Row = New Row
headerRow.RowIndex = rowIndex ‘ add a row at the top of spreadsheet
sheetData.Append(headerRow)

For colInx As Integer = 0 To numberOfColumns – 1
Dim col As DataColumn = dt.Columns(colInx)
AppendTextCell(excelColumnNames(colInx) + “1”, col.ColumnName, headerRow)
IsNumericColumn(colInx) = (col.DataType.FullName = “System.Decimal”) Or (col.DataType.FullName = “System.Int32”)
Next


‘ Now, step through each row of data in our DataTable…

Dim cellNumericValue As Double = 0

For Each dr As DataRow In dt.Rows
‘ …create a new row, and append a set of this row’s data to it.
rowIndex = rowIndex + 1
Dim newExcelRow As New Row
newExcelRow.RowIndex = rowIndex ‘ add a row at the top of spreadsheet
sheetData.Append(newExcelRow)

For colInx As Integer = 0 To numberOfColumns – 1
cellValue = dr.ItemArray(colInx).ToString()

‘ Create cell with data
If (IsNumericColumn(colInx)) Then
‘ For numeric cells, make sure our input data IS a number, then write it out to the Excel file.
‘ If this numeric value is NULL, then don’t write anything to the Excel file.
cellNumericValue = 0
If (Double.TryParse(cellValue, cellNumericValue)) Then
cellValue = cellNumericValue.ToString()
AppendNumericCell(excelColumnNames(colInx) + rowIndex.ToString(), cellValue, newExcelRow)
End If
Else
‘ For text cells, just write the input data straight out to the Excel file.
AppendTextCell(excelColumnNames(colInx) + rowIndex.ToString(), cellValue, newExcelRow)
End If
Next

Next

End Sub

Private Shared Function CustomColumnWidth(ByVal columnIndex As Integer, ByVal columnWidth As Double) As Column
‘ This creates a Column variable for a zero-based column-index (eg 0 = Excel Column A), with a particular column width.
Dim column As New Column
column.Min = columnIndex + 1
column.Max = columnIndex + 1
column.Width = columnWidth
column.CustomWidth = True
Return column
End Function

Public Shared Sub AppendTextCell(ByVal cellReference As String, ByVal cellStringValue As String, ByVal excelRow As Row)
‘/ Add a new Excel Cell to our Row
Dim cell As New Cell
cell.CellReference = cellReference
cell.DataType = CellValues.String

Dim cellValue As New CellValue
cellValue.Text = cellStringValue

cell.Append(cellValue)

excelRow.Append(cell)
End Sub

Public Shared Sub AppendNumericCell(ByVal cellReference As String, ByVal cellStringValue As String, ByVal excelRow As Row)
‘/ Add a new Excel Cell to our Row
Dim cell As New Cell
cell.CellReference = cellReference
cell.DataType = CellValues.Number

Dim cellValue As New CellValue
cellValue.Text = cellStringValue

cell.Append(cellValue)

excelRow.Append(cell)
End Sub

Public Shared Function GetExcelColumnName(ByVal columnIndex As Integer) As String
If (columnIndex < 26) Then
Return Chr(Asc("A") + columnIndex)
End If

Dim firstChar As Char,
secondChar As Char

firstChar = Chr(Asc("A") + (columnIndex \ 26) – 1)
secondChar = Chr(Asc("A") + (columnIndex Mod 26))

Return firstChar + secondChar
End Function

End Class
————————————————————————————

http://mikesknowledgebase.com/pages/CSharp/ExportToExcel.htm

Dividend share KLSE 2017

[June topic: high dividend series] – you recommend, I analyze!
WeShareWeTrade decided to launch a high dividend series in June after the team launched a small series every month!
We will share a high dividend company every day in June and analyze whether these companies are suitable for long-term dividends to raise your passive income! That is, we will share and analyze 30 companies!
Will we share the thirty companies? We will analyze The Edge Malaysia finishing the 20 high dividend companies, the other 10 by you call the shots! You only need to comment comment recommend high dividend company name, our team will screen 10 and make an analysis in June.
A perfect portfolio must have at least one or two stable to no friends of the high-yield stocks to run together. So be sure to high-interest stocks this good Kang head to share with you like to buy shares to buy friends know, or really no friends. Haha, hope readers are much support! Share to share!
This is a 30-day homework share, you can expect the team in the next 30 days will be very busy, if asked at least thirty share should not be too much right: P hehe
The Edge Malaysia (# 1162) finishing the top 20 high dividend companies (dividends, net profit and positive cash flow over the past 10 years)

1. STAR (6084)

2. FPI (9172)

3. UCHITEC (7100)

4. MAGNUM (3859)

5. APOLLO (6432)

6. CSCENIC (7202)

7. BAT (4162)

8. TWRREIT (5111)

9. BJTOTO (1562)

10. FIMACOR (3107)

11. PERSTIM (5436)

12. HEIM (3255)

13. TASEK (4448)

14. HUPSENG (5024)

15. CYL (7157)

16. KFIMA (6491)

17. DLADY (3026)

18. LUXCHEM (5143)

19. MAGNI (7087)

20. WELLCAL (7231)

Dividend share KLSE 2017

【六月专题:高股息系列】- 你推荐,我分析!
继团队推出每月小股系列后,WeShareWeTrade决定在六月份推出高股息系列!
我们将会在六月的每一天都分享一家高股息的公司,并分析这些公司是否适合买来长期收股息,以提高你的passive income!也就是说,我们将会分享并分析30家公司!
我们会分享那三十家公司呢?我们将会分析The Edge Malaysia 整理的20大高股息公司,另外10家就由你们做主!你只需要留言comment推荐高股息公司的名字,我们团队就会筛选10家并在六月做出分析。
一个完美的投资组合中必定要有至少一两支稳到没有朋友的高息股来磨合一下。所以一定要把高息股这个好康头分享给你喜欢买股收息的朋友们知道,不然就真的没朋友了。哈哈,希望读者们多多支持!分享分享!
这是一个连续三十天的功课分享,可以预见团队在未来的三十天都会很忙碌,如果要求至少三十个分享应该不会很过分对吧 😛 hehe
The Edge Malaysia (#1162期) 整理的20家最棒的高股息公司(过去10年都有派股息,净利和正面现金流)

1. STAR (6084)

2. FPI (9172)

3. UCHITEC (7100)

4. MAGNUM (3859)

5. APOLLO (6432)

6. CSCENIC (7202)

7. BAT (4162)

8. TWRREIT (5111)

9. BJTOTO (1562)

10. FIMACOR (3107)

11. PERSTIM (5436)

12. HEIM (3255)

13. TASEK (4448)

14. HUPSENG (5024)

15. CYL (7157)

16. KFIMA (6491)

17. DLADY (3026)

18. LUXCHEM (5143)

19. MAGNI (7087)

20. WELLCAL (7231)
剩下的10家,由你们来推荐,我们来分析!

21. ?

22. ?

23. ?

24. ?

25. ?

26. ?

27. ?

28. ?

29. ?

30. ?
#你推荐,我分析

#高股息人人爱

#投资组合一定要有高股息的公司

MicrosoftAjax.js: Cannot read property ‘_notified’ of null

The problem is that the browser detection code in MicrosoftAjax.js does not detect WebKit (gasp!). Just include this javascript in your site and that should take care of it.

Sys.Browser.WebKit = {};
if (navigator.userAgent.indexOf(‘WebKit/’) > -1) {
Sys.Browser.agent = Sys.Browser.WebKit;
Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]);
Sys.Browser.name = ‘WebKit’;
}

https://forums.asp.net/t/1348484.aspx?error+in+MicrosoftAjax+js+Cannot+read+property+_notified+of+null