QRCode.net (from CodePlex) always replaces first character with an asterisk? - asp.net

Using QRCode.net assembly to generate QRCode images for URLs, I've tried most of the properties / options available and the URLs first character is always replaced with an asterisk (*). As the QRCode text is to be a URL, this means that some QRCode reader apps don't recognise my QRCode as a valid URL. For now, I pad the URL with a ' ' space so you at least get '*http://myapp.com', instead of '*ttp://myapp.com', but this always happens..
QRCode.Net on CodePlex
Has anyone seen this before, or know which setting stops it, I've tried most, here's my code:
Dim iee As New ImageEncoder()
iee.AutoConfigurate = True
iee.ECI = -1
iee.Encoding = 4
iee.Fnc1Mode = 0
iee.ErrorCorrectionLevel = 0
iee.Version = 1
iee.ProcessTilde = False
iee.MarginSize = 10
iee.ModuleSize = 6
iee.StructuredAppend = False
iee.StructuredAppendCounter = 0
iee.StructuredAppendIndex = 0
iee.TextData = " http://myApp.com/?querystringdata=here")
Dim image As Bitmap = iee.Encode2Image()
Dim tempSitePath As String
tempSitePath = HttpContext.Current.Server.MapPath(HttpContext.Current.Session("dirTempPath"))
image.Save(tempSitePath + "loc_" + locid + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)

This was bugged with them.. Ended up using a different library..

I found a demo library for QRCode.net.
http://www.codeproject.com/Articles/258779/Just-launched-new-open-source-project-QrCode-Net-a
This has downloadable source-code. I opened the solution, made a few changes to get the project to build and it created codes with no asterisk (*). I believe the demo code is older than this post, but perhaps the library has also been updated with a fix.

Related

Scroll to the end of the page in SAP GUI

I'm trying to automate my SAP GUI until the end of the page and I got the code below from this site https://www.appsloveworld.com/vba/200/144/algorithm-for-finding-end-of-a-list-sap-gui
I only changed the text after findById but I get this error at the line which changes verticalScrollbar.Position:
object doesn't support this property or method
Any ideas on how to solve that?
Do While Not blank
If session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").Text = "" _
Then blank = True
session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell").verticalScrollbar.Position = i
i = i + 1
Loop

VBA for extracting Data from URL

I am trying to get some data from google map with VBA to extract in to excel. as I am not expert in VBA so facing some problem. in side google map, if we scroll to down there are some web result links coming in script. I want to extract that link if possible. here I try from my end but not getting actually result what I want
here is screen shot for web result of google map url
also here I some code which I try but not success
Public Sub GmapData()
'On Error Resume Next
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "https://g.page/MiguelLopezSalon?share" ' try with first URLS and second
Do
DoEvents
Loop Until ie.readystate <> 4
Application.Wait (Now + TimeValue("00:00:15"))
Dim MyData As New MSForms.DataObject
MyData.GetFromClipboard
For N = 0 To ie.document.getElementsByClassName("ugiz4pqJLAG__primary-text gm2-body-2").Length - 1
If ie.document.getElementsByClassName("ugiz4pqJLAG__primary-text gm2-body-2").Item(N).innerText = "About this data" Then
ie.document.getElementsByClassName("ugiz4pqJLAG__primary-text gm2-body-2").Item(N).ScrollIntoView (False)
End If
Next N
Application.Wait (Now + TimeValue("00:00:05"))
GMD = ie.document.getElementsByClassName("trex").Item(0).innerHTML ' facing error here
ActiveSheet.Cells(1, 1).Value = GMD
End Sub
I try to google on my issue.. then found its a iframe inside html.. also try with following code line but still not get result
ie.document.getElementsByTagName("iframe")(0).document.getElementsByClassName("trex").Item(0).innerHTML
Please anyone can me help out. to extract data within Ifram

Trouble with "string.contains" function

I am writing a web form that has a unique travelID per travel request. (see blank column in picture below, I'm not high enough reputation to embed the picture in here)
Some of the travel requests have attached documents and others do not. I wrote this code:
Dim dirs As String() = Directory.GetFiles("E:\DomainWebs\Intranet\fileups\TravelDocs\")
Dim i As Integer = 0
For Each GridRecord As GridRecord In TravelWebDataGrid.Rows
For Each doc As String In dirs
If doc.Contains(TravelWebDataGrid.Rows(i).Items(10).Value) = True Then
TravelWebDataGrid.Rows(i).Items(11).Value = True
End If
Next
i += 1
Next
Just for testing, only the top Travel Request has documents attached. As you can see, it is checking the second row checkbox as well even though it doesn't have any documents attached.
This is what is being compared to row 2:
"DocName" - E:\DomainWebs\Intranet\fileups\TravelDocs\RONNIEP20180124141116-Hello.docx
"TravelID" - RONNIEP20180124135357
Does anyone know why it is doing this? Let me know if you need any more information. Thanks in advance for your responses.
This might be off because I haven't worked with a datagrid but it looks like the code has been over-complicated with the counter. Can you do this?
' you're looping gridrecords/rows.
For Each GridRecord As GridRecord In TravelWebDataGrid.Rows
For Each doc As String In dirs
' use the gridrecord here, not rows(i).
If doc.Contains(GridRecord.Items(10).Value) = True Then
' and here.
GridRecord.Items(11).Value = True
End If
Next
Next

ADODB.Stream ReadText error

I am using a downloaded pure ASP script to upload files. My form contains a textarea and a file upload component. It works fine when I enter regular text but it cannot handle when I copy and paste something from word having special characters. The error I am getting is:
Provider error '80070057'
The parameter is incorrect.
/forum/freeaspupload.asp, line 309
The part of my code which throws the error is:
Private Function ConvertUtf8BytesToString(start, length)
StreamRequest.Position = 0
Dim objStream
Dim strTmp
' init stream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Charset = "utf-8"
objStream.Mode = adModeReadWrite
objStream.Type = adTypeBinary
objStream.Open
' write bytes into stream
StreamRequest.Position = start+1
StreamRequest.CopyTo objStream, length
objStream.Flush
' rewind stream and read text
objStream.Position = 0
objStream.Type = adTypeText
strTmp = objStream.ReadText
' close up and return
objStream.Close
Set objStream = Nothing
ConvertUtf8BytesToString = strTmp
End Function
Line 309 is the line:
strTmp = objStream.ReadText
Any idea how to fix it?
I know it's an old question but since there is no answer and I got the exact same problem and finally found a solution, I think it can be good to share it.
The problem is related to IIS version since it was working fine on IIS6 but stop to work when we moved to IIS8.5
See ReadText
By defaut ReadText parameter is -1 (adReadAll).
For some reason, this default parameter seems not working with IIS8.5. You have to put the length of the text that you want to read.
so ReadText(2000) will work fine.
Of course, you will have to figured out the maximum length or find a way to loop and read everything
By MSFT :
If NumChar is more than the number of characters left in the stream, only the characters remaining are returned. The string read is not padded to match the length specified by NumChar. If there are no characters left to read, a variant whose value is null is returned. ReadText cannot be used to read backwards.

Sending mails in different languages using ASP and CDOSYS

I want to send an email using arabic text as subject line.
The code piece converts the special characters into arabic text properly for message body but fails to do so for message subject.
I would like to know what I am missing ?
Set objCDOSYS = Server.CreateObject("CDO.Message")
Set objCDOConf = CreateObject("CDO.Configuration")
Set objCDOFields = objCDOConf.Fields
objCDOFields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOFields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1"
objCDOFields.Update
Set objCDOSYS.Configuration = objCDOConf
objCDOSYS.MimeFormatted=True
objCDOSYS.BodyPart.Charset = "Windows-1256"
objCDOSYS.From = Trim(Request.Form("frmSender"))
objCDOSYS.To = Trim(Request.Form("frmRecipient"))
objCDOSYS.Subject =Request.Form("frmSubject")
objCDOSYS.HTMLBody = Trim(Request.Form("frmMessage"))
objCDOSYS.HTMLBodyPart.charset = "Windows-1256"
objCDOSYS.Fields.update
objCDOSYS.Send
Set objCDOFields = Nothing
Set objCDOConf = Nothing
Set objCDOSYS = Nothing
Changing to the UTF-8 charset is worth a stab:-
objCDOSYS.HTMLBodyPart.charset = "UTF-8"
I think that will result in the kind of encoding Jirapong was trying but CDOSYS will do it for you. Unfortunately I know that it doesn't work for display names in the email addresses.
You may need to use '=?UTF-8?B?' in front of subject and the Arabic base64 encoded string.
objCDOSYS.Subject = "=?UTF-8?B?" + Base64Encode(Request.Form("frmSubject"))
The Base64Encode function can find at - http://nolovelust.com/post/classic-asp-base64-encoder-decoder.aspx
Note: I did try this myself yet. so not 100% sure.
For me the combination of these 4 items worked:
session.codepage=65001
Response.Charset = "utf-8"
objMessage.HTMLBodyPart.Charset = "utf-8"
objMessage.BodyPart.Charset = "utf-8"

Resources