HTML doesnt work when i copy paste into another document - html

I have written some HTML with notepad, when i open it with IE it works fine and loads the google map on the page.
I have then converted that text into vb.net stream writer. when it creates the html document it wont load the google map. but, if i copy the html that the application creates and paste it into a html document i make with notepad it works fine.
Whats going on?
I use
Using writer As StreamWriter = New StreamWriter("C:\CarPosition" & Loc & ".htm", True)
to write the bulk of the HTML
and i have a loop in the application to write an array, i use the following line to do that:
My.Computer.FileSystem.WriteAllText("C:\CarPosition" & Loc & ".htm", vbNewLine & "['Car:" & CarNumber & "'," & " -" & LatsDecimal & "," & " " & LongsDecimal & ", " & Count & "],", True)
I want to know if vb.net writes some hidden characters in text documents or notepad does? because if i analyse the two html documents they are identical, one loads correctly in IE and one doesnt.
thanks,
Mike

Tips:
Do a binary diff between the two files to find the difference. You can do it online
Check BinaryReader for reading the file in the first place https://stackoverflow.com/a/10353961/390330

Related

Singular express refer to nonexisting object?

I am using below code for reporting purpose, everything was fine but all of sudden this code started giving error saying Singular expression refer to nonexisting object
I also break the whole code bit by bit & able to trace the problem but confused what to use in there & why its giving that error statement.
if I remove following part I am able to get the results & relevance works perfectly fine but that will break the formatting which required to csv output.
(html it) of concatenations of
<?relevance
(html it) of concatenations of ( "%22" &
name of computer of it & "%22|%22" &
name of issuer of action of it & "%22|%22" &
name of action of it & "%22|%22" &
status of it as string & "%22|%22" &
state of action of it & "%22%0d%0a"
)
of results of bes actions whose (name of it starts with "Config_item")
?>
I was able to solve it, actually the output which this code is generating against each from was not available for some property which cause the problem.
after I made the below changes into it with else condition it solve the problem.
(html it) of concatenations of ( "%22" &
(name of computer of it | "None") & "%22|%22" &
name of issuer of action of it & "%22|%22" &
name of action of it & "%22|%22" &
status of it as string & "%22|%22" &
state of action of it & "%22%0d%0a"
)
This line actually helped in solving this - (name of computer of it | "None")

writing csv in vbscript with multiline fields

I have been wrestling with this problem with past 4 hours and to be honest really exhausted... I am trying to write a CSV file through vbscript with multi lines in few of the fields... thought it would be easy peasy ... not so ...My original code is
summary = "This is my brief summary"
description = "Hello" & vbCrLf & "Today, I am going to describe my issue."
reference_id = "0000102203"
Set fso = CreateObject("Scripting.FileSystemObject")
Set csv = fso.CreateTextFile(download_file_name,True)
csv.WriteLine summary & "," description & "," & "Consulting" & "," & reference_id
csv.close
set csv = Nothing
All I am trying to do is create a csv, and when I use excel to open the file would show up as
This is my brief summary| Hello |Consulting| 0000102203
| Today, I am going to describe my issue. |
And what I am getting with numerous tries of replacing vbCrLf with vbCr,vbLf, chr(10), chr(13), "\n", "\n", "\r","\r" and heaps more
This is my brief summary| Hello
Today, I am going to describe my issue. |Consulting| 0000102203
Is there anyway I can actually solve this problem?
Thanks
There is no actual standard. This RFC came well after CSVs were invented. So you can do what you want, but you'll also need code to read your own standard as other tools won't. Implement CR as a special character (code 222 has historical meaning for me - SurveyCraft) and replace with CR after importing.
From https://www.rfc-editor.org/rfc/rfc4180 (also see https://en.wikipedia.org/wiki/Comma-separated_values)
Definition of the CSV Format
While there are various specifications and implementations for the
CSV format (for ex. [4], [5], [6] and [7]), there is no formal
specification in existence, which allows for a wide variety of
interpretations of CSV files. This section documents the format that
seems to be followed by most implementations:
Each record is located on a separate line, delimited by a line
break (CRLF). For example:
aaa,bbb,ccc CRLF
zzz,yyy,xxx CRLF
The last record in the file may or may not have an ending line
break. For example:
aaa,bbb,ccc CRLF
zzz,yyy,xxx
OKay, after 4 hours of literally banging my head on the keyboard, I finally figure out how to solve the problem. So if anyone is interested ... Just changed this part of the code
description = "Hello" & vbCrLf & "Today, I am going to describe my issue."
csv.WriteLine summary & "," description & "," & "Consulting" & "," & reference_id
to
desc1 = "Hello"
desc2 = "Today, I am going to describe my issue."
csv.WriteLine summary & ",""" desc1 & vbCrLf & desc2 & """," & "Consulting" & "," & reference_id
Ta Da ... worked like a charm ...

Drag and Drop File into Microsoft Access

I have a form in Microsoft Access which lets users upload attachments to each record. I'd like to make it a little user friendly by letting users drag and drop files into the attachment field. What is the best way of doing this/how do I do this?
Drag and drop might be a bit more sophisticated, how about VBA code to manipulate what you wish to achieve? This article has a great reference to what you wish to do. http://www.access-freak.com/tutorials.html#Tutorial07
Here is a way to drag and drop "attached" files for use with MS Access database.
(Currently using Office 365 Version 1811)
MS Access currently allows drag and drop to a hyperlink field.
Using this capability this example allows drag and drop to store an attachment file to a storage location while keeping a link to the original and new locations. The event runs when a file is dropped into the HyperlinkIn box on the form or when the hyperlink is changed the normal way.
It is better to store the file in a storage location with a link than to store it within the .accdb file due to the 2GB limitation. You might call this a database + file server architecture. By using the record number and optionally the database and table name and attachment number you can ensure unique file names.
Make a Table and Form with 3 fields.
ID (AutoNumber)
HyperlInkIN (hyperlink)
HyperLinkOUT (hyperlink)
Insert this VBS code for AfterUpdate event for the HyperlinkIn form control.
Private Sub HyperlinkIN_AfterUpdate()
Dim InPath As String
Dim FileName As String
Dim OutFolder As String
Dim OutPath As String
Dim RecordNo As String
Dim FileExt As String
OutFolder = "\\networkdrive\vol1\attachments\" 'specify the output folder
InPath = Me!HyperlinkIN.Hyperlink.Address
RecordNo = Me!ID
If Len(InPath) > 0 Then
FileName = Right(InPath, Len(InPath) - InStrRev(InPath, "\")) 'get the file name
FileExt = Right(FileName, Len(FileName) - InStrRev(FileName, ".") + 1) ' get the file extension with dot
'build the new path with output folder path and record number and date and extension
OutPath = OutFolder & "Record " & RecordNo & " Attachment " & Format(Now(), "ddmmmyy") & FileExt
FileCopy InPath, OutPath
Me!HyperlinkOUT = "#" & OutPath & "#"
MsgBox "Copied file to archives " & vbCrLf & InPath & vbCrLf & OutPath
End If
End Sub
I am somewhat inexperienced with vba so there may be some better ways to ensure and verify a successful file copy but this example works for me and is easy for me to understand. I used the MsgBox to help debug with the actual file copy commented out.
Because this page comes as first when searching for "MS Access drag drop", I'm adding my part here. If you are after some cool UI, you can checkout my Github for sample database using .NET wrapper dll. Which allows you to simply call a function and to open filedialog with file-drag-and-drop function. Result is returned as a JSONArray string.
code can be simple as
Dim FilePaths As String
FilePaths = gDll.DLL.ShowDialogForFile("No multiple files allowed", False)
'Will return a JSONArray string.
'Multiple files can be opend by setting AllowMulti:=true
here what it looks like;

How to add a subreport in a new window?

I am developing a SSRS 2008 R2 RDL with a chart. Currently, I have a subreport built into this chart where if they click on a pie piece it goes directly to this subreport. It is currently configured as an action on the series via "Go to Report".
However, my customer wants it to instead open a new browser window so that they can still see original chart without having to rerun my report. Also, this subreport requires several input parameters. I tried the "Go to URL" Action link instead and entered the URL there. But this didn't work cause I couldn't pass in my input parameters. How can I do this?
This subreport takes multiple parameters. I have it configured as:
="javascript:void(window.open('http://evolvdb/Reports/Pages/Report.aspx?ItemPath=%2fIncoming%2fCensus_by_Date_Range2_Subreport&rs:Command=Render&startdate="+Parameters!startdate.Value+"&enddate="+Parameters!enddate.Value+"&region="+Parameters!region.Value+"&state="+Parameters!state.Value+"&office="+Parameters!office.Value+"&status="+Parameters!status.Value+"&program_hyperlink="+Fields!program_code.Value+"&funding_source_param="+Parameters!funding_source.Value+"'))"
But when I try to click this subreport it is not clickable.
I also tried this, but this exceeds the 255 character count:
="javascript:void(window.open('http://evolvdb/Reports/Pages/Report.aspx?ItemPath=%2fIncoming%2fCensus_by_Date_Range2_Subreport&rs:Command=Render&startdate=" & Parameters!startdate.Value & "&enddate=" & Parameters!enddate.Value & "&region=" & Parameters!region.Value & "&state=" & Parameters!state.Value & "&office=" & Parameters!office.Value & "&status=" & Parameters!status.Value & "&program_hyperlink=" & Fields!program_code.Value & "&funding_source_param=" & Parameters!funding_source.Value & "'))"
I also tried this, but this was not clickable either:
="javascript:void(window.open('http://evolvdb/Reports/Pages/Report.aspx?ItemPath=%2fIncoming%2fCensus_by_Date_Range2_Subreport&rs:Command=Render
&startdate="+Parameters!startdate.Value+"
&enddate="+Parameters!enddate.Value+"
&region="+Parameters!region.Value+"
&state="+Parameters!state.Value+"
&office="+Parameters!office.Value+"
&status="+Parameters!status.Value+"
&program_hyperlink="+Fields!program_code.Value+"
&funding_source_param="+Parameters!funding_source.Value+"'))"
I'm looking at the last code snippet that you tried and here is my feedback:
The report path doesn't look correct. Should be in the format http://evolvdb/ReportServer/Path/To/Report&Parameters=XX
You can't concatenate strings in SSRS with + and need to use & instead.
Example:
="javascript:void(window.open('http://evolvdb/ReportServer/Incoming%2fCensus_by_Date_Range2_Subreport&rs:Command=Render
&startdate=" & Parameters!startdate.Value & "
&enddate=" & Parameters!enddate.Value & "
&region=" & Parameters!region.Value & "
&state=" & Parameters!state.Value & "
&office=" & Parameters!office.Value & "
&status=" & Parameters!status.Value & "
&program_hyperlink=" & Fields!program_code.Value & "
&funding_source_param=" & Parameters!funding_source.Value & "'))"
My general advice for creating SSRS links is to take your browser and start there with zero programming. Ensure that your report path is correct, then manually add a parameter and ensure the report accepts the parameter value correctly. Once you have a working URL example, create a textbox in your report that spits out the URL string you are trying create. This is an easy way to ensure you are getting the expected output and you can compare to the URL that you manually crafted in the first step. Lastly, put the finished expression into the "Go to URL" action and you should most likely have a link that works as expected.

MS Access 2003 - Sparkline Graphs in Microsoft Access

Hey guys. Just wondering if anyone knows of a method to create sparkline graphs on a form in MS Access. The chart builder does not really work very well to create sparkline charts (graphs that small).
Just curious, thanks!
I don't think there is anything built in for Sparkline graphs in MS Access. You have to use a third party control and deploy it along with your app to all users or use MS Excel embedded control to show the graph.
There is a VBA-powered sparkline solution featured on the Access blog fairly recently: http://blogs.office.com/b/microsoft-access/archive/2011/02/10/power-tip-add-sparkline-like-graphs-to-access-reports.aspx
They have an .mdb as well as an .accdb sample file available, so I'm guessing it works across multiple versions.
I started with the VBA-powered sparkline but didn't like that it looked low-resolution and I couldn't use it on a continuous form (it only works on reports). The solution I came up with was to build the charts in Excel and save the chart images in a subfolder. Then it's easy to link the image on a report or continuous form. My charts update nightly, though the Excel chart building loop is really fast. The slow part is generating the data that the charts need, which may vary depending on what you are charting.
I created a template in Excel that had a chart with the look and resolution that I wanted. I wrote a VBA routine in Access to open an Excel sheet and loop through each record that I wanted to chart. The sheet is passed to this function (below), which loads a records of chart data and passes it into Excel, which automatically refreshes the 'SparkChart' object. It then saves the image to a subfolder. The Excel sheet stays open and is re-used with each loop. I didn't include the function with the loop.
Here's what my chart looks like in Excel:
Here is an example of the Sparklines shown in a continuous form:
Public Function fCreateSparklineChart(pDQ_ID As Long, pChartSheet As Object) As Boolean
' Pass in a Dashboard Query ID for data that has already compiled into the top-n
' temp table and the data will be copied to the passed pChartSheet in Excel. This
' will update a chart object, then the chart is saved as a .png file.
Dim strSQL As String
Dim strChartPath As String
Dim rs As DAO.Recordset
On Error GoTo ErrorHandler
' Get chart data from a table that has already been compiled with
' min and max values as percentages so the lowest value is 0
' and the highest value is 100.
strSQL = " SELECT DQ_ID, Trend_Value, " & _
" IIf(Trend_Value=0,0,Null) AS Min_Point, " & _
" IIf(Trend_Value=100,100,Null) AS Max_Point " & _
" FROM " & DASHBOARD_TMP_TABLE & _
" WHERE (DQ_ID=" & pDQ_ID & ") "
strSQL = strSQL & " ORDER BY RowNo "
Set rs = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
If rs.RecordCount > 0 Then
pChartSheet.Range("A1").CurrentRegion.Clear
pChartSheet.Range("A1").CopyFromRecordset rs
pChartSheet.ChartObjects("SparkChart").Chart.SetSourceData pChartSheet.Range("rngData")
' Use a filename that includes the record ID.
strChartPath = CurrentProject.Path & "\Images\Sparkline_DQ_ID_" & Format(pDQ_ID, "0000") & ".png"
' Delete the file if it already exists.
DeleteFile strChartPath
' Save the Excel chart as a png file.
pChartSheet.ChartObjects("SparkChart").Chart.Export strChartPath, "png"
fCreateSparklineChart = True
End If
Exit_Function:
Exit Function
ErrorHandler:
fCreateSparklineChart = False
MsgBox "Error #" & err.Number & " - " & err.Description & vbCrLf & "in procedure fCreateSparklineChart of basSparkline"
GoTo Exit_Function
End Function
I've been thinking of creating a YouTube video explaining how I built this Data Quality Dashboard to chart data trends. Let me know if you are interested and I may be encouraged to do it.